lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1442931223-51708-8-git-send-email-kan.liang@intel.com>
Date:	Tue, 22 Sep 2015 10:13:40 -0400
From:	kan.liang@...el.com
To:	acme@...nel.org
Cc:	jolsa@...nel.org, a.p.zijlstra@...llo.nl, mingo@...hat.com,
	namhyung@...nel.org, ak@...ux.intel.com,
	linux-kernel@...r.kernel.org, Kan Liang <kan.liang@...el.com>
Subject: [PATCH RFC 07/10] perf,report: handle PERF_RECORD_COUNTER_READ

From: Kan Liang <kan.liang@...el.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@...el.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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ