aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/pmu.c14
-rw-r--r--tools/perf/util/pmu.h1
2 files changed, 15 insertions, 0 deletions
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)
752 return NULL; 752 return NULL;
753} 753}
754 754
755static int pmu_max_precise(const char *name)
756{
757 char path[PATH_MAX];
758 int max_precise = -1;
759
760 scnprintf(path, PATH_MAX,
761 "bus/event_source/devices/%s/caps/max_precise",
762 name);
763
764 sysfs__read_int(path, &max_precise);
765 return max_precise;
766}
767
755static struct perf_pmu *pmu_lookup(const char *name) 768static struct perf_pmu *pmu_lookup(const char *name)
756{ 769{
757 struct perf_pmu *pmu; 770 struct perf_pmu *pmu;
@@ -784,6 +797,7 @@ static struct perf_pmu *pmu_lookup(const char *name)
784 pmu->name = strdup(name); 797 pmu->name = strdup(name);
785 pmu->type = type; 798 pmu->type = type;
786 pmu->is_uncore = pmu_is_uncore(name); 799 pmu->is_uncore = pmu_is_uncore(name);
800 pmu->max_precise = pmu_max_precise(name);
787 pmu_add_cpu_aliases(&aliases, pmu); 801 pmu_add_cpu_aliases(&aliases, pmu);
788 802
789 INIT_LIST_HEAD(&pmu->format); 803 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 {
26 __u32 type; 26 __u32 type;
27 bool selectable; 27 bool selectable;
28 bool is_uncore; 28 bool is_uncore;
29 int max_precise;
29 struct perf_event_attr *default_config; 30 struct perf_event_attr *default_config;
30 struct cpu_map *cpus; 31 struct cpu_map *cpus;
31 struct list_head format; /* HEAD struct perf_pmu_format -> list */ 32 struct list_head format; /* HEAD struct perf_pmu_format -> list */