perf stat: Use xyarray dimensions to iterate fds
authorAndi Kleen <ak@linux.intel.com>
Fri, 6 Oct 2017 02:00:28 +0000 (19:00 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 21 Feb 2018 14:36:57 +0000 (11:36 -0300)
Now that the xyarray stores the dimensions we can use those
to iterate over the FDs for a evsel.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20171006020029.13339-1-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-stat.c

index 2d49eccf98f2776f536e0141b5a4a00c39f1d7a7..fadcff52cd0944e7501b761a855e18e8771e2965 100644 (file)
@@ -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))
 
-static int __store_counter_ids(struct perf_evsel *counter,
-                              struct cpu_map *cpus,
-                              struct thread_map *threads)
+static int __store_counter_ids(struct perf_evsel *counter)
 {
        int cpu, thread;
 
-       for (cpu = 0; cpu < cpus->nr; cpu++) {
-               for (thread = 0; thread < threads->nr; thread++) {
+       for (cpu = 0; cpu < xyarray__max_x(counter->fd); cpu++) {
+               for (thread = 0; thread < xyarray__max_y(counter->fd);
+                    thread++) {
                        int fd = FD(counter, cpu, thread);
 
                        if (perf_evlist__id_add_fd(evsel_list, counter,
@@ -535,7 +534,7 @@ static int store_counter_ids(struct perf_evsel *counter)
        if (perf_evsel__alloc_id(counter, cpus->nr, threads->nr))
                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)