[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-90a86bde97ba050cb3c9ccb215252ee2d2d705fa@git.kernel.org>
Date: Sat, 9 Mar 2019 12:07:48 -0800
From: tip-bot for Jiri Olsa <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: peterz@...radead.org, jonas.rabenstein@...dium.uni-erlangen.de,
mingo@...nel.org, ravi.bangoria@...ux.ibm.com,
linux-kernel@...r.kernel.org, namhyung@...nel.org,
jolsa@...nel.org, ak@...ux.intel.com, hpa@...or.com,
tglx@...utronix.de, nasastry@...ibm.com, acme@...hat.com,
alexander.shishkin@...ux.intel.com
Subject: [tip:perf/urgent] perf tools: Read and store caps/max_precise in
perf_pmu
Commit-ID: 90a86bde97ba050cb3c9ccb215252ee2d2d705fa
Gitweb: https://git.kernel.org/tip/90a86bde97ba050cb3c9ccb215252ee2d2d705fa
Author: Jiri Olsa <jolsa@...nel.org>
AuthorDate: Tue, 5 Mar 2019 16:25:32 +0100
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 6 Mar 2019 18:18:17 -0300
perf tools: Read and store caps/max_precise in perf_pmu
Read the caps/max_precise value and store it in struct perf_pmu to be
used when setting the maximum precise_ip field in following patch.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Jonas Rabenstein <jonas.rabenstein@...dium.uni-erlangen.de>
Cc: Nageswara R Sastry <nasastry@...ibm.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Link: http://lkml.kernel.org/r/20190305152536.21035-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/pmu.c | 14 ++++++++++++++
tools/perf/util/pmu.h | 1 +
2 files changed, 15 insertions(+)
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 51d437f55d18..6199a3174ab9 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -752,6 +752,19 @@ perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
return NULL;
}
+static int pmu_max_precise(const char *name)
+{
+ char path[PATH_MAX];
+ int max_precise = -1;
+
+ scnprintf(path, PATH_MAX,
+ "bus/event_source/devices/%s/caps/max_precise",
+ name);
+
+ sysfs__read_int(path, &max_precise);
+ return max_precise;
+}
+
static struct perf_pmu *pmu_lookup(const char *name)
{
struct perf_pmu *pmu;
@@ -784,6 +797,7 @@ static struct perf_pmu *pmu_lookup(const char *name)
pmu->name = strdup(name);
pmu->type = type;
pmu->is_uncore = pmu_is_uncore(name);
+ pmu->max_precise = pmu_max_precise(name);
pmu_add_cpu_aliases(&aliases, pmu);
INIT_LIST_HEAD(&pmu->format);
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 47253c3daf55..bd9ec2704a57 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -26,6 +26,7 @@ struct perf_pmu {
__u32 type;
bool selectable;
bool is_uncore;
+ int max_precise;
struct perf_event_attr *default_config;
struct cpu_map *cpus;
struct list_head format; /* HEAD struct perf_pmu_format -> list */
Powered by blists - more mailing lists