111 lines
3.9 KiB
Diff
111 lines
3.9 KiB
Diff
From 42dc1676164d4ab890ebe2cf704136e49429ad00 Mon Sep 17 00:00:00 2001
|
|
From: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Date: Wed, 3 Jun 2020 12:32:55 -0300
|
|
Subject: [PATCH 093/201] perf parse: Provide a way to pass a fake_pmu to
|
|
parse_events()
|
|
|
|
mainline inclusion
|
|
from mainline-v5.9-rc1
|
|
commit 3bf91aa5aa493b2ac24ffcfc93ffe861bf03685f
|
|
category: feature
|
|
bugzilla: https://gitee.com/openeuler/kernel/issues/I8C0CX
|
|
|
|
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3bf91aa5aa493b2ac24ffcfc93ffe861bf03685f
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
This is an alternative patch to what Jiri sent that instead of changing
|
|
all callers to parse_events() for allowing to pass a fake_pmu, provide
|
|
another function specifically for that.
|
|
|
|
From Jiri's patch:
|
|
|
|
This way it's possible to parse events from PMUs which are not present
|
|
in the system. It's available only for testing purposes coming in
|
|
following changes, so all the current users set fake_pmu argument as
|
|
false.
|
|
|
|
Based-on-a-patch-by: Jiri Olsa <jolsa@kernel.org>
|
|
Link: http://lore.kernel.org/lkml/20200602214741.1218986-3-jolsa@kernel.org
|
|
Acked-by: Jiri Olsa <jolsa@kernel.org>
|
|
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
|
|
Cc: Andi Kleen <ak@linux.intel.com>
|
|
Cc: Ian Rogers <irogers@google.com>
|
|
Cc: Ingo Molnar <mingo@kernel.org>
|
|
Cc: Michael Petlan <mpetlan@redhat.com>
|
|
Cc: Namhyung Kim <namhyung@kernel.org>
|
|
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
|
|
Cc: Stephane Eranian <eranian@google.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
|
|
|
|
Conflicts:
|
|
tools/perf/util/parse-events.c
|
|
tools/perf/util/parse-events.h
|
|
---
|
|
tools/perf/util/parse-events.c | 15 ++++++++-------
|
|
tools/perf/util/parse-events.h | 12 ++++++++++--
|
|
2 files changed, 18 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
|
|
index f3fe4ed4a9ea..b96fe0525b1b 100644
|
|
--- a/tools/perf/util/parse-events.c
|
|
+++ b/tools/perf/util/parse-events.c
|
|
@@ -1894,15 +1894,16 @@ int parse_events_terms(struct list_head *terms, const char *str)
|
|
return ret;
|
|
}
|
|
|
|
-int parse_events(struct perf_evlist *evlist, const char *str,
|
|
- struct parse_events_error *err)
|
|
+int __parse_events(struct perf_evlist *evlist, const char *str,
|
|
+ struct parse_events_error *err, struct perf_pmu *fake_pmu)
|
|
{
|
|
struct parse_events_state parse_state = {
|
|
- .list = LIST_HEAD_INIT(parse_state.list),
|
|
- .idx = evlist->nr_entries,
|
|
- .error = err,
|
|
- .evlist = evlist,
|
|
- .stoken = PE_START_EVENTS,
|
|
+ .list = LIST_HEAD_INIT(parse_state.list),
|
|
+ .idx = evlist->nr_entries,
|
|
+ .error = err,
|
|
+ .evlist = evlist,
|
|
+ .stoken = PE_START_EVENTS,
|
|
+ .fake_pmu = fake_pmu,
|
|
};
|
|
int ret;
|
|
|
|
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
|
|
index c78809837f29..ffe0c04c6cdb 100644
|
|
--- a/tools/perf/util/parse-events.h
|
|
+++ b/tools/perf/util/parse-events.h
|
|
@@ -17,6 +17,7 @@ struct perf_evlist;
|
|
struct parse_events_error;
|
|
|
|
struct option;
|
|
+struct perf_pmu;
|
|
|
|
struct tracepoint_path {
|
|
char *system;
|
|
@@ -31,8 +32,15 @@ bool have_tracepoints(struct list_head *evlist);
|
|
const char *event_type(int type);
|
|
|
|
int parse_events_option(const struct option *opt, const char *str, int unset);
|
|
-int parse_events(struct perf_evlist *evlist, const char *str,
|
|
- struct parse_events_error *error);
|
|
+int __parse_events(struct perf_evlist *evlist, const char *str, struct parse_events_error *error,
|
|
+ struct perf_pmu *fake_pmu);
|
|
+
|
|
+static inline int parse_events(struct perf_evlist *evlist, const char *str,
|
|
+ struct parse_events_error *err)
|
|
+{
|
|
+ return __parse_events(evlist, str, err, NULL);
|
|
+}
|
|
+
|
|
int parse_events_terms(struct list_head *terms, const char *str);
|
|
int parse_filter(const struct option *opt, const char *str, int unset);
|
|
int exclude_perf(const struct option *opt, const char *arg, int unset);
|
|
--
|
|
2.27.0
|
|
|