79 lines
2.7 KiB
Diff
79 lines
2.7 KiB
Diff
From f86993e23c3bc1178c82ef5e361484dfc30456ff Mon Sep 17 00:00:00 2001
|
|
From: Jiri Olsa <jolsa@kernel.org>
|
|
Date: Tue, 2 Jun 2020 23:47:33 +0200
|
|
Subject: [PATCH 096/201] perf parse: Factor out parse_groups() function
|
|
|
|
mainline inclusion
|
|
from mainline-v5.9-rc1
|
|
commit 8b4468a2107af32b796fa818e5fb76481c39ee5a
|
|
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=8b4468a2107af32b796fa818e5fb76481c39ee5a
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Factor out the parse_groups function, it will be used for new test
|
|
interface coming in following changes.
|
|
|
|
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
|
|
Acked-by: Ian Rogers <irogers@google.com>
|
|
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
|
|
Cc: Andi Kleen <ak@linux.intel.com>
|
|
Cc: Michael Petlan <mpetlan@redhat.com>
|
|
Cc: Namhyung Kim <namhyung@kernel.org>
|
|
Cc: Peter Zijlstra <peterz@infradead.org>
|
|
Cc: Stephane Eranian <eranian@google.com>
|
|
Link: http://lore.kernel.org/lkml/20200602214741.1218986-6-jolsa@kernel.org
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
|
|
---
|
|
tools/perf/util/metricgroup.c | 22 ++++++++++++++++------
|
|
1 file changed, 16 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
|
|
index 8fa4b98f6231..d2f54aa12b33 100644
|
|
--- a/tools/perf/util/metricgroup.c
|
|
+++ b/tools/perf/util/metricgroup.c
|
|
@@ -716,14 +716,12 @@ static void metricgroup__free_egroups(struct list_head *group_list)
|
|
}
|
|
}
|
|
|
|
-int metricgroup__parse_groups(const struct option *opt,
|
|
- const char *str,
|
|
- bool metric_no_group,
|
|
- bool metric_no_merge,
|
|
- struct rblist *metric_events)
|
|
+static int parse_groups(struct perf_evlist *perf_evlist, const char *str,
|
|
+ bool metric_no_group,
|
|
+ bool metric_no_merge,
|
|
+ struct rblist *metric_events)
|
|
{
|
|
struct parse_events_error parse_error;
|
|
- struct perf_evlist *perf_evlist = *(struct perf_evlist **)opt->value;
|
|
struct strbuf extra_events;
|
|
LIST_HEAD(group_list);
|
|
int ret;
|
|
@@ -749,6 +747,18 @@ int metricgroup__parse_groups(const struct option *opt,
|
|
return ret;
|
|
}
|
|
|
|
+int metricgroup__parse_groups(const struct option *opt,
|
|
+ const char *str,
|
|
+ bool metric_no_group,
|
|
+ bool metric_no_merge,
|
|
+ struct rblist *metric_events)
|
|
+{
|
|
+ struct perf_evlist *perf_evlist = *(struct perf_evlist **)opt->value;
|
|
+
|
|
+ return parse_groups(perf_evlist, str, metric_no_group,
|
|
+ metric_no_merge, metric_events);
|
|
+}
|
|
+
|
|
bool metricgroup__has_metric(const char *metric)
|
|
{
|
|
struct pmu_events_map *map = perf_pmu__find_map(NULL);
|
|
--
|
|
2.27.0
|
|
|