Jin Yao
3fa7ae3f37
perf report: Fix wrong LBR block sorting
...
[ Upstream commit f2013278ae40b89cc27916366c407ce5261815ef ]
When '--total-cycles' is specified, it supports sorting for all blocks
by 'Sampled Cycles%'. This is useful to concentrate on the globally
hottest blocks.
'Sampled Cycles%' - block sampled cycles aggregation / total sampled cycles
But in current code, it doesn't use the cycles aggregation. Part of
'cycles' counting is possibly dropped for some overlap jumps. But for
identifying the hot block, we always need the full cycles.
# perf record -b ./triad_loop
# perf report --total-cycles --stdio
Before:
#
# Sampled Cycles% Sampled Cycles Avg Cycles% Avg Cycles [Program Block Range] Shared Object
# ............... .............. ........... .......... ............................................................. .................
#
0.81% 793 4.32% 793 [setup-vdso.h:34 -> setup-vdso.h:40] ld-2.27.so
0.49% 480 0.87% 160 [native_write_msr+0 -> native_write_msr+16] [kernel.kallsyms]
0.48% 476 0.52% 95 [native_read_msr+0 -> native_read_msr+29] [kernel.kallsyms]
0.31% 303 1.65% 303 [nmi_restore+0 -> nmi_restore+37] [kernel.kallsyms]
0.26% 255 1.39% 255 [nohz_balance_exit_idle+75 -> nohz_balance_exit_idle+162] [kernel.kallsyms]
0.24% 234 1.28% 234 [end_repeat_nmi+67 -> end_repeat_nmi+83] [kernel.kallsyms]
0.23% 227 1.24% 227 [__irqentry_text_end+96 -> __irqentry_text_end+126] [kernel.kallsyms]
0.20% 194 1.06% 194 [native_set_debugreg+52 -> native_set_debugreg+56] [kernel.kallsyms]
0.11% 106 0.14% 26 [native_sched_clock+0 -> native_sched_clock+98] [kernel.kallsyms]
0.10% 97 0.53% 97 [trigger_load_balance+0 -> trigger_load_balance+67] [kernel.kallsyms]
0.09% 85 0.46% 85 [get-dynamic-info.h:102 -> get-dynamic-info.h:111] ld-2.27.so
...
0.00% 92.7K 0.02% 4 [triad_loop.c:64 -> triad_loop.c:65] triad_loop
The hottest block '[triad_loop.c:64 -> triad_loop.c:65]' is not at
the top of output.
After:
# Sampled Cycles% Sampled Cycles Avg Cycles% Avg Cycles [Program Block Range] Shared Object
# ............... .............. ........... .......... .............................................................. .................
#
94.35% 92.7K 0.02% 4 [triad_loop.c:64 -> triad_loop.c:65] triad_loop
0.81% 793 4.32% 793 [setup-vdso.h:34 -> setup-vdso.h:40] ld-2.27.so
0.49% 480 0.87% 160 [native_write_msr+0 -> native_write_msr+16] [kernel.kallsyms]
0.48% 476 0.52% 95 [native_read_msr+0 -> native_read_msr+29] [kernel.kallsyms]
0.31% 303 1.65% 303 [nmi_restore+0 -> nmi_restore+37] [kernel.kallsyms]
0.26% 255 1.39% 255 [nohz_balance_exit_idle+75 -> nohz_balance_exit_idle+162] [kernel.kallsyms]
0.24% 234 1.28% 234 [end_repeat_nmi+67 -> end_repeat_nmi+83] [kernel.kallsyms]
0.23% 227 1.24% 227 [__irqentry_text_end+96 -> __irqentry_text_end+126] [kernel.kallsyms]
0.20% 194 1.06% 194 [native_set_debugreg+52 -> native_set_debugreg+56] [kernel.kallsyms]
0.11% 106 0.14% 26 [native_sched_clock+0 -> native_sched_clock+98] [kernel.kallsyms]
0.10% 97 0.53% 97 [trigger_load_balance+0 -> trigger_load_balance+67] [kernel.kallsyms]
0.09% 85 0.46% 85 [get-dynamic-info.h:102 -> get-dynamic-info.h:111] ld-2.27.so
0.08% 82 0.06% 11 [intel_pmu_drain_pebs_nhm+580 -> intel_pmu_drain_pebs_nhm+627] [kernel.kallsyms]
0.08% 77 0.42% 77 [lru_add_drain_cpu+0 -> lru_add_drain_cpu+133] [kernel.kallsyms]
0.08% 74 0.10% 18 [handle_pmi_common+271 -> handle_pmi_common+310] [kernel.kallsyms]
0.08% 74 0.40% 74 [get-dynamic-info.h:131 -> get-dynamic-info.h:157] ld-2.27.so
0.07% 69 0.09% 17 [intel_pmu_drain_pebs_nhm+432 -> intel_pmu_drain_pebs_nhm+468] [kernel.kallsyms]
Now the hottest block is reported at the top of output.
Fixes: b65a7d372b1a55db ("perf hist: Support block formats with compare/sort/display")
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210407024452.29988-1-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-04-14 08:42:11 +02:00
..
2020-08-21 10:22:23 -03:00
2020-01-14 12:02:19 -03:00
2020-05-05 16:35:32 -03:00
2020-11-12 17:55:41 -03:00
2021-03-04 11:38:09 +01:00
2019-09-20 09:19:20 -03:00
2020-11-03 08:32:43 -03:00
2019-11-28 08:08:38 -03:00
2019-11-28 08:08:38 -03:00
2020-10-14 08:46:22 -03:00
2020-05-28 10:03:27 -03:00
2019-03-11 11:56:02 -03:00
2020-06-01 12:24:23 -03:00
2021-03-30 14:32:06 +02:00
2020-08-06 08:24:03 -03:00
2021-04-14 08:42:11 +02:00
2020-03-09 21:43:25 -03:00
2019-01-25 15:12:09 +01:00
2019-01-25 15:12:09 +01:00
2019-02-19 16:11:56 -03:00
2019-02-19 16:11:56 -03:00
2020-05-05 16:35:29 -03:00
2020-05-05 16:35:29 -03:00
2020-09-09 11:28:28 -07:00
2019-07-29 18:34:42 -03:00
2020-06-09 12:40:04 -03:00
2019-09-20 09:19:20 -03:00
2020-05-28 10:03:27 -03:00
2020-10-14 13:27:28 -03:00
2020-11-03 09:14:45 -03:00
2020-10-14 08:46:22 -03:00
2019-08-29 17:38:32 -03:00
2019-08-26 11:58:29 -03:00
2019-07-09 10:13:27 -03:00
2019-06-05 17:36:37 +02:00
2020-10-14 13:34:26 -03:00
2020-10-14 13:34:26 -03:00
2019-08-14 10:48:39 -03:00
2020-04-16 12:19:08 -03:00
2020-09-28 09:18:06 -03:00
2020-09-28 09:18:06 -03:00
2020-08-06 09:33:57 -03:00
2020-08-06 09:33:57 -03:00
2020-05-28 10:03:26 -03:00
2019-08-31 22:24:10 -03:00
2019-08-31 22:24:10 -03:00
2019-01-25 15:12:08 +01:00
2019-07-09 10:13:26 -03:00
2019-01-25 15:12:09 +01:00
2019-05-15 16:36:49 -03:00
2020-10-13 17:03:19 -03:00
2020-10-13 17:03:19 -03:00
2019-10-15 12:05:18 -03:00
2019-09-25 09:51:49 -03:00
2020-05-28 10:03:27 -03:00
2020-05-28 10:03:27 -03:00
2019-02-06 10:00:39 -03:00
2020-03-24 10:36:00 -03:00
2019-11-29 12:20:45 -03:00
2019-08-22 17:16:57 -03:00
2020-05-28 10:03:27 -03:00
2020-09-01 12:15:52 -03:00
2020-05-05 16:35:32 -03:00
2020-08-06 09:43:37 -03:00
2020-08-06 09:43:37 -03:00
2019-11-06 15:43:05 -03:00
2019-11-06 15:43:05 -03:00
2019-11-26 11:07:46 -03:00
2019-07-29 18:34:42 -03:00
2020-08-14 09:15:47 -03:00
2019-11-12 08:32:27 -03:00
2020-05-28 10:03:28 -03:00
2019-09-20 09:19:20 -03:00
2020-10-14 11:28:52 -03:00
2020-10-14 11:28:52 -03:00
2020-10-14 11:28:52 -03:00
2019-11-19 19:12:26 -03:00
2018-12-28 16:33:02 -03:00
2018-12-28 16:33:02 -03:00
2020-11-27 14:36:15 -03:00
2019-11-06 15:43:06 -03:00
2019-09-20 09:19:20 -03:00
2020-04-03 09:37:55 -03:00
2020-08-06 09:42:20 -03:00
2021-03-04 11:38:03 +01:00
2020-07-10 08:39:14 -03:00
2019-08-31 22:24:10 -03:00
2021-03-04 11:38:09 +01:00
2021-03-04 11:38:09 +01:00
2020-05-28 10:03:24 -03:00
2020-05-28 10:03:24 -03:00
2020-05-28 10:03:24 -03:00
2020-09-28 08:55:48 -03:00
2020-09-28 08:55:48 -03:00
2019-08-15 12:26:13 -03:00
2019-08-15 12:25:55 -03:00
2020-07-30 07:01:49 -03:00
2020-07-30 07:01:49 -03:00
2020-06-22 16:28:09 -03:00
2020-07-30 07:01:49 -03:00
2019-01-08 13:28:13 -03:00
2019-11-28 08:08:38 -03:00
2019-11-28 08:08:38 -03:00
2020-05-29 16:51:38 -03:00
2019-11-29 12:20:45 -03:00
2019-09-25 16:26:41 -03:00
2019-08-26 11:58:29 -03:00
2019-07-09 10:13:26 -03:00
2020-11-03 08:26:55 -03:00
2020-11-27 14:19:33 -03:00
2020-10-14 11:28:12 -03:00
2020-08-06 09:35:06 -03:00
2019-07-09 10:13:26 -03:00
2020-05-28 10:03:24 -03:00
2020-05-28 10:03:24 -03:00
2020-05-05 16:35:30 -03:00
2019-06-05 17:36:37 +02:00
2021-03-04 11:38:09 +01:00
2019-06-05 17:36:37 +02:00
2019-06-05 17:37:04 +02:00
2019-01-25 15:12:10 +01:00
2020-09-22 13:46:40 -03:00
2020-05-28 10:03:27 -03:00
2019-09-20 10:28:26 -03:00
2020-03-04 10:34:10 -03:00
2019-08-29 17:38:32 -03:00
2019-09-20 09:19:20 -03:00
2021-01-19 18:27:29 +01:00
2020-09-17 15:47:12 -03:00
2019-11-26 11:07:46 -03:00
2020-10-14 08:46:22 -03:00
2020-10-13 11:01:37 -03:00
2019-11-26 11:07:46 -03:00
2020-05-05 16:35:30 -03:00
2019-08-31 19:10:40 -03:00
2020-05-28 10:03:25 -03:00
2020-05-28 10:03:25 -03:00
2019-09-20 09:19:22 -03:00
2020-10-13 13:02:20 -03:00
2020-09-28 09:16:21 -03:00
2020-03-12 11:32:46 -03:00
2020-01-06 11:46:09 -03:00
2019-09-20 10:28:21 -03:00
2019-09-20 10:28:21 -03:00
2020-04-30 10:48:32 -03:00
2020-05-28 10:03:27 -03:00
2019-08-31 19:10:19 -03:00
2020-10-14 12:24:28 -03:00
2020-09-28 09:22:39 -03:00
2020-10-14 12:24:28 -03:00
2020-09-28 09:22:39 -03:00
2020-12-30 11:53:59 +01:00
2019-05-15 16:36:49 -03:00
2020-08-14 09:15:47 -03:00
2020-08-14 09:15:47 -03:00
2019-08-31 22:24:10 -03:00
2019-08-31 22:24:10 -03:00
2020-07-10 08:20:01 -03:00
2020-07-10 08:20:01 -03:00
2020-07-10 08:20:01 -03:00
2019-10-10 09:29:33 -03:00
2019-11-28 08:08:38 -03:00
2019-09-20 09:19:20 -03:00
2019-05-28 18:37:44 -03:00
2020-05-29 16:51:38 -03:00
2020-05-29 16:51:38 -03:00
2020-09-15 09:22:42 -03:00
2020-09-15 09:22:42 -03:00
2020-10-01 12:10:56 -03:00
2020-10-14 08:46:22 -03:00
2019-11-18 19:09:23 -03:00
2020-12-30 11:54:02 +01:00
2019-11-18 19:08:02 -03:00
2020-11-27 14:36:15 -03:00
2020-09-18 09:20:47 -03:00
2020-05-28 10:03:27 -03:00
2020-04-03 09:37:55 -03:00
2020-09-28 09:16:21 -03:00
2019-01-25 15:12:10 +01:00
2019-06-05 17:37:04 +02:00
2019-01-25 15:12:10 +01:00
2020-09-17 15:47:58 -03:00
2020-09-04 14:38:15 -03:00
2019-07-09 14:59:11 -03:00
2019-07-09 14:59:11 -03:00
2019-09-20 09:19:20 -03:00
2020-04-16 12:19:15 -03:00
2018-08-08 15:26:48 -03:00
2020-05-05 16:35:29 -03:00
2018-08-03 10:34:18 -03:00
2019-09-20 09:19:20 -03:00
2019-07-29 18:34:42 -03:00
2019-07-29 18:34:42 -03:00
2021-01-19 18:27:29 +01:00
2019-11-22 10:48:13 -03:00
2019-07-09 10:13:26 -03:00
2020-04-14 08:43:18 -03:00
2020-05-28 10:03:24 -03:00
2020-05-05 16:35:29 -03:00
2021-03-17 17:06:17 +01:00
2020-04-18 09:05:01 -03:00
2019-10-11 10:57:00 -03:00
2019-10-11 10:57:00 -03:00
2019-11-28 08:08:38 -03:00
2019-02-06 10:00:38 -03:00
2020-01-30 11:55:26 +01:00
2019-01-25 15:12:09 +01:00
2020-11-27 14:31:37 -03:00
2020-09-17 15:48:08 -03:00
2020-09-17 15:48:08 -03:00
2020-09-28 09:07:08 -03:00
2019-08-31 19:10:19 -03:00
2020-10-14 13:34:26 -03:00
2020-10-14 13:34:26 -03:00
2019-07-09 10:13:26 -03:00
2019-10-15 13:03:57 -03:00
2019-07-01 22:50:40 -03:00
2019-07-09 10:13:26 -03:00
2019-01-25 15:12:10 +01:00
2019-09-20 09:19:21 -03:00
2019-08-29 17:38:31 -03:00
2020-03-24 09:37:27 -03:00
2019-08-31 22:24:05 -03:00
2020-10-14 09:25:36 -03:00
2020-10-14 08:46:42 -03:00
2021-03-04 11:38:07 +01:00
2020-11-03 08:30:34 -03:00
2019-08-31 22:24:05 -03:00
2021-03-30 14:32:06 +02:00
2020-04-03 09:37:55 -03:00
2020-05-29 16:50:29 -03:00
2020-05-29 16:50:26 -03:00
2019-09-20 09:19:20 -03:00
2019-08-29 08:36:12 -03:00
2019-08-29 08:36:12 -03:00
2020-05-05 16:35:29 -03:00
2020-05-05 16:35:29 -03:00
2020-04-18 09:05:01 -03:00
2020-04-18 09:05:01 -03:00
2019-10-15 08:36:22 -03:00
2019-10-15 08:36:22 -03:00
2020-07-10 08:20:01 -03:00
2020-05-05 16:35:30 -03:00
2020-05-05 16:35:29 -03:00
2020-09-17 15:47:58 -03:00
2020-09-17 15:47:58 -03:00
2020-05-28 10:03:27 -03:00
2019-11-05 08:39:27 -03:00
2021-03-17 17:06:17 +01:00
2019-08-29 17:38:32 -03:00
2019-09-20 09:19:20 -03:00
2019-11-05 08:39:27 -03:00
2019-08-29 17:38:32 -03:00
2020-09-22 13:46:40 -03:00
2020-09-22 13:45:21 -03:00
2019-11-26 11:07:46 -03:00
2020-05-28 10:03:27 -03:00
2019-11-26 11:07:46 -03:00
2019-11-26 11:07:46 -03:00
2019-09-20 09:19:20 -03:00
2020-04-16 12:19:08 -03:00
2020-09-10 11:55:37 -03:00
2019-08-31 19:10:19 -03:00
2019-11-26 11:07:46 -03:00
2019-07-09 10:13:26 -03:00
2019-09-20 09:19:20 -03:00
2020-09-01 12:15:21 -03:00