当前位置:   article > 正文

用systrace方式抓取DDR频率、GPU频率、free memory、FPSGO和sched等信息_ddrfia.dqqbp.top

ddrfia.dqqbp.top

描述 通常Systrace默认都会抓取CPU频率信息,但没有DDR/GPU频率/sched信息,而有时候需要常去看看DDR/GPU频率/FPSGO/sched等信息

解决办法

1、DDR频率
参考代码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
               ),
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

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数据可能不准,部分平台没有实现。
  • 1
  • 2
  • 3

需要打开的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"
  • 1
  • 2
  • 3
  • 4
  • 5

2 如果要在Systrace中记录当前可用的memory量,可用打开:

 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
  • 1
  • 2
  • 3
  • 4
  • 5

3 如果要在Systrace中记录FPSGO信息,请打开:

 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”
  • 1
  • 2
  • 3
  • 4

4 如果要在Systrace中记录GPU的频率,可以打开:

  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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

5 以上trce需要root权限,并且抓这样的Systrace可能部分信息无法在chrome浏览器上显示出来,需要通过文本文件方式打开搜相关log查看。

6 CPU频率通常都有,在chrome浏览器上可以直接显示出来

   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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

7 systrace抓取 sched信息,需要打开以下trace event:

       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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/330476?site
推荐阅读
相关标签
  

闽ICP备14008679号