diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-02-14 12:50:11 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-02-22 20:22:57 -0500 |
commit | 75be989a7a18e9666efd92b846ee48bed79e8086 (patch) | |
tree | f6dc6fddcf89646e7071233256ba88596d0f492b /tools | |
parent | 54245fdc357613633954bfd38cffb71cb9def067 (diff) |
perf evlist: Adopt events_stats from perf_session
For tools that don't deal with perf.data files, thus do not need to
use perf_session.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-kglq67gvauq9tak02a4se00r@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-sched.c | 6 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 4 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 1 | ||||
-rw-r--r-- | tools/perf/util/session.c | 54 | ||||
-rw-r--r-- | tools/perf/util/session.h | 1 |
5 files changed, 33 insertions, 33 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 891c3930080e..7ce296618717 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1473,9 +1473,9 @@ static int perf_sched__read_events(struct perf_sched *sched, | |||
1473 | goto out_delete; | 1473 | goto out_delete; |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | sched->nr_events = session->stats.nr_events[0]; | 1476 | sched->nr_events = session->evlist->stats.nr_events[0]; |
1477 | sched->nr_lost_events = session->stats.total_lost; | 1477 | sched->nr_lost_events = session->evlist->stats.total_lost; |
1478 | sched->nr_lost_chunks = session->stats.nr_events[PERF_RECORD_LOST]; | 1478 | sched->nr_lost_chunks = session->evlist->stats.nr_events[PERF_RECORD_LOST]; |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | if (psession) | 1481 | if (psession) |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index c4c7eac69de4..5fb8723c7128 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -716,7 +716,7 @@ static void perf_event__process_sample(struct perf_tool *tool, | |||
716 | 716 | ||
717 | if (!machine) { | 717 | if (!machine) { |
718 | pr_err("%u unprocessable samples recorded.\r", | 718 | pr_err("%u unprocessable samples recorded.\r", |
719 | top->session->stats.nr_unprocessable_samples++); | 719 | top->session->evlist->stats.nr_unprocessable_samples++); |
720 | return; | 720 | return; |
721 | } | 721 | } |
722 | 722 | ||
@@ -856,7 +856,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
856 | hists__inc_nr_events(evsel__hists(evsel), event->header.type); | 856 | hists__inc_nr_events(evsel__hists(evsel), event->header.type); |
857 | machine__process_event(machine, event, &sample); | 857 | machine__process_event(machine, event, &sample); |
858 | } else | 858 | } else |
859 | ++session->stats.nr_unknown_events; | 859 | ++session->evlist->stats.nr_unknown_events; |
860 | next_event: | 860 | next_event: |
861 | perf_evlist__mmap_consume(top->evlist, idx); | 861 | perf_evlist__mmap_consume(top->evlist, idx); |
862 | } | 862 | } |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index c19ff45c9ad5..d4768a30f884 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -51,6 +51,7 @@ struct perf_evlist { | |||
51 | struct thread_map *threads; | 51 | struct thread_map *threads; |
52 | struct cpu_map *cpus; | 52 | struct cpu_map *cpus; |
53 | struct perf_evsel *selected; | 53 | struct perf_evsel *selected; |
54 | struct events_stats stats; | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | struct perf_evsel_str_handler { | 57 | struct perf_evsel_str_handler { |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index fac08e1f6330..06ef1c35a65a 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -537,7 +537,7 @@ int perf_session_queue_event(struct perf_session *s, union perf_event *event, | |||
537 | pr_oe_time(oe->last_flush, "last flush, last_flush_type %d\n", | 537 | pr_oe_time(oe->last_flush, "last flush, last_flush_type %d\n", |
538 | oe->last_flush_type); | 538 | oe->last_flush_type); |
539 | 539 | ||
540 | s->stats.nr_unordered_events++; | 540 | s->evlist->stats.nr_unordered_events++; |
541 | } | 541 | } |
542 | 542 | ||
543 | new = ordered_events__new(oe, timestamp, event); | 543 | new = ordered_events__new(oe, timestamp, event); |
@@ -841,7 +841,7 @@ static int deliver_sample_value(struct perf_session *session, | |||
841 | } | 841 | } |
842 | 842 | ||
843 | if (!sid || sid->evsel == NULL) { | 843 | if (!sid || sid->evsel == NULL) { |
844 | ++session->stats.nr_unknown_id; | 844 | ++session->evlist->stats.nr_unknown_id; |
845 | return 0; | 845 | return 0; |
846 | } | 846 | } |
847 | 847 | ||
@@ -911,11 +911,11 @@ int perf_session__deliver_event(struct perf_session *session, | |||
911 | case PERF_RECORD_SAMPLE: | 911 | case PERF_RECORD_SAMPLE: |
912 | dump_sample(evsel, event, sample); | 912 | dump_sample(evsel, event, sample); |
913 | if (evsel == NULL) { | 913 | if (evsel == NULL) { |
914 | ++session->stats.nr_unknown_id; | 914 | ++session->evlist->stats.nr_unknown_id; |
915 | return 0; | 915 | return 0; |
916 | } | 916 | } |
917 | if (machine == NULL) { | 917 | if (machine == NULL) { |
918 | ++session->stats.nr_unprocessable_samples; | 918 | ++session->evlist->stats.nr_unprocessable_samples; |
919 | return 0; | 919 | return 0; |
920 | } | 920 | } |
921 | return perf_session__deliver_sample(session, tool, event, | 921 | return perf_session__deliver_sample(session, tool, event, |
@@ -932,7 +932,7 @@ int perf_session__deliver_event(struct perf_session *session, | |||
932 | return tool->exit(tool, event, sample, machine); | 932 | return tool->exit(tool, event, sample, machine); |
933 | case PERF_RECORD_LOST: | 933 | case PERF_RECORD_LOST: |
934 | if (tool->lost == perf_event__process_lost) | 934 | if (tool->lost == perf_event__process_lost) |
935 | session->stats.total_lost += event->lost.lost; | 935 | session->evlist->stats.total_lost += event->lost.lost; |
936 | return tool->lost(tool, event, sample, machine); | 936 | return tool->lost(tool, event, sample, machine); |
937 | case PERF_RECORD_READ: | 937 | case PERF_RECORD_READ: |
938 | return tool->read(tool, event, sample, evsel, machine); | 938 | return tool->read(tool, event, sample, evsel, machine); |
@@ -941,7 +941,7 @@ int perf_session__deliver_event(struct perf_session *session, | |||
941 | case PERF_RECORD_UNTHROTTLE: | 941 | case PERF_RECORD_UNTHROTTLE: |
942 | return tool->unthrottle(tool, event, sample, machine); | 942 | return tool->unthrottle(tool, event, sample, machine); |
943 | default: | 943 | default: |
944 | ++session->stats.nr_unknown_events; | 944 | ++session->evlist->stats.nr_unknown_events; |
945 | return -1; | 945 | return -1; |
946 | } | 946 | } |
947 | } | 947 | } |
@@ -991,7 +991,7 @@ int perf_session__deliver_synth_event(struct perf_session *session, | |||
991 | struct perf_sample *sample, | 991 | struct perf_sample *sample, |
992 | struct perf_tool *tool) | 992 | struct perf_tool *tool) |
993 | { | 993 | { |
994 | events_stats__inc(&session->stats, event->header.type); | 994 | events_stats__inc(&session->evlist->stats, event->header.type); |
995 | 995 | ||
996 | if (event->header.type >= PERF_RECORD_USER_TYPE_START) | 996 | if (event->header.type >= PERF_RECORD_USER_TYPE_START) |
997 | return perf_session__process_user_event(session, event, tool, 0); | 997 | return perf_session__process_user_event(session, event, tool, 0); |
@@ -1077,7 +1077,7 @@ static s64 perf_session__process_event(struct perf_session *session, | |||
1077 | if (event->header.type >= PERF_RECORD_HEADER_MAX) | 1077 | if (event->header.type >= PERF_RECORD_HEADER_MAX) |
1078 | return -EINVAL; | 1078 | return -EINVAL; |
1079 | 1079 | ||
1080 | events_stats__inc(&session->stats, event->header.type); | 1080 | events_stats__inc(&session->evlist->stats, event->header.type); |
1081 | 1081 | ||
1082 | if (event->header.type >= PERF_RECORD_USER_TYPE_START) | 1082 | if (event->header.type >= PERF_RECORD_USER_TYPE_START) |
1083 | return perf_session__process_user_event(session, event, tool, file_offset); | 1083 | return perf_session__process_user_event(session, event, tool, file_offset); |
@@ -1129,43 +1129,43 @@ static void perf_session__warn_about_errors(const struct perf_session *session, | |||
1129 | const struct perf_tool *tool) | 1129 | const struct perf_tool *tool) |
1130 | { | 1130 | { |
1131 | if (tool->lost == perf_event__process_lost && | 1131 | if (tool->lost == perf_event__process_lost && |
1132 | session->stats.nr_events[PERF_RECORD_LOST] != 0) { | 1132 | session->evlist->stats.nr_events[PERF_RECORD_LOST] != 0) { |
1133 | ui__warning("Processed %d events and lost %d chunks!\n\n" | 1133 | ui__warning("Processed %d events and lost %d chunks!\n\n" |
1134 | "Check IO/CPU overload!\n\n", | 1134 | "Check IO/CPU overload!\n\n", |
1135 | session->stats.nr_events[0], | 1135 | session->evlist->stats.nr_events[0], |
1136 | session->stats.nr_events[PERF_RECORD_LOST]); | 1136 | session->evlist->stats.nr_events[PERF_RECORD_LOST]); |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | if (session->stats.nr_unknown_events != 0) { | 1139 | if (session->evlist->stats.nr_unknown_events != 0) { |
1140 | ui__warning("Found %u unknown events!\n\n" | 1140 | ui__warning("Found %u unknown events!\n\n" |
1141 | "Is this an older tool processing a perf.data " | 1141 | "Is this an older tool processing a perf.data " |
1142 | "file generated by a more recent tool?\n\n" | 1142 | "file generated by a more recent tool?\n\n" |
1143 | "If that is not the case, consider " | 1143 | "If that is not the case, consider " |
1144 | "reporting to linux-kernel@vger.kernel.org.\n\n", | 1144 | "reporting to linux-kernel@vger.kernel.org.\n\n", |
1145 | session->stats.nr_unknown_events); | 1145 | session->evlist->stats.nr_unknown_events); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | if (session->stats.nr_unknown_id != 0) { | 1148 | if (session->evlist->stats.nr_unknown_id != 0) { |
1149 | ui__warning("%u samples with id not present in the header\n", | 1149 | ui__warning("%u samples with id not present in the header\n", |
1150 | session->stats.nr_unknown_id); | 1150 | session->evlist->stats.nr_unknown_id); |
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | if (session->stats.nr_invalid_chains != 0) { | 1153 | if (session->evlist->stats.nr_invalid_chains != 0) { |
1154 | ui__warning("Found invalid callchains!\n\n" | 1154 | ui__warning("Found invalid callchains!\n\n" |
1155 | "%u out of %u events were discarded for this reason.\n\n" | 1155 | "%u out of %u events were discarded for this reason.\n\n" |
1156 | "Consider reporting to linux-kernel@vger.kernel.org.\n\n", | 1156 | "Consider reporting to linux-kernel@vger.kernel.org.\n\n", |
1157 | session->stats.nr_invalid_chains, | 1157 | session->evlist->stats.nr_invalid_chains, |
1158 | session->stats.nr_events[PERF_RECORD_SAMPLE]); | 1158 | session->evlist->stats.nr_events[PERF_RECORD_SAMPLE]); |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | if (session->stats.nr_unprocessable_samples != 0) { | 1161 | if (session->evlist->stats.nr_unprocessable_samples != 0) { |
1162 | ui__warning("%u unprocessable samples recorded.\n" | 1162 | ui__warning("%u unprocessable samples recorded.\n" |
1163 | "Do you have a KVM guest running and not using 'perf kvm'?\n", | 1163 | "Do you have a KVM guest running and not using 'perf kvm'?\n", |
1164 | session->stats.nr_unprocessable_samples); | 1164 | session->evlist->stats.nr_unprocessable_samples); |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | if (session->stats.nr_unordered_events != 0) | 1167 | if (session->evlist->stats.nr_unordered_events != 0) |
1168 | ui__warning("%u out of order events recorded.\n", session->stats.nr_unordered_events); | 1168 | ui__warning("%u out of order events recorded.\n", session->evlist->stats.nr_unordered_events); |
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | volatile int session_done; | 1171 | volatile int session_done; |
@@ -1485,7 +1485,7 @@ size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp) | |||
1485 | { | 1485 | { |
1486 | size_t ret = fprintf(fp, "Aggregated stats:\n"); | 1486 | size_t ret = fprintf(fp, "Aggregated stats:\n"); |
1487 | 1487 | ||
1488 | ret += events_stats__fprintf(&session->stats, fp); | 1488 | ret += events_stats__fprintf(&session->evlist->stats, fp); |
1489 | return ret; | 1489 | return ret; |
1490 | } | 1490 | } |
1491 | 1491 | ||
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 6d663dc76404..fe859f379ca7 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
@@ -20,7 +20,6 @@ struct perf_session { | |||
20 | struct machines machines; | 20 | struct machines machines; |
21 | struct perf_evlist *evlist; | 21 | struct perf_evlist *evlist; |
22 | struct trace_event tevent; | 22 | struct trace_event tevent; |
23 | struct events_stats stats; | ||
24 | bool repipe; | 23 | bool repipe; |
25 | bool one_mmap; | 24 | bool one_mmap; |
26 | void *one_mmap_addr; | 25 | void *one_mmap_addr; |