[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220831210352.145753-6-namhyung@kernel.org>
Date: Wed, 31 Aug 2022 14:03:52 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Ian Rogers <irogers@...gle.com>,
linux-perf-users@...r.kernel.org,
Adrian Hunter <adrian.hunter@...el.com>
Subject: [PATCH 5/5] perf report: Show per-event LOST SAMPLES stat
Display lost samples with --stat (if not zero):
$ perf report --stat
Aggregated stats:
TOTAL events: 64
COMM events: 2 ( 3.1%)
EXIT events: 1 ( 1.6%)
SAMPLE events: 26 (40.6%)
MMAP2 events: 4 ( 6.2%)
LOST_SAMPLES events: 1 ( 1.6%)
ATTR events: 2 ( 3.1%)
FINISHED_ROUND events: 1 ( 1.6%)
ID_INDEX events: 1 ( 1.6%)
THREAD_MAP events: 1 ( 1.6%)
CPU_MAP events: 1 ( 1.6%)
EVENT_UPDATE events: 2 ( 3.1%)
TIME_CONV events: 1 ( 1.6%)
FEATURE events: 20 (31.2%)
FINISHED_INIT events: 1 ( 1.6%)
cycles:uH stats:
SAMPLE events: 14
LOST_SAMPLES events: 1
instructions:uH stats:
SAMPLE events: 12
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
tools/perf/builtin-report.c | 17 +++++++++++++++++
tools/perf/util/hist.c | 3 +++
2 files changed, 20 insertions(+)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 91ed41cc7d88..8361890176c2 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -752,6 +752,22 @@ static int count_sample_event(struct perf_tool *tool __maybe_unused,
return 0;
}
+static int count_lost_samples_event(struct perf_tool *tool,
+ union perf_event *event,
+ struct perf_sample *sample,
+ struct machine *machine __maybe_unused)
+{
+ struct report *rep = container_of(tool, struct report, tool);
+ struct evsel *evsel;
+
+ evsel = evlist__id2evsel(rep->session->evlist, sample->id);
+ if (evsel) {
+ hists__inc_nr_lost_samples(evsel__hists(evsel),
+ event->lost_samples.lost);
+ }
+ return 0;
+}
+
static int process_attr(struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct evlist **pevlist);
@@ -761,6 +777,7 @@ static void stats_setup(struct report *rep)
memset(&rep->tool, 0, sizeof(rep->tool));
rep->tool.attr = process_attr;
rep->tool.sample = count_sample_event;
+ rep->tool.lost_samples = count_lost_samples_event;
rep->tool.no_warn = true;
}
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 8cab049f7119..cc363ba20c73 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -2689,6 +2689,9 @@ size_t evlist__fprintf_nr_events(struct evlist *evlist, FILE *fp,
ret += fprintf(fp, "%s stats:\n", evsel__name(pos));
ret += fprintf(fp, "%16s events: %10d\n",
"SAMPLE", hists->stats.nr_samples);
+ if (hists->stats.nr_lost_samples)
+ ret += fprintf(fp, "%16s events: %10d\n",
+ "LOST_SAMPLES", hists->stats.nr_lost_samples);
}
return ret;
--
2.37.2.789.g6183377224-goog
Powered by blists - more mailing lists