Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755700Ab3GVNw0 (ORCPT ); Mon, 22 Jul 2013 09:52:26 -0400 Received: from mga03.intel.com ([143.182.124.21]:65116 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752558Ab3GVNwY (ORCPT ); Mon, 22 Jul 2013 09:52:24 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,719,1367996400"; d="scan'208";a="335012175" From: Andi Kleen To: acme@infradead.org Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 1/2] tools, perf: Add a precise event qualifier v2 Date: Mon, 22 Jul 2013 06:52:17 -0700 Message-Id: <1374501138-13496-1-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2497 Lines: 80 From: Andi Kleen Add a precise qualifier, like cpu/event=0x3c,precise=1/ This is needed so that the kernel can request enabling PEBS on specific events. This is useful for mem-loads/mem-stores Currently you have to known that mem-loads is a PEBS event and use perf record -e cpu/mem-loads/p ... With this patch we can export the PEBSness of events in sysfs and then allow perf record -e cpu/mem-loads/ ... or with the additional patch to automatically add cpu// perf record -e mem-loads ... Also useful for some other events added in later patches. v2: Allow 3 as value Signed-off-by: Andi Kleen --- tools/perf/util/parse-events.c | 6 ++++++ tools/perf/util/parse-events.h | 1 + tools/perf/util/parse-events.l | 1 + 3 files changed, 8 insertions(+) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 995fc25..34f1470 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -568,6 +568,12 @@ do { \ case PARSE_EVENTS__TERM_TYPE_NAME: CHECK_TYPE_VAL(STR); break; + case PARSE_EVENTS__TERM_TYPE_PRECISE: + CHECK_TYPE_VAL(NUM); + if ((unsigned)term->val.num > 3) + return -EINVAL; + attr->precise_ip = term->val.num; + break; default: return -EINVAL; } diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 8a48593..13d7c66 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -48,6 +48,7 @@ enum { PARSE_EVENTS__TERM_TYPE_NAME, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE, + PARSE_EVENTS__TERM_TYPE_PRECISE, }; struct parse_events_term { diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index e9d1134..32a9000 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -169,6 +169,7 @@ period { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); } branch_type { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); } , { return ','; } "/" { BEGIN(INITIAL); return '/'; } +precise { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PRECISE); } {name_minus} { return str(yyscanner, PE_NAME); } } -- 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/