自動テストの実行中に、Android フォンで Systrace レポートを取得したいと考えています。テストにかかる時間は不明であるため、Systrace の--time期間を指定することはできません。
systrace.py をさらに掘り下げると、systraceがatraceを使用してカーネル ログを取得していることがわかりました。
adb shell atrace --help
私は次の出力を使用して得ました:
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
自動テストの開始時にatraceを使用してトレースを開始し、自動テストの終了時にトレースとカーネル ログのダンプを停止するにはどうすればよいですか?
以下のコマンドを使ってみましたが、うまく動かないと思います。async_dump だけがログにいくつかのデータを提供します。async_stop ダンプのログにはコンテンツがありません。トレースを適切に開始し、ダンプしてから停止するにはどうすればよいですか?
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