diff options
author | Ian Munsie <imunsie@au1.ibm.com> | 2010-12-09 00:33:53 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-12-21 17:17:51 -0500 |
commit | eac23d1c384b55e4bbb89ea9e5a6bb77fb4d1140 (patch) | |
tree | dbf4c419ddb9954a9879b7c6bc34f2a812402c8c | |
parent | 21ef97f05a7da5bc23b26cb34d6746f83ca9bf20 (diff) |
perf record,report,annotate,diff: Process events in order
This patch changes perf report to ask for the ID info on all events be
default if recording from multiple CPUs.
Perf report, annotate and diff will now process the events in order if
the kernel is able to provide timestamps on all events. This ensures
that events such as COMM and MMAP which are necessary to correctly
interpret samples are processed prior to those samples so that they are
attributed correctly.
Before:
# perf record ./cachetest
# perf report
# Events: 6K cycles
#
# Overhead Command Shared Object Symbol
# ........ ....... ................. ...............................
#
74.11% :3259 [unknown] [k] 0x4a6c
1.50% cachetest ld-2.11.2.so [.] 0x1777c
1.46% :3259 [kernel.kallsyms] [k] .perf_event_mmap_ctx
1.25% :3259 [kernel.kallsyms] [k] restore
0.74% :3259 [kernel.kallsyms] [k] ._raw_spin_lock
0.71% :3259 [kernel.kallsyms] [k] .filemap_fault
0.66% :3259 [kernel.kallsyms] [k] .memset
0.54% cachetest [kernel.kallsyms] [k] .sha_transform
0.54% :3259 [kernel.kallsyms] [k] .copy_4K_page
0.54% :3259 [kernel.kallsyms] [k] .find_get_page
0.52% :3259 [kernel.kallsyms] [k] .trace_hardirqs_off
0.50% :3259 [kernel.kallsyms] [k] .__do_fault
<SNIP>
After:
# perf report
# Events: 6K cycles
#
# Overhead Command Shared Object Symbol
# ........ ....... ................. ...............................
#
44.28% cachetest cachetest [.] sumArrayNaive
22.53% cachetest cachetest [.] sumArrayOptimal
6.59% cachetest ld-2.11.2.so [.] 0x1777c
2.13% cachetest [unknown] [k] 0x340
1.46% cachetest [kernel.kallsyms] [k] .perf_event_mmap_ctx
1.25% cachetest [kernel.kallsyms] [k] restore
0.74% cachetest [kernel.kallsyms] [k] ._raw_spin_lock
0.71% cachetest [kernel.kallsyms] [k] .filemap_fault
0.66% cachetest [kernel.kallsyms] [k] .memset
0.54% cachetest [kernel.kallsyms] [k] .copy_4K_page
0.54% cachetest [kernel.kallsyms] [k] .find_get_page
0.54% cachetest [kernel.kallsyms] [k] .sha_transform
0.52% cachetest [kernel.kallsyms] [k] .trace_hardirqs_off
0.50% cachetest [kernel.kallsyms] [k] .__do_fault
<SNIP>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <1291872833-839-1-git-send-email-imunsie@au1.ibm.com>
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-annotate.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-diff.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 2 |
4 files changed, 10 insertions, 1 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 48dbab4b482f..c056cdc06912 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -375,6 +375,8 @@ static struct perf_event_ops event_ops = { | |||
375 | .mmap = event__process_mmap, | 375 | .mmap = event__process_mmap, |
376 | .comm = event__process_comm, | 376 | .comm = event__process_comm, |
377 | .fork = event__process_task, | 377 | .fork = event__process_task, |
378 | .ordered_samples = true, | ||
379 | .ordering_requires_timestamps = true, | ||
378 | }; | 380 | }; |
379 | 381 | ||
380 | static int __cmd_annotate(void) | 382 | static int __cmd_annotate(void) |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index af84e1c0519d..97846dcafc63 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -61,6 +61,8 @@ static struct perf_event_ops event_ops = { | |||
61 | .exit = event__process_task, | 61 | .exit = event__process_task, |
62 | .fork = event__process_task, | 62 | .fork = event__process_task, |
63 | .lost = event__process_lost, | 63 | .lost = event__process_lost, |
64 | .ordered_samples = true, | ||
65 | .ordering_requires_timestamps = true, | ||
64 | }; | 66 | }; |
65 | 67 | ||
66 | static void perf_session__insert_hist_entry_by_name(struct rb_root *root, | 68 | static void perf_session__insert_hist_entry_by_name(struct rb_root *root, |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index efd1b3c3d4a0..5149e3deb7bc 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -285,7 +285,7 @@ static void create_counter(int counter, int cpu) | |||
285 | if (system_wide) | 285 | if (system_wide) |
286 | attr->sample_type |= PERF_SAMPLE_CPU; | 286 | attr->sample_type |= PERF_SAMPLE_CPU; |
287 | 287 | ||
288 | if (sample_time) | 288 | if (sample_time || system_wide || !no_inherit || cpu_list) |
289 | attr->sample_type |= PERF_SAMPLE_TIME; | 289 | attr->sample_type |= PERF_SAMPLE_TIME; |
290 | 290 | ||
291 | if (raw_samples) { | 291 | if (raw_samples) { |
@@ -327,6 +327,9 @@ try_again: | |||
327 | * Old kernel, no attr->sample_id_type_all field | 327 | * Old kernel, no attr->sample_id_type_all field |
328 | */ | 328 | */ |
329 | sample_id_all_avail = false; | 329 | sample_id_all_avail = false; |
330 | if (!sample_time && !raw_samples) | ||
331 | attr->sample_type &= ~PERF_SAMPLE_TIME; | ||
332 | |||
330 | goto retry_sample_id; | 333 | goto retry_sample_id; |
331 | } | 334 | } |
332 | 335 | ||
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index fd4c4500cd15..4af7ce6e1555 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -244,6 +244,8 @@ static struct perf_event_ops event_ops = { | |||
244 | .event_type = event__process_event_type, | 244 | .event_type = event__process_event_type, |
245 | .tracing_data = event__process_tracing_data, | 245 | .tracing_data = event__process_tracing_data, |
246 | .build_id = event__process_build_id, | 246 | .build_id = event__process_build_id, |
247 | .ordered_samples = true, | ||
248 | .ordering_requires_timestamps = true, | ||
247 | }; | 249 | }; |
248 | 250 | ||
249 | extern volatile int session_done; | 251 | extern volatile int session_done; |