[tip: perf/urgent] perf pmu: Add is_pmu_core()

From: tip-bot2 for John Garry
Date: Sat Apr 04 2020 - 04:43:01 EST


The following commit has been merged into the perf/urgent branch of tip:

Commit-ID: d504fae93dd61b734aefc403c7653d958aef655a
Gitweb: https://git.kernel.org/tip/d504fae93dd61b734aefc403c7653d958aef655a
Author: John Garry <john.garry@xxxxxxxxxx>
AuthorDate: Tue, 17 Mar 2020 19:02:17 +08:00
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitterDate: Tue, 24 Mar 2020 10:35:59 -03:00

perf pmu: Add is_pmu_core()

Add a function to decide whether a PMU is a core PMU.

Signed-off-by: John Garry <john.garry@xxxxxxxxxx>
Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: James Clark <james.clark@xxxxxxx>
Cc: Joakim Zhang <qiangqing.zhang@xxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
Cc: linuxarm@xxxxxxxxxx
Link: http://lore.kernel.org/lkml/1584442939-8911-6-git-send-email-john.garry@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/pmu.c | 5 +++++
tools/perf/util/pmu.h | 1 +
2 files changed, 6 insertions(+)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index c616a06..55129d0 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -1400,6 +1400,11 @@ static void wordwrap(char *s, int start, int max, int corr)
}
}

+bool is_pmu_core(const char *name)
+{
+ return !strcmp(name, "cpu") || is_arm_pmu_core(name);
+}
+
void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,
bool long_desc, bool details_flag, bool deprecated)
{
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 0b4a0ef..b756946 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -88,6 +88,7 @@ int perf_pmu__format_parse(char *dir, struct list_head *head);

struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);

+bool is_pmu_core(const char *name);
void print_pmu_events(const char *event_glob, bool name_only, bool quiet,
bool long_desc, bool details_flag,
bool deprecated);