Reputation: 840
does anybody know whether i can stop the profiler from ddms programatically? I have a bit longer process and want to stop the profile after this process is done and not manually. Is there any method to do this?
Upvotes: 3
Views: 926
Reputation: 20936
If I understand the question correctly you can simply put the following methods in the code of your application:
android.os.Debug.startMethodTracing("name_of_trace");
//here you put what you want to profile
android.os.Debug.stopMethodTracing();
All the traces are stored on /sdcard
You can simply use adb pull
command to download them:
adb pull /sdcard/name_of_trace.trace
After that you can see the results using command monitor (if you use the old versions of Android tools then you should use traceview
command. However, for newer version this command is also working):
monitor name_of_trace.trace
Upvotes: 7