Android Question How to debug a program delay?

GaryK4

Member
Licensed User
Longtime User
I have a large golf program that I developed. It handles player selection, scores, bets and maps. GPS is in a service. After completing a hole, I enter all my partners scores, then turn the screen off. When I get to the next hole, I turn the screen back on. Fairly often, it appears like the app is hung. It could take 5-10 seconds to accept a button press. Then all is works well. When at home, I cannot reproduce the error.
Any suggestions what to look for or how do debug this situation?
 

LucaMs

Expert
Licensed User
Longtime User
upload_2018-4-29_18-10-56.png



= how should we help you with those few informations?
 
Last edited:
Upvote 0

GaryK4

Member
Licensed User
Longtime User
I know it is not a lot of information, but other then posting the whole application what other information would help?
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
maybe u are using a wait for event that cause the delay?
just log the app flow as suggested with time stamps and some infos and you will see the gap.
you can log if a sub starts, if it ends, buttons clicks, before & after wait for etc.
its more for benchmark tests but a stop watch class can also helpful.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Your GPS should be working just fine as it's in a service, even if your phone is in your pocket there shouldn't be any issues.

I would do what @KMatle suggest, but I would also add a name, start and stop time to the log for the sections you are monitoring. That way when you view the logs later that day, you will easily be able to tell which part of your code is running slowly. Instead of seeing a name start stop time in milliseconds you will see seconds, and that's where your issue will be...
 
Upvote 0
Top