Skip to content

Commit

Permalink
perf top: Use evlist->events_stat to count events
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Apr 29, 2021
1 parent d0713d4 commit bf8f858
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@ static void perf_top__print_sym_table(struct perf_top *top)
printf("%-*.*s\n", win_width, win_width, graph_dotted_line);

if (!top->record_opts.overwrite &&
(hists->stats.nr_lost_warned !=
hists->stats.nr_events[PERF_RECORD_LOST])) {
hists->stats.nr_lost_warned =
hists->stats.nr_events[PERF_RECORD_LOST];
(top->evlist->stats.nr_lost_warned !=
top->evlist->stats.nr_events[PERF_RECORD_LOST])) {
top->evlist->stats.nr_lost_warned =
top->evlist->stats.nr_events[PERF_RECORD_LOST];
color_fprintf(stdout, PERF_COLOR_RED,
"WARNING: LOST %d chunks, Check IO/CPU overload",
hists->stats.nr_lost_warned);
top->evlist->stats.nr_lost_warned);
++printed;
}

Expand Down Expand Up @@ -852,23 +852,19 @@ static void
perf_top__process_lost(struct perf_top *top, union perf_event *event,
struct evsel *evsel)
{
struct hists *hists = evsel__hists(evsel);

top->lost += event->lost.lost;
top->lost_total += event->lost.lost;
hists->stats.total_lost += event->lost.lost;
evsel->evlist->stats.total_lost += event->lost.lost;
}

static void
perf_top__process_lost_samples(struct perf_top *top,
union perf_event *event,
struct evsel *evsel)
{
struct hists *hists = evsel__hists(evsel);

top->lost += event->lost_samples.lost;
top->lost_total += event->lost_samples.lost;
hists->stats.total_lost_samples += event->lost_samples.lost;
evsel->evlist->stats.total_lost_samples += event->lost_samples.lost;
}

static u64 last_timestamp;
Expand Down Expand Up @@ -1205,7 +1201,7 @@ static int deliver_event(struct ordered_events *qe,
} else if (event->header.type == PERF_RECORD_LOST_SAMPLES) {
perf_top__process_lost_samples(top, event, evsel);
} else if (event->header.type < PERF_RECORD_MAX) {
hists__inc_nr_events(evsel__hists(evsel), event->header.type);
events_stats__inc(&session->evlist->stats, event->header.type);
machine__process_event(machine, event, &sample);
} else
++session->evlist->stats.nr_unknown_events;
Expand Down

0 comments on commit bf8f858

Please sign in to comment.