From: Jiri Olsa <jolsa@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: [PATCH] perf, tool: Add modifiers to be part of the event name
Date: Fri, 11 May 2012 12:25:22 +0200 [thread overview]
Message-ID: <20120511102522.GA2012@m.brq.redhat.com> (raw)
In-Reply-To: <1336695468-5464-1-git-send-email-andi@firstfloor.org>
On Thu, May 10, 2012 at 05:17:48PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> We need to save the original string for perf stat output,
> otherwise :t and :c are invisible.
right, the modifier got lost
We need to fix the name once modifier is detected and final
event name is assigned (e.g. there could be "*?" in the tracepoint
event name, causing the name to be unwinded..).
Please check attached patch.
I'll add some testcases later, since there's patchset
waiting in Arnaldo's queue that would need to be rebased.
thanks,
jirka
---
We lost modifier as part of the event name after event parser
refactoring. Adding it back so it could be properly displayed
in perf stat output.
If there's a modifier specified for the event we fix the event
name to include it.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/util/parse-events.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5b3a0ef..6125f5e 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -684,11 +684,24 @@ void parse_events_update_lists(struct list_head *list_event,
INIT_LIST_HEAD(list_event);
}
+static int update_event_name(struct perf_evsel *evsel, char *mod)
+{
+ char name[MAX_NAME_LEN];
+
+ /* Each event should have a name defined at this point. */
+ BUG_ON(!evsel->name);
+ snprintf(name, MAX_NAME_LEN, "%s:%s", evsel->name, mod);
+ free(evsel->name);
+ evsel->name = strdup(name);
+ return evsel->name ? 0 : -ENOMEM;
+}
+
int parse_events_modifier(struct list_head *list, char *str)
{
struct perf_evsel *evsel;
int exclude = 0, exclude_GH = 0;
int eu = 0, ek = 0, eh = 0, eH = 0, eG = 0, precise = 0;
+ char *mod = str;
if (str == NULL)
return 0;
@@ -742,6 +755,9 @@ int parse_events_modifier(struct list_head *list, char *str)
evsel->attr.precise_ip = precise;
evsel->attr.exclude_host = eH;
evsel->attr.exclude_guest = eG;
+
+ if (update_event_name(evsel, mod))
+ return -ENOMEM;
}
return 0;
--
1.7.7.6
next prev parent reply other threads:[~2012-05-11 10:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-11 0:17 [PATCH] perf, utils: Print the original modifiers in event_name Andi Kleen
2012-05-11 10:25 ` Jiri Olsa [this message]
2012-05-14 23:55 ` [PATCH] perf, tool: Add modifiers to be part of the event name Andi Kleen
2012-05-15 11:54 ` Jiri Olsa
2012-05-25 22:35 ` Andi Kleen
2012-05-26 3:15 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120511102522.GA2012@m.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox