提交 42811d50 编写于 作者: A Andi Kleen 提交者: Arnaldo Carvalho de Melo

perf stat: Use xyarray dimensions to iterate fds

Now that the xyarray stores the dimensions we can use those
to iterate over the FDs for a evsel.
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
Acked-by: NJiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20171006020029.13339-1-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 de711286
...@@ -508,14 +508,13 @@ static int perf_stat_synthesize_config(bool is_pipe) ...@@ -508,14 +508,13 @@ static int perf_stat_synthesize_config(bool is_pipe)
#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
static int __store_counter_ids(struct perf_evsel *counter, static int __store_counter_ids(struct perf_evsel *counter)
struct cpu_map *cpus,
struct thread_map *threads)
{ {
int cpu, thread; int cpu, thread;
for (cpu = 0; cpu < cpus->nr; cpu++) { for (cpu = 0; cpu < xyarray__max_x(counter->fd); cpu++) {
for (thread = 0; thread < threads->nr; thread++) { for (thread = 0; thread < xyarray__max_y(counter->fd);
thread++) {
int fd = FD(counter, cpu, thread); int fd = FD(counter, cpu, thread);
if (perf_evlist__id_add_fd(evsel_list, counter, if (perf_evlist__id_add_fd(evsel_list, counter,
...@@ -535,7 +534,7 @@ static int store_counter_ids(struct perf_evsel *counter) ...@@ -535,7 +534,7 @@ static int store_counter_ids(struct perf_evsel *counter)
if (perf_evsel__alloc_id(counter, cpus->nr, threads->nr)) if (perf_evsel__alloc_id(counter, cpus->nr, threads->nr))
return -ENOMEM; return -ENOMEM;
return __store_counter_ids(counter, cpus, threads); return __store_counter_ids(counter);
} }
static bool perf_evsel__should_store_id(struct perf_evsel *counter) static bool perf_evsel__should_store_id(struct perf_evsel *counter)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册