Commit 2af4646d authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf stat record: Store events IDs in perf data file

Store event IDs in evlist object so it get stored into perf.data file.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Tested-by: default avatarKan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1446734469-11352-6-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 1c59612d
...@@ -346,6 +346,38 @@ static int perf_stat_synthesize_config(void) ...@@ -346,6 +346,38 @@ static int perf_stat_synthesize_config(void)
return 0; return 0;
} }
#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
static int __store_counter_ids(struct perf_evsel *counter,
struct cpu_map *cpus,
struct thread_map *threads)
{
int cpu, thread;
for (cpu = 0; cpu < cpus->nr; cpu++) {
for (thread = 0; thread < threads->nr; thread++) {
int fd = FD(counter, cpu, thread);
if (perf_evlist__id_add_fd(evsel_list, counter,
cpu, thread, fd) < 0)
return -1;
}
}
return 0;
}
static int store_counter_ids(struct perf_evsel *counter)
{
struct cpu_map *cpus = counter->cpus;
struct thread_map *threads = counter->threads;
if (perf_evsel__alloc_id(counter, cpus->nr, threads->nr))
return -ENOMEM;
return __store_counter_ids(counter, cpus, threads);
}
static int __run_perf_stat(int argc, const char **argv) static int __run_perf_stat(int argc, const char **argv)
{ {
int interval = stat_config.interval; int interval = stat_config.interval;
...@@ -410,6 +442,9 @@ static int __run_perf_stat(int argc, const char **argv) ...@@ -410,6 +442,9 @@ static int __run_perf_stat(int argc, const char **argv)
l = strlen(counter->unit); l = strlen(counter->unit);
if (l > unit_width) if (l > unit_width)
unit_width = l; unit_width = l;
if (STAT_RECORD && store_counter_ids(counter))
return -1;
} }
if (perf_evlist__apply_filters(evsel_list, &counter)) { if (perf_evlist__apply_filters(evsel_list, &counter)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment