diff mbox

[RFC] tmp.perf/core branch with event_name changes and some more

Message ID 4FDAEA7D.2080502@linaro.org
State New
Headers show

Commit Message

Dmitry Antipov June 15, 2012, 7:55 a.m. UTC
On 06/12/2012 09:05 PM, Arnaldo Carvalho de Melo wrote:

> 	Could you please check out if my tmp.perf/core branch fixes the
> problems reported lately about event name mismatches from perf.data
> files collected in other machines, etc.

As of a8dfce8b37b2e0d216860191cd50fde501eeb036, perf sched replay
doesn't work because (perf_evlist__set_tracepoints_handlers):

...
err = trace_event__id(assocs[i].name); <-- err is host id, not from perf.data
if (err < 0)
         goto out;
evsel = perf_evlist__find_tracepoint_by_id(evlist, err); <-- oops!
...

Assuming event names are set, can we just lookup by name?

Dmitry
From 5e1fbde04a2a8745711f439f4d4682b2215119b2 Mon Sep 17 00:00:00 2001
From: Dmitry Antipov <dmitry.antipov@linaro.org>
Date: Fri, 15 Jun 2012 11:49:47 +0400
Subject: [PATCH] perf: lookup by event name

Assuming event names are set, lookup tracepoint by name instead of ID.

Signed-off-by: Dmitry Antipov <dmitry.antipov@linaro.org>
---
 tools/perf/util/evlist.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7400fb3..d6b7262 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -225,13 +225,13 @@  out_free_attrs:
 }
 
 static struct perf_evsel *
-	perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id)
+	perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist, const char *name)
 {
 	struct perf_evsel *evsel;
 
 	list_for_each_entry(evsel, &evlist->entries, node) {
 		if (evsel->attr.type   == PERF_TYPE_TRACEPOINT &&
-		    (int)evsel->attr.config == id)
+		    !strcmp(evsel->name, name))
 			return evsel;
 	}
 
@@ -247,11 +247,7 @@  int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist,
 	size_t i;
 
 	for (i = 0; i < nr_assocs; i++) {
-		err = trace_event__id(assocs[i].name);
-		if (err < 0)
-			goto out;
-
-		evsel = perf_evlist__find_tracepoint_by_id(evlist, err);
+		evsel = perf_evlist__find_tracepoint_by_name(evlist, assocs[i].name);
 		if (evsel == NULL)
 			continue;