Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf top: Use evlist->events_stat to count events

It's mainly to count lost events for the warning so it should be ok
to use the evlist->stats instead. This is needed for changes in the
next commit.

Reviewed-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210427013717.1651674-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
bf8f8587 d0713d4c

+8 -12
+8 -12
tools/perf/builtin-top.c
··· 328 328 printf("%-*.*s\n", win_width, win_width, graph_dotted_line); 329 329 330 330 if (!top->record_opts.overwrite && 331 - (hists->stats.nr_lost_warned != 332 - hists->stats.nr_events[PERF_RECORD_LOST])) { 333 - hists->stats.nr_lost_warned = 334 - hists->stats.nr_events[PERF_RECORD_LOST]; 331 + (top->evlist->stats.nr_lost_warned != 332 + top->evlist->stats.nr_events[PERF_RECORD_LOST])) { 333 + top->evlist->stats.nr_lost_warned = 334 + top->evlist->stats.nr_events[PERF_RECORD_LOST]; 335 335 color_fprintf(stdout, PERF_COLOR_RED, 336 336 "WARNING: LOST %d chunks, Check IO/CPU overload", 337 - hists->stats.nr_lost_warned); 337 + top->evlist->stats.nr_lost_warned); 338 338 ++printed; 339 339 } 340 340 ··· 852 852 perf_top__process_lost(struct perf_top *top, union perf_event *event, 853 853 struct evsel *evsel) 854 854 { 855 - struct hists *hists = evsel__hists(evsel); 856 - 857 855 top->lost += event->lost.lost; 858 856 top->lost_total += event->lost.lost; 859 - hists->stats.total_lost += event->lost.lost; 857 + evsel->evlist->stats.total_lost += event->lost.lost; 860 858 } 861 859 862 860 static void ··· 862 864 union perf_event *event, 863 865 struct evsel *evsel) 864 866 { 865 - struct hists *hists = evsel__hists(evsel); 866 - 867 867 top->lost += event->lost_samples.lost; 868 868 top->lost_total += event->lost_samples.lost; 869 - hists->stats.total_lost_samples += event->lost_samples.lost; 869 + evsel->evlist->stats.total_lost_samples += event->lost_samples.lost; 870 870 } 871 871 872 872 static u64 last_timestamp; ··· 1201 1205 } else if (event->header.type == PERF_RECORD_LOST_SAMPLES) { 1202 1206 perf_top__process_lost_samples(top, event, evsel); 1203 1207 } else if (event->header.type < PERF_RECORD_MAX) { 1204 - hists__inc_nr_events(evsel__hists(evsel), event->header.type); 1208 + events_stats__inc(&session->evlist->stats, event->header.type); 1205 1209 machine__process_event(machine, event, &sample); 1206 1210 } else 1207 1211 ++session->evlist->stats.nr_unknown_events;