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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With