Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756239AbbGQDtz (ORCPT ); Thu, 16 Jul 2015 23:49:55 -0400 Received: from mga11.intel.com ([192.55.52.93]:12897 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754703AbbGQDsg (ORCPT ); Thu, 16 Jul 2015 23:48:36 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,492,1432623600"; d="scan'208";a="607841829" From: kan.liang@intel.com To: a.p.zijlstra@chello.nl Cc: mingo@redhat.com, acme@kernel.org, eranian@google.com, ak@linux.intel.com, mark.rutland@arm.com, adrian.hunter@intel.com, dsahern@gmail.com, jolsa@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, Kan Liang Subject: [PATCH 7/9] perf,tools: save APERF/MPERF/TSC in struct perf_sample Date: Thu, 16 Jul 2015 16:33:49 -0400 Message-Id: <1437078831-10152-8-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1437078831-10152-1-git-send-email-kan.liang@intel.com> References: <1437078831-10152-1-git-send-email-kan.liang@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2146 Lines: 71 From: Kan Liang Save APERF/MPERF/TSC in struct perf_sample, so the following sample process function can easily handle it. Signed-off-by: Kan Liang --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/