赞
踩
参考代码kernel-4.14/include/trace/events/mtk_events.h
TRACE_EVENT(perf_index_s,
TP_PROTO(
unsigned int sf0,
unsigned int sf1,
unsigned int sf2,
int dram_freq,
int bw_c,
int bw_g,
int bw_mm,
int bw_total,
int vcore_uv
),
systrace类似这样的打印:
swapper/2-0 (-----) [002] d.h1 1156.964742: perf_index_s: sched_freq=2000000|2000000|0 dram_freq=800 bw=-2135138048|-2135138048|-2135138048|-2135138048 vcore=550000
dram_freq=800 bw=-2135138048|-2135138048|-2135138048|-2135138048 vcore=550000
DDR频率 800MHz、CPU Bandwidth、GPU Bandwidth、modem Bandwidth、total Bandwidth、vcore电压。 Bandwidth数据可能不准,部分平台没有实现。
需要打开的Systrace event
adb shell "echo 1 > /sys/devices/system/cpu/perf/enable"
kernel-V4.1*版本: adb shell "echo 1 > /sys/kernel/tracing/events/mtk_events/perf_index_s/enable"
kernel-V5.10版本: adb shell "echo 1 > /sys/kernel/tracing/events/perf_tracker/perf_index_s/enable"
adb shell "echo 1 > /sys/devices/system/cpu/perf/enable"
kernel-V4.1*版本: adb shell "echo 1 > /sys/kernel/tracing/events/mtk_events/perf_index_l/enable"
kernel-V5.10版本: adb shell "echo 1 > /sys/kernel/tracing/events/perf_tracker/perf_index_l/enable"
比如systrace log:
<idle>-0 (-----) [002] d.h1 2173.342581: perf_index_l: free_mem=853360 avail_mem=5227104 iostats=0|0|0|0|0|0|0|0|0|7992616|0 stall=3|0|0|0|0|0|0|0
adb shell "echo 63 > /sys/kernel/fpsgo/common/systrace_mask" // this for fpsgo
adb shell “echo 1 > /sys/kernel/fpsgo/xgf/xgf_trace_enable”
adb shell “echo 1 > /sys/kernel/fpsgo/xgf/xgf_log_trace_enable”
adb shell "echo 1 > /sys/module/ged/parameters/ged_log_perf_trace_enable" // these for GPU
adb shell "echo 1 > /sys/devices/system/cpu/perf/enable"
adb shell "echo 1 > /sys/module/ged/parameters/ged_log_trace_enable"
adb shell "echo 1 > /sys/kernel/tracing/events/mtk_events/perf_index_gpu/enable"
adb shell "echo 1 > /sys/kernel/tracing/events/perf_tracker/perf_index_gpu/enable"
mtkPowerMsgHdl-762 ( 700) [005] ...1 37118.430645: tracing_mark_write: C|5566|gpu_freq|431|0|0
mtkPowerMsgHdl-762 ( 700) [005] ...1 37118.430645: tracing_mark_write: C|5566|gpu_freq_max|886|0|0
ipi_cpu_dvfs_rt-391 ( 391) [007] .... 37118.682285: cpu_frequency: state=1624000 cpu_id=6
ipi_cpu_dvfs_rt-391 ( 391) [007] .... 37118.682286: cpu_frequency_limits: min=1820000 max=3000000 cpu_id=7
<idle>-0 (-----) [007] d..1 37120.151326: cpu_idle: state=0 cpu_id=7
如果没有CPU频率,请检查这些trace event有没有打开:
/sys/kernel/tracing/events/power/cpu_frequency_limits/
cpu_frequency_limits
cpu_frequency
cpu_idle
kernel-5.10 频率和摆核信息都抓取: sched_migrate_task sugov_ext_util sched_task_uclamp sched_select_task_rq sched_queue_task sched_frequency_limits sched_find_energy_efficient_cpu sched_big_task_rotation sched_force_migrate sched_waking irq 只抓摆核的: sched_select_task_rq sched_select_task_rq_rt sched_force_migrate sched_migrate_task sched_queue_task 只抓调频的: sugov_ext_util sched_frequency_limits freq_qos_user_setting sched_queue_task 比如在您的脚本里这样设置: adb shell "echo 1 > /sys/kernel/tracing/events/sched/sched_blocked_reason/enable" adb shell "echo 1 > /sys/kernel/tracing/events/sched/sched_migrate_task/enable" adb shell "echo 1 > /sys/kernel/tracing/events/scheduler/sched_task_uclamp/enable" adb shell "echo 1 > /sys/kernel/tracing/events/scheduler/sugov_ext_util/enable" adb shell "echo 1 > /sys/kernel/tracing/events/sched/sched_waking/enable" adb shell "echo 1 > /sys/kernel/tracing/events/scheduler/sched_select_task_rq/enable" adb shell "echo 1 > /sys/kernel/tracing/events/scheduler/sched_find_energy_efficient_cpu/enable" adb shell "echo 1 > /sys/kernel/tracing/events/scheduler/sched_big_task_rotation/enable" adb shell "echo 1 > /sys/kernel/tracing/events/scheduler/sched_force_migrate/enable" kernel-4.14 需要打开的 sched event: sched_switch sched_wakeup sched_find_best_target sched_select_task_rq schedutil_uclamp_util sched_boost_cpu sched_boost_task cpu_frequency_limits cpu_frequency sched_hmp_migrate sched_util IRQ 需要打开的 event: /sys/kernel/tracing/events/scheduler/irq irq_handler_entry irq_handler_exit work queue 需要打开的 event: /sys/kernel/tracing/events/workqueue/ workqueue_execute_start workqueue_execute_end workqueue_queue_work workqueue_activate_work
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。