lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120511102522.GA2012@m.brq.redhat.com>
Date:	Fri, 11 May 2012 12:25:22 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	acme@...hat.com, linux-kernel@...r.kernel.org,
	Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH] perf, tool: Add modifiers to be part of the event name

On Thu, May 10, 2012 at 05:17:48PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.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@...hat.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

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ