* perf sched replay again
@ 2012-07-04 9:23 Dmitry Antipov
2012-07-06 6:30 ` Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Antipov @ 2012-07-04 9:23 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, linaro-dev, patches
[-- Attachment #1: Type: text/plain, Size: 139 bytes --]
I remember that this was rejected some time ago. Nevertheless,
is it possible to accept this until we will have a better solution?
Dmitry
[-- Attachment #2: 0001-perf-sched-replay-fix-event-lookup.patch --]
[-- Type: text/plain, Size: 2849 bytes --]
From 7b394670bee55ca694f921bd96f210b0d4c7dfe0 Mon Sep 17 00:00:00 2001
From: Dmitry Antipov <dmitry.antipov@linaro.org>
Date: Wed, 4 Jul 2012 13:20:59 +0400
Subject: [PATCH] perf sched replay: fix event lookup
Use new function trace_find_event_by_name to lookup events before
looking through /sys files. This helps 'perf sched replay' to map
event names to IDs correctly when processing perf.data recorded
on another machine.
Signed-off-by: Dmitry Antipov <dmitry.antipov@linaro.org>
---
tools/perf/util/evlist.c | 22 ++++++++++++++++++++--
tools/perf/util/trace-event-parse.c | 4 ++++
tools/perf/util/trace-event.h | 1 +
3 files changed, 25 insertions(+), 2 deletions(-)
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);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: perf sched replay again
2012-07-04 9:23 perf sched replay again Dmitry Antipov
@ 2012-07-06 6:30 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2012-07-06 6:30 UTC (permalink / raw)
To: Dmitry Antipov
Cc: Arnaldo Carvalho de Melo, linux-kernel, linaro-dev, patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-06 6:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-04 9:23 perf sched replay again Dmitry Antipov
2012-07-06 6:30 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).