diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-29 10:15:04 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-11-02 10:27:23 -0400 |
commit | 7b27509fc62686c53e9301560034e6b0b001174d (patch) | |
tree | 7b4fc36012d76d5319537df73fd5f7f50104b137 /tools/perf/util/session.c | |
parent | 1ca4ff41a3d887b8211e4a6c6c89c8f153d6bfa0 (diff) |
perf hists browser: Warn about lost events
Just like the old perf top --tui and the --stdio version.
But because we have the initial menu to choose which event to show in a
session with multiple events we can see how many chunks were lost in
each of the event types, clarifying which events are being affected the
most.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-47yyqbubmjzch2chezmb21m6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r-- | tools/perf/util/session.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 91c6442ef966..da354fe5e085 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -738,10 +738,27 @@ static int perf_session_deliver_event(struct perf_session *session, | |||
738 | 738 | ||
739 | dump_event(session, event, file_offset, sample); | 739 | dump_event(session, event, file_offset, sample); |
740 | 740 | ||
741 | evsel = perf_evlist__id2evsel(session->evlist, sample->id); | ||
742 | if (evsel != NULL && event->header.type != PERF_RECORD_SAMPLE) { | ||
743 | /* | ||
744 | * XXX We're leaving PERF_RECORD_SAMPLE unnacounted here | ||
745 | * because the tools right now may apply filters, discarding | ||
746 | * some of the samples. For consistency, in the future we | ||
747 | * should have something like nr_filtered_samples and remove | ||
748 | * the sample->period from total_sample_period, etc, KISS for | ||
749 | * now tho. | ||
750 | * | ||
751 | * Also testing against NULL allows us to handle files without | ||
752 | * attr.sample_id_all and/or without PERF_SAMPLE_ID. In the | ||
753 | * future probably it'll be a good idea to restrict event | ||
754 | * processing via perf_session to files with both set. | ||
755 | */ | ||
756 | hists__inc_nr_events(&evsel->hists, event->header.type); | ||
757 | } | ||
758 | |||
741 | switch (event->header.type) { | 759 | switch (event->header.type) { |
742 | case PERF_RECORD_SAMPLE: | 760 | case PERF_RECORD_SAMPLE: |
743 | dump_sample(session, event, sample); | 761 | dump_sample(session, event, sample); |
744 | evsel = perf_evlist__id2evsel(session->evlist, sample->id); | ||
745 | if (evsel == NULL) { | 762 | if (evsel == NULL) { |
746 | ++session->hists.stats.nr_unknown_id; | 763 | ++session->hists.stats.nr_unknown_id; |
747 | return -1; | 764 | return -1; |
@@ -874,11 +891,11 @@ static void perf_session__warn_about_errors(const struct perf_session *session, | |||
874 | const struct perf_event_ops *ops) | 891 | const struct perf_event_ops *ops) |
875 | { | 892 | { |
876 | if (ops->lost == perf_event__process_lost && | 893 | if (ops->lost == perf_event__process_lost && |
877 | session->hists.stats.total_lost != 0) { | 894 | session->hists.stats.nr_events[PERF_RECORD_LOST] != 0) { |
878 | ui__warning("Processed %" PRIu64 " events and LOST %" PRIu64 | 895 | ui__warning("Processed %d events and lost %d chunks!\n\n" |
879 | "!\n\nCheck IO/CPU overload!\n\n", | 896 | "Check IO/CPU overload!\n\n", |
880 | session->hists.stats.total_period, | 897 | session->hists.stats.nr_events[0], |
881 | session->hists.stats.total_lost); | 898 | session->hists.stats.nr_events[PERF_RECORD_LOST]); |
882 | } | 899 | } |
883 | 900 | ||
884 | if (session->hists.stats.nr_unknown_events != 0) { | 901 | if (session->hists.stats.nr_unknown_events != 0) { |