Reputation: 10545
I installed some 3rd party apps from Google Play. For some research purpose, I need to profile those apps.
For example, profile the time when some callback functions, like "onCreat()" "onStartCommand()" "onStopped()", start and finish.
Any clue?
Upvotes: 0
Views: 287
Reputation: 40669
If you can run the whole thing under a debugger, it doesn't matter if the 3rd-party code has debug information, as long as if you hit Ctrl-C or Pause, and if it's in one of your callbacks, it shows that callback on the stack.
The stack trace should look something like this when it is in your callback:
<some system/library routines called by your callback>
...
YourCallbackCode
...
<the 3rd-party routines>
...
YourTopLevelCode
...
main()
So if you take 10 or 20 such samples, the fraction of time that YourCallbackCode
appears on the stack is a good estimate of what fraction of time it is responsible for.
(Unless it's very small, in which case your code is not the bottleneck.)
For example, if it's on 50% of stack samples, it's responsible for 50% of time (approximately).
So if you could cut its time in half (say by doing fewer new
s), you would save half of that 50%, or 25% overall, for a speedup of 100/75 = 1.33 = 33%
You can even see what lines in your callback code are costing the bulk of the time.
Upvotes: 1
Reputation: 1006839
Choose apps that are open source, compile them from source in debug mode, then profile the results.
Upvotes: 0