perf mmap: Store real cpu number in 'struct perf_mmap'
authorJiri Olsa <jolsa@kernel.org>
Fri, 17 Aug 2018 11:45:55 +0000 (13:45 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 20 Aug 2018 11:54:59 +0000 (08:54 -0300)
Store the real cpu number in 'struct perf_mmap', which will be used by
python interface that allows user to read a particular memory map for
given cpu.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jaroslav Škarvada <jskarvad@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180817114556.28000-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evlist.c
tools/perf/util/mmap.c
tools/perf/util/mmap.h

index e7a4b31a84fb5f2316549d7ab31378c46589c73a..be440df296150450b4e99e2ab2c5ab83175d29aa 100644 (file)
@@ -803,7 +803,7 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
                if (*output == -1) {
                        *output = fd;
 
-                       if (perf_mmap__mmap(&maps[idx], mp, *output < 0)
+                       if (perf_mmap__mmap(&maps[idx], mp, *output, evlist_cpu) < 0)
                                return -1;
                } else {
                        if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, *output) != 0)
index fc832676a7985f13c4ba7f419b380b7fa2425798..215f69f41672dcc44b6e57948ee3a9fbcdec2724 100644 (file)
@@ -164,7 +164,7 @@ void perf_mmap__munmap(struct perf_mmap *map)
        auxtrace_mmap__munmap(&map->auxtrace_mmap);
 }
 
-int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd)
+int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd, int cpu)
 {
        /*
         * The last one will be done at perf_mmap__consume(), so that we
@@ -191,6 +191,7 @@ int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd)
                return -1;
        }
        map->fd = fd;
+       map->cpu = cpu;
 
        if (auxtrace_mmap__mmap(&map->auxtrace_mmap,
                                &mp->auxtrace_mp, map->base, fd))
index d82294db1295333096eb1111349f1411ff7f8120..05a6d47c79561d5a62c04ae9d600a0ecd16f39b4 100644 (file)
@@ -18,6 +18,7 @@ struct perf_mmap {
        void             *base;
        int              mask;
        int              fd;
+       int              cpu;
        refcount_t       refcnt;
        u64              prev;
        u64              start;
@@ -60,7 +61,7 @@ struct mmap_params {
        struct auxtrace_mmap_params auxtrace_mp;
 };
 
-int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd);
+int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd, int cpu);
 void perf_mmap__munmap(struct perf_mmap *map);
 
 void perf_mmap__get(struct perf_mmap *map);