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: <1437078831-10152-8-git-send-email-kan.liang@intel.com>
Date:	Thu, 16 Jul 2015 16:33:49 -0400
From:	kan.liang@...el.com
To:	a.p.zijlstra@...llo.nl
Cc:	mingo@...hat.com, acme@...nel.org, eranian@...gle.com,
	ak@...ux.intel.com, mark.rutland@....com, adrian.hunter@...el.com,
	dsahern@...il.com, jolsa@...nel.org, namhyung@...nel.org,
	linux-kernel@...r.kernel.org, Kan Liang <kan.liang@...el.com>
Subject: [PATCH 7/9] perf,tools: save APERF/MPERF/TSC in struct perf_sample

From: Kan Liang <kan.liang@...el.com>

Save APERF/MPERF/TSC in struct perf_sample, so the following sample
process function can easily handle it.

Signed-off-by: Kan Liang <kan.liang@...el.com>
---
 tools/perf/util/event.h   |  3 +++
 tools/perf/util/session.c | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index c53f363..5a5431f 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -191,6 +191,9 @@ struct perf_sample {
 	u64 data_src;
 	u32 flags;
 	u16 insn_len;
+	u64 tsc;
+	u64 aperf;
+	u64 mperf;
 	void *raw_data;
 	struct ip_callchain *callchain;
 	struct branch_stack *branch_stack;
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 6a142d8..bffa58b 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1005,6 +1005,8 @@ static int deliver_sample_value(struct perf_evlist *evlist,
 				struct machine *machine)
 {
 	struct perf_sample_id *sid = perf_evlist__id2sid(evlist, v->id);
+	struct perf_evsel *evsel;
+	u64 nr = 0;
 
 	if (sid) {
 		sample->id     = v->id;
@@ -1017,6 +1019,24 @@ static int deliver_sample_value(struct perf_evlist *evlist,
 		return 0;
 	}
 
+	if (perf_evsel__is_group_leader(sid->evsel)) {
+		evsel = sid->evsel;
+		evlist__for_each_continue(evlist, evsel) {
+			if ((evsel->leader != sid->evsel) ||
+			    (++nr >= sample->read.group.nr))
+				break;
+
+			if (evsel->attr.type == PERF_TYPE_CORE_MISC_FREE) {
+				if (evsel->attr.config == PERF_POWER_APERF)
+					sample->aperf = sample->read.group.values[nr].value;
+				if (evsel->attr.config == PERF_POWER_MPERF)
+					sample->mperf = sample->read.group.values[nr].value;
+				if (evsel->attr.config == PERF_TSC)
+					sample->tsc = sample->read.group.values[nr].value;
+			}
+		}
+	}
+
 	return tool->sample(tool, event, sample, sid->evsel, machine);
 }
 
-- 
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