[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1349299363-30714-3-git-send-email-andi@firstfloor.org>
Date: Wed, 3 Oct 2012 14:22:42 -0700
From: Andi Kleen <andi@...stfloor.org>
To: acme@...hat.com
Cc: jolsa@...hat.com, eranian@...gle.com, a.p.zijlstra@...llo.nl,
linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH 2/3] perf, tools: Default to cpu// for events
From: Andi Kleen <ak@...ux.intel.com>
When an event fails to parse and it's not in a new style format,
try to parse it again as a cpu event.
This allows to use sysfs exported events directly without //, so I can use
perf record -e tx-aborts ...
instead of
perf record -e cpu/tx-aborts/
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
tools/perf/util/parse-events.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index de1cb9e..4e7117f 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -785,6 +785,16 @@ static int parse_events__scanner(const char *str, void *data, int start_token)
parse_events__flush_buffer(buffer, scanner);
parse_events__delete_buffer(buffer, scanner);
parse_events_lex_destroy(scanner);
+
+ if (ret && !strchr(str, '/')) {
+ char *s = malloc(strlen(str) + strlen("cpu/") + 2);
+
+ if (!s)
+ return ret;
+ sprintf(s, "cpu/%s/", str);
+ str = s;
+ return parse_events__scanner(str, data, start_token);
+ }
return ret;
}
--
1.7.7.6
--
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