diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2010-05-02 16:05:29 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-05-09 07:43:42 -0400 |
commit | 984028075794c00cbf4fb1e94bb6233e8be08875 (patch) | |
tree | 80c925f948cce8132dde8ec9307854365d363aff | |
parent | e157eb8341e7885ff2d9f1620155e3da6e0c8f56 (diff) |
perf: Introduce a new "round of buffers read" pseudo event
In order to provide a more rubust and deterministic reordering
algorithm, we need to know when we reach a point where we just
did a pass through over every counter buffers to read every thing
they had.
This patch introduces a new PERF_RECORD_FINISHED_ROUND pseudo event
that only consist in an event header and doesn't need to contain
anything.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
-rw-r--r-- | tools/perf/builtin-record.c | 34 | ||||
-rw-r--r-- | tools/perf/util/event.h | 3 |
2 files changed, 26 insertions, 11 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index d3981ac50e1d..6b77b285fe10 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -494,6 +494,29 @@ static void event__synthesize_guest_os(struct machine *machine, void *data) | |||
494 | " relocation symbol.\n", machine->pid); | 494 | " relocation symbol.\n", machine->pid); |
495 | } | 495 | } |
496 | 496 | ||
497 | static struct perf_event_header finished_round_event = { | ||
498 | .size = sizeof(struct perf_event_header), | ||
499 | .type = PERF_RECORD_FINISHED_ROUND, | ||
500 | }; | ||
501 | |||
502 | static void mmap_read_all(void) | ||
503 | { | ||
504 | int i, counter, thread; | ||
505 | |||
506 | for (i = 0; i < nr_cpu; i++) { | ||
507 | for (counter = 0; counter < nr_counters; counter++) { | ||
508 | for (thread = 0; thread < thread_num; thread++) { | ||
509 | if (mmap_array[i][counter][thread].base) | ||
510 | mmap_read(&mmap_array[i][counter][thread]); | ||
511 | } | ||
512 | |||
513 | } | ||
514 | } | ||
515 | |||
516 | if (perf_header__has_feat(&session->header, HEADER_TRACE_INFO)) | ||
517 | write_output(&finished_round_event, sizeof(finished_round_event)); | ||
518 | } | ||
519 | |||
497 | static int __cmd_record(int argc, const char **argv) | 520 | static int __cmd_record(int argc, const char **argv) |
498 | { | 521 | { |
499 | int i, counter; | 522 | int i, counter; |
@@ -726,16 +749,7 @@ static int __cmd_record(int argc, const char **argv) | |||
726 | int hits = samples; | 749 | int hits = samples; |
727 | int thread; | 750 | int thread; |
728 | 751 | ||
729 | for (i = 0; i < nr_cpu; i++) { | 752 | mmap_read_all(); |
730 | for (counter = 0; counter < nr_counters; counter++) { | ||
731 | for (thread = 0; | ||
732 | thread < thread_num; thread++) { | ||
733 | if (mmap_array[i][counter][thread].base) | ||
734 | mmap_read(&mmap_array[i][counter][thread]); | ||
735 | } | ||
736 | |||
737 | } | ||
738 | } | ||
739 | 753 | ||
740 | if (hits == samples) { | 754 | if (hits == samples) { |
741 | if (done) | 755 | if (done) |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index b364da5b0cbf..6cc1b1dced55 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -84,11 +84,12 @@ struct build_id_event { | |||
84 | char filename[]; | 84 | char filename[]; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | enum perf_header_event_type { /* above any possible kernel type */ | 87 | enum perf_user_event_type { /* above any possible kernel type */ |
88 | PERF_RECORD_HEADER_ATTR = 64, | 88 | PERF_RECORD_HEADER_ATTR = 64, |
89 | PERF_RECORD_HEADER_EVENT_TYPE = 65, | 89 | PERF_RECORD_HEADER_EVENT_TYPE = 65, |
90 | PERF_RECORD_HEADER_TRACING_DATA = 66, | 90 | PERF_RECORD_HEADER_TRACING_DATA = 66, |
91 | PERF_RECORD_HEADER_BUILD_ID = 67, | 91 | PERF_RECORD_HEADER_BUILD_ID = 67, |
92 | PERF_RECORD_FINISHED_ROUND = 68, | ||
92 | PERF_RECORD_HEADER_MAX | 93 | PERF_RECORD_HEADER_MAX |
93 | }; | 94 | }; |
94 | 95 | ||