Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932914Ab2JRX3L (ORCPT ); Thu, 18 Oct 2012 19:29:11 -0400 Received: from mga02.intel.com ([134.134.136.20]:20461 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756267Ab2JRXTw (ORCPT ); Thu, 18 Oct 2012 19:19:52 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,609,1344236400"; d="scan'208";a="229462619" From: Andi Kleen To: a.p.zijlstra@chello.nl Cc: x86@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, eranian@google.com, Andi Kleen Subject: [PATCH 05/34] perf, x86: Report PEBS event in a raw format Date: Thu, 18 Oct 2012 16:19:13 -0700 Message-Id: <1350602382-12771-6-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1350602382-12771-1-git-send-email-andi@firstfloor.org> References: <1350602382-12771-1-git-send-email-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2105 Lines: 64 From: Andi Kleen Add support for reporting PEBS records in a raw format that can be then parsed by perf script. We exposed most of the Haswell PEBS fields in a generic way in this patchkit: - Aborted cycles is in weight - Memory latency is in weight - DataLA is in address - EventingRIP is used for precise ip - tsx_tuning and some bits of the abort code in RAX are mapped to transaction flags Left over are the general registers. We need them for some analysis too: for example for loop trip count and string instruction trip count sampling. There isn't really any good way to generalize general registers. Obviously they are different for every architecture. So patch exports the RAW PEBS record when requested. With the new perf script infrastructure that was recently added it is reasonably easy and clean to process with script. Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event_intel_ds.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index 91c2ab7..5d3d6be 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c @@ -600,6 +600,7 @@ static void __intel_pmu_pebs_event(struct perf_event *event, struct pebs_record_core *pebs = __pebs; struct perf_sample_data data; struct pt_regs regs; + struct perf_raw_record raw; if (!intel_pmu_save_and_restart(event)) return; @@ -630,6 +631,12 @@ static void __intel_pmu_pebs_event(struct perf_event *event, else regs.flags &= ~PERF_EFLAGS_EXACT; + if (event->attr.sample_type & PERF_SAMPLE_RAW) { + raw.size = x86_pmu.pebs_record_size; + raw.data = __pebs; + data.raw = &raw; + } + if (has_branch_stack(event)) data.br_stack = &cpuc->lbr_stack; -- 1.7.7.6 -- 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/