如何分析perf sched记录的perf.data

时间:2017-02-03 06:52:27

标签: linux-kernel scheduler perf

我使用以下方法收集了一些性能数据:

perf sched record –g

我需要分析这个命令生成的perf.data。

我正在使用以下命令进行分析:

perf report 

我看到多个sched事件:

62K sched:sched_switch                                                                                                  ▒
0 sched:sched_stat_wait                                                                                                 ▒
0 sched:sched_stat_sleep                                                                                                ▒
0 sched:sched_stat_iowait                                                                                               ▒
120K sched:sched_stat_runtime                                                                                           ▒
10 sched:sched_process_fork                                                                                             ▒
31K sched:sched_wakeup                                                                                                  ▒
10 sched:sched_wakeup_new                                                                                               ▒
873 sched:sched_migrate_task    

在我打开其中一个事件后,我看到了类似的内容:

+   80.00%     0.00%  ksmtuned  bash               [.] make_child
+   80.00%     0.00%  ksmtuned  libc-2.17.so       [.] __libc_fork
+   80.00%     0.00%  ksmtuned  [kernel.kallsyms]  [k] stub_clone
+   80.00%     0.00%  ksmtuned  [kernel.kallsyms]  [k] sys_clone
+   80.00%    80.00%  ksmtuned  [kernel.kallsyms]  [k] do_fork
+   10.00%     0.00%      bash  bash               [.] make_child

我无法解释此信息。 以下是我的问题:

1)显示%值的前两列是什么? 2)为什么%值加起来不是100%? 3)这些数字有什么意义?

1 个答案:

答案 0 :(得分:1)

perf sched record是perf的特殊变体,我认为使用perf sched子命令分析生成的perf.data文件更为正确。

perf sched上有手册页:http://man7.org/linux/man-pages/man1/perf-sched.1.html

       'perf sched record <command>' to record the scheduling events
       of an arbitrary workload.

       'perf sched latency' to report the per task scheduling latencies
       and other scheduling properties of the workload.

       'perf sched script' to see a detailed trace of the workload that
        was recorded...

       'perf sched replay' to simulate the workload that was recorded
       via perf sched record. (this is done by starting up mockup threads
       that mimic the workload based on the events in the trace. These
       threads can then replay the timings (CPU runtime and sleep patterns)
       of the workload as it occurred when it was recorded - and can repeat
       it a number of times, measuring its performance.)

       'perf sched map' to print a textual context-switching outline of
       workload captured via perf sched record.  Columns stand for
       individual CPUs, and the two-letter shortcuts stand for tasks that
       are running on a CPU. A '*' denotes the CPU that had the event, and
       a dot signals an idle CPU.

还有来自2009年的信函描述了perf sched功能:https://lwn.net/Articles/353295/“[宣布]'perf sched':捕获,测量和分析调度程序延迟和行为的实用程序”以及{的推荐用法{1}}结果为perf sched record而非perf sched latency

  

...实用程序的实验版本   试图实现这个雄心勃勃的目标:新的'perf sched'家族   使用性能事件来客观地表征任意的工具   从调度和延迟的角度来看工作负载。

     

'perf sched'目前有五个子命令:

perf report
     

桌面用户通常会使用'perf sched record'来捕获跟踪   (创建perf.data)和'perf sched latency'工具进行检查   延迟(分析perf.data中的跟踪)。其他工具也是   使用已记录的perf.data。