【Performance】如何抓取离线Systrace

Offline systrace can help to collect systrace when system need to get deep sleep. In such scenario, like no usb connection is available or system need to get into LMP other mode.You can use this document to get proper systrace to help performance issue

precondition

1.adb root and adb remount is available

2./system/bin/atrace ​is available

Collect systrace

1, run "adb root && adb remount"

2, in adb shell, run below command:

atrace -z -b 40000 gfx input view wm am hal res dalvik rs sched freq idle load disk mmc -t 15 > /data/local/tmp/trace_output &

-a appname enable app-level tracing for a comma separated list of cmdlines

-b N use a trace buffer size of N KB

-t N trace for N seconds [defualt 5]

-z compress the trace dump

--list_categories list the available tracing categories

The time and buffer size should be long enough to finished the systrace collecting.

3, remove USB connection

4, reproduce this issue

Get the systrace from device

1.reconnect the device with USB cable

2.Use "adb shell ps -t | grep atrace ", if no such atrace, it is fine to get out the systrace

3.Use below command:

adb pull /data/local/tmp/trace_output

Covert the systrace

systrace.py --from-file trace_output -o output.html

Now, you can use Chrome to analyze the systrace file.

【高通平台】

Most kernel modules have tracing configuration, customer can switch on/off tracing event

accordingly.

For example, if you only care about bus vote, following settings is preferred.

adb shell "echo 0 > /sys/kernel/debug/tracing/tracing_on"

adb shell "echo > /sys/kernel/debug/tracing/trace"
adb shell "echo > /d/tracing/set_event"adb shell "echo 1 >
/sys/kernel/debug/tracing/events/msm_bus/bus_update_request/enable"
adb shell "echo 1 > /sys/kernel/debug/tracing/events/msm_bus/bus_update_request_end/enable"
adb shell "echo 1 > /d/tracing/events/rpm_smd/enable"
adb shell "echo 1 > /sys/kernel/debug/tracing/events/power/clock_set_rate/enable"
adb shell "echo 1 > /sys/kernel/debug/tracing/events/mdss/mdp_video_underrun_done/enable"
adb shell "echo 1 > /sys/kernel/debug/tracing/tracing_on"
adb shell cat /sys/kernel/debug/tracing/trace_pipe > trace_pipe.txt

Enable the fence event when get systrace will help know which module is pending.

command:

adb shell "echo kgsl:* >> /d/tracing/set_event"
adb shell "echo 1 > /sys/kernel/debug/tracing/events/kgsl/syncpoint_timestamp/enable"
adb shell "echo 1 > /sys/kernel/debug/tracing/events/kgsl/syncpoint_timestamp_expire/enable"
adb shell "echo 1 > /sys/kernel/debug/tracing/events/kgsl/syncpoint_fence/enable"
adb shell "echo 1 > /sys/kernel/debug/tracing/events/kgsl/syncpoint_fence_expire/enable"
adb shell "echo 1 > /d/tracing/events/mdss/enable"
adb shell "echo 1 > /d/tracing/events/mdss/tracing_mark_write/enable"
adb shell "echo 1 > /d/tracing/events/binder/enable"

你可能感兴趣的:(【Performance】如何抓取离线Systrace)