Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1230974
| From | kan.liang@intel.com |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH RFC 07/10] perf,report: handle PERF_RECORD_COUNTER_READ |
| Date | 2015-09-22 23:40 +0200 |
| Message-ID | <qbDs6-IB-29@gated-at.bofh.it> (permalink) |
| References | <qbDs5-IB-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Kan Liang <kan.liang@intel.com>
Add function to process PERF_RECORD_COUNTER_READ RECORD type event.
Simply print event name, cpu id, val and time information in
perf report -D.
Signed-off-by: Kan Liang <kan.liang@intel.com>
---
tools/perf/builtin-report.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index e4e3f14..1d8dce2 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -207,6 +207,29 @@ static int process_read_event(struct perf_tool *tool,
return 0;
}
+static int process_counter_read_event(struct perf_tool *tool __maybe_unused,
+ union perf_event *event,
+ struct perf_session *session)
+{
+ struct perf_evlist *evlist = session->evlist;
+ struct perf_evsel *evsel;
+
+ evlist__for_each(evlist, evsel) {
+ if (evsel->idx == event->counter_read.idx)
+ break;
+ }
+
+ hists__inc_nr_events(evsel__hists(evsel), event->header.type);
+
+ dump_printf(": %s CPU %d: val %" PRIu64 " ena %" PRIu64 " run %" PRIu64 " \n",
+ evsel ? perf_evsel__name(evsel) : "FAIL",
+ event->counter_read.cpu,
+ event->counter_read.val,
+ event->counter_read.ena,
+ event->counter_read.run);
+ return 0;
+}
+
/* For pipe mode, sample_type is not currently set */
static int report__setup_sample_type(struct report *rep)
{
@@ -632,6 +655,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
.fork = perf_event__process_fork,
.lost = perf_event__process_lost,
.read = process_read_event,
+ .counter_read = process_counter_read_event,
.attr = perf_event__process_attr,
.tracing_data = perf_event__process_tracing_data,
.build_id = perf_event__process_build_id,
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH RFC 07/10] perf,report: handle PERF_RECORD_COUNTER_READ kan.liang@intel.com - 2015-09-22 23:40 +0200
csiph-web