Message ID | 4FF40B7E.20202@linaro.org |
---|---|
State | New |
Headers | show |
Hi, Dmitry On Wed, 04 Jul 2012 13:23:10 +0400, Dmitry Antipov wrote: > I remember that this was rejected some time ago. Nevertheless, > is it possible to accept this until we will have a better solution? > Why??? Ingo already merged da3789628f88 ("perf tools: Stop using a global trace events description list"). Didn't it solve your problem? On my tesing, it works well for cross-replay: $ ./perf sched -i ~/arm/perf.data replay run measurement overhead: 253 nsecs sleep measurement overhead: 55136 nsecs the run test took 1000013 nsecs the sleep test took 1057532 nsecs nr_run_events: 53 nr_sleep_events: 62 nr_wakeup_events: 31 target-less wakeups: 1 task 0 ( <unknown>: 1496), nr_events: 18 task 1 ( perf: 1497), nr_events: 10 task 2 ( ksoftirqd/0: 3), nr_events: 9 task 3 ( kworker/0:1: 280), nr_events: 36 task 4 ( swapper: 0), nr_events: 62 task 5 ( sync_supers: 103), nr_events: 3 task 6 ( init: 1), nr_events: 3 task 7 ( flush-8:0: 560), nr_events: 3 task 8 ( rsyslogd: 1135), nr_events: 3 ------------------------------------------------------------ #1 : 2664.545, ravg: 2664.54, cpu: 3125.45 / 3125.45 #2 : 2664.978, ravg: 2664.59, cpu: 3124.99 / 3125.40 #3 : 2664.736, ravg: 2664.60, cpu: 3125.68 / 3125.43 #4 : 2664.620, ravg: 2664.60, cpu: 3125.96 / 3125.48 #5 : 2665.132, ravg: 2664.66, cpu: 3126.02 / 3125.54 #6 : 2665.096, ravg: 2664.70, cpu: 3083.47 / 3121.33 #7 : 2665.585, ravg: 2664.79, cpu: 3125.66 / 3121.76 #8 : 2664.839, ravg: 2664.79, cpu: 3126.01 / 3122.19 #9 : 2664.750, ravg: 2664.79, cpu: 3125.38 / 3122.51 #10 : 2668.297, ravg: 2665.14, cpu: 3116.82 / 3121.94 Of course, host and arm machine have different id's. Thanks, Namhyung
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 7400fb3..58a5433 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -17,6 +17,7 @@ #include <unistd.h> #include "parse-events.h" +#include "trace-event.h" #include <sys/mman.h> @@ -242,12 +243,29 @@ int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist, const struct perf_evsel_str_handler *assocs, size_t nr_assocs) { + struct event_format *event; struct perf_evsel *evsel; + char *p, *sys, *name; int err; - size_t i; + size_t i, off; for (i = 0; i < nr_assocs; i++) { - err = trace_event__id(assocs[i].name); + err = -ENOENT; + p = strchr(assocs[i].name, ':'); + if (!p) + goto out; + off = p - assocs[i].name; + sys = malloc(off + 1); + if (!sys) + err = -ENOMEM; + else { + memcpy(sys, assocs[i].name, off); + sys[off] = '\0'; + name = p + 1; + event = trace_find_event_by_name(sys, name); + err = event ? event->id : trace_event__id(assocs[i].name); + free(sys); + } if (err < 0) goto out; diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index df2fddb..44cbb40 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c @@ -176,6 +176,10 @@ struct event_format *trace_find_event(int type) return pevent_find_event(pevent, type); } +struct event_format *trace_find_event_by_name(const char *sys, const char *name) +{ + return pevent_find_event_by_name(pevent, sys, name); +} void print_trace_event(int cpu, void *data, int size) { diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index 639852a..66f83a0 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h @@ -40,6 +40,7 @@ int parse_event_file(char *buf, unsigned long size, char *sys); struct pevent_record *trace_peek_data(int cpu); struct event_format *trace_find_event(int type); +struct event_format *trace_find_event_by_name(const char *sys, const char *name); unsigned long long raw_field_value(struct event_format *event, const char *name, void *data);