[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1453715801-7732-48-git-send-email-wangnan0@huawei.com>
Date: Mon, 25 Jan 2016 09:56:34 +0000
From: Wang Nan <wangnan0@...wei.com>
To: Alexei Starovoitov <ast@...nel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>
CC: Brendan Gregg <brendan.d.gregg@...il.com>,
Daniel Borkmann <daniel@...earbox.net>,
"David S. Miller" <davem@...emloft.net>,
He Kuang <hekuang@...wei.com>, Jiri Olsa <jolsa@...nel.org>,
Li Zefan <lizefan@...wei.com>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, <pi3orama@....com>,
Will Deacon <will.deacon@....com>,
<linux-kernel@...r.kernel.org>, Wang Nan <wangnan0@...wei.com>
Subject: [PATCH 47/54] perf tools: Detect avalibility of write_backward
Detect avalibility of write_backward and save the result into
record_opts. With write_backward the start pointer of a ring
buffer mapped read only can be found reliably.
Signed-off-by: Wang Nan <wangnan0@...wei.com>
Signed-off-by: He Kuang <hekuang@...wei.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Zefan Li <lizefan@...wei.com>
Cc: pi3orama@....com
---
tools/perf/perf.h | 1 +
tools/perf/util/record.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 90129ac..00c25b1 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -71,6 +71,7 @@ struct record_opts {
bool sample_transaction;
unsigned initial_delay;
bool use_clockid;
+ bool has_write_backward;
clockid_t clockid;
unsigned int proc_map_timeout;
};
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
index 0467367..d01f155 100644
--- a/tools/perf/util/record.c
+++ b/tools/perf/util/record.c
@@ -85,6 +85,11 @@ static void perf_probe_comm_exec(struct perf_evsel *evsel)
evsel->attr.comm_exec = 1;
}
+static void perf_probe_write_backward(struct perf_evsel *evsel)
+{
+ evsel->attr.write_backward = 1;
+}
+
static void perf_probe_context_switch(struct perf_evsel *evsel)
{
evsel->attr.context_switch = 1;
@@ -105,6 +110,11 @@ bool perf_can_record_switch_events(void)
return perf_probe_api(perf_probe_context_switch);
}
+static bool perf_can_write_backward(void)
+{
+ return perf_probe_api(perf_probe_write_backward);
+}
+
bool perf_can_record_cpu_wide(void)
{
struct perf_event_attr attr = {
@@ -235,6 +245,7 @@ static int record_opts__config_freq(struct record_opts *opts)
int record_opts__config(struct record_opts *opts)
{
+ opts->has_write_backward = perf_can_write_backward();
return record_opts__config_freq(opts);
}
--
1.8.3.4
Powered by blists - more mailing lists