From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
"Ingo Molnar" <mingo@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"David Ahern" <dsahern@gmail.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Jaroslav Škarvada" <jskarvad@redhat.com>,
"Joe Mario" <jmario@redhat.com>
Subject: [PATCH 1/2] perf tools: Store real cpu number in the struct perf_mmap
Date: Fri, 17 Aug 2018 13:45:55 +0200 [thread overview]
Message-ID: <20180817114556.28000-2-jolsa@kernel.org> (raw)
In-Reply-To: <20180817114556.28000-1-jolsa@kernel.org>
Storing the real cpu number in the struct perf_mmap, which
be used by python interface that allows user to read particular
memory map for given cpu.
Link: http://lkml.kernel.org/n/tip-a2h9hjs7abv42yiagxiz2sp8@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/evlist.c | 2 +-
tools/perf/util/mmap.c | 4 +++-
tools/perf/util/mmap.h | 4 +++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e7a4b31a84fb..26e1c02440f9 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -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)
diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
index fc832676a798..2eac6dee0b9c 100644
--- a/tools/perf/util/mmap.c
+++ b/tools/perf/util/mmap.c
@@ -164,7 +164,8 @@ 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 +192,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))
diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h
index d82294db1295..cc4fc8cc33ca 100644
--- a/tools/perf/util/mmap.h
+++ b/tools/perf/util/mmap.h
@@ -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,8 @@ 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);
--
2.17.1
next prev parent reply other threads:[~2018-08-17 11:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-17 11:45 [PATCH 0/2] perf tools: Fix pyrf_evlist__read_on_cpu interface Jiri Olsa
2018-08-17 11:45 ` Jiri Olsa [this message]
2018-08-23 8:45 ` [tip:perf/urgent] perf mmap: Store real cpu number in 'struct perf_mmap' tip-bot for Jiri Olsa
2018-08-17 11:45 ` [PATCH 2/2] perf python: Fix pyrf_evlist__read_on_cpu interface Jiri Olsa
2018-08-23 8:46 ` [tip:perf/urgent] perf python: Fix pyrf_evlist__read_on_cpu() interface tip-bot for Jiri Olsa
2018-08-17 14:59 ` [PATCH 0/2] perf tools: Fix pyrf_evlist__read_on_cpu interface Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180817114556.28000-2-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=jmario@redhat.com \
--cc=jskarvad@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).