aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/metricgroup.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2020-06-02 23:47:33 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-06-22 16:28:08 -0300
commit8b4468a2107af32b796fa818e5fb76481c39ee5a (patch)
treef3656ab799e2219ff901f0103750890871b532bc /tools/perf/util/metricgroup.c
parentperf tests: Add another metric parsing test (diff)
downloadlinux-dev-8b4468a2107af32b796fa818e5fb76481c39ee5a.tar.xz
linux-dev-8b4468a2107af32b796fa818e5fb76481c39ee5a.zip
perf parse: Factor out parse_groups() function
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>
Diffstat (limited to 'tools/perf/util/metricgroup.c')
-rw-r--r--tools/perf/util/metricgroup.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 9e21aa767e41..d72a565ec483 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -709,14 +709,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 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 evlist *perf_evlist = *(struct evlist **)opt->value;
struct strbuf extra_events;
LIST_HEAD(group_list);
int ret;
@@ -742,6 +740,18 @@ out:
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 evlist *perf_evlist = *(struct 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);