高通文档
写成脚本
#!/system/bin/sh
DIR=/sys/kernel/tracing
echo 0 > $DIR/tracing_on
echo "" > $DIR/trace
rm -rf /data/local/trace.txt
echo 0 > $DIR/tracing_on
echo 150000 > $DIR/buffer_size_kb
cat $DIR/buffer_size_kb
echo "" > $DIR/set_event
echo "" > $DIR/trace
echo clk:clk_disable clk:clk_enable clk:clk_set_rate clk:clk_state >> $DIR/set_event
echo power:cpu_frequency power:cpu_idle sched:sched_wakeup sched:sched_switch sched:sched_enq_deq_task >> $DIR/set_event
echo sched:sched_find_best_target >> $DIR/set_event
echo sched:sched_task_util_colocated sched:sched_task_util_bias_to_waker >> $DIR/set_event
echo sched:sched_update_task_ravg sched:sched_load_to_gov >> $DIR/set_event
echo power:bw_hwmon_meas power:bw_hwmon_update power:memlat_dev_meas power:memlat_dev_update >>$DIR/set_event
echo sched:core_ctl_eval_need perf_trace_counters:sched_switch_with_ctrs >> $DIR/set_event
echo sched:sched_set_boost sched:sched_set_preferred_cluster >> $DIR/set_event
echo power:sugov_next_freq power:sugov_util_update >> $DIR/set_event
echo sched:sched_migrate_task sched:sched_load_balance sched:sched_task_util >> $DIR/set_event
echo msm_bus:bus_update_request >> $DIR/set_event
echo kgsl:kgsl_clk kgsl:kgsl_pwrlevel kgsl:kgsl_buslevel kgsl:kgsl_gpubusy kgsl:kgsl_pwrstats kgsl:kgsl_pwr_set_state >> $DIR/set_event
echo regulator:regulator_set_voltage_complete regulator:regulator_disable_complete regulator:regulator_enable_complete >> $DIR/set_event
cat $DIR/set_event
cat /d/clk/trace_clocks
if [ -d "/d/tracing/events/msm_bus/bus_client_status" ]; then
echo "bus_client_status exists hence enabling it"
echo 1 > /d/tracing/events/msm_bus/bus_client_status/enable
cat /d/msm-bus-dbg/client-data/dump_clients
fi
sleep 5
echo 1 > /d/tracing/events/clk/clk_state/enable
echo 1 > $DIR/tracing_on
sleep 60
echo 0 > $DIR/tracing_on
cat $DIR/trace > /data/local/trace.txt
cat &(date) >> /data/local/trace.txt
我一般的步骤是:
adb push ftrace_test.sh /data
chmod 777 ftrace_test.sh
nohup ./ftrace_test.sh &
抓到后在/data/local 下会出现trace.txt
adb pull /data/local/trace.txt .