aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Olsa <[email protected]>2020-07-19 20:13:13 +0200
committerArnaldo Carvalho de Melo <[email protected]>2020-07-30 07:01:49 -0300
commit98461d9dc115a2ef555ad114866e8acdc6377aaa (patch)
tree2122897ae4c92c52d6a4168407f8eeea3af72ba6
parentacf71b05d1a19726594a8436ba9d8af871941e6c (diff)
perf metric: Add events for the current list
There's no need to iterate the whole list of groups, when adding new events. The currently created groups are the ones we want to add. Signed-off-by: Jiri Olsa <[email protected]> Reviewed-by: Kajol Jain <[email protected]> Acked-by: Ian Rogers <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: John Garry <[email protected]> Cc: Michael Petlan <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/metricgroup.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index f690da21668d..86665c502443 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -827,6 +827,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
{
struct pmu_event *pe;
struct egroup *eg;
+ LIST_HEAD(list);
int i, ret;
bool has_match = false;
@@ -834,7 +835,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
has_match = true;
eg = NULL;
- ret = add_metric(group_list, pe, metric_no_group, &eg);
+ ret = add_metric(&list, pe, metric_no_group, &eg);
if (ret)
return ret;
@@ -843,7 +844,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
* included in the expression.
*/
ret = resolve_metric(metric_no_group,
- group_list, map);
+ &list, map);
if (ret)
return ret;
}
@@ -852,7 +853,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
if (!has_match)
return -EINVAL;
- list_for_each_entry(eg, group_list, nd) {
+ list_for_each_entry(eg, &list, nd) {
if (events->len > 0)
strbuf_addf(events, ",");
@@ -864,6 +865,8 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
&eg->pctx);
}
}
+
+ list_splice(&list, group_list);
return 0;
}