I want to capture Systrace report on my Android phone while doing automated testing. It is unknown how long the testing will take, so I can't specify the --time period for the Systrace.
Digging deeper in to the systrace.py, I found out that systrace is using atrace to get the kernel logs.
I used adb shell atrace --help
and got the following output:
usage: atrace [options] [categories...]
options include:
-a appname enable app-level tracing for a comma separated list of cmdlines
-b N use a trace buffer size of N KB
-c trace into a circular buffer
-k fname,... trace the listed kernel functions
-n ignore signals
-s N sleep for N seconds before tracing [default 0]
-t N trace for N seconds [defualt 5]
-z compress the trace dump
--async_start start circular trace and return immediatly
--async_dump dump the current contents of circular trace buffer
--async_stop stop tracing and dump the current contents of circular
trace buffer
--list_categories
list the available tracing categories
How can I use atrace to start tracing at the beginning of my automated testing, and stop the tracing and dumping the kernel log at the end of my automated testing?
I tried using the following commands, but I don't think it works properly. Only async_dump gives me some data in the log. async_stop dump doesn't have any content in the log. How do I properly start the trace, dump it, and then stop it?
adb shell atrace -b 10000 -c am shedgfx view --async_start > C:\Users\user1\Desktop\log.txt
adb shell atrace -b 10000 -c am shedgfx view --async_dump > C:\Users\user1\Desktop\log.txt
adb shell atrace -b 10000 -c am shedgfx view --async_stop > C:\Users\user1\Desktop\log.txt