lkml.org 
[lkml]   [2020]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 13/18] perf metric: Add events for the current group
Date
There's no need to iterate the whole list of groups,
when adding new events. The currently created group
is the one we want to add.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/metricgroup.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 8cbcc5e05fef..66f25362702d 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -811,17 +811,19 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
if (ret)
return ret;

- list_for_each_entry(eg, group_list, nd) {
- if (events->len > 0)
- strbuf_addf(events, ",");
+ if (events->len > 0)
+ strbuf_addf(events, ",");

- if (eg->has_constraint) {
- metricgroup__add_metric_non_group(events,
- &eg->pctx);
- } else {
- metricgroup__add_metric_weak_group(events,
- &eg->pctx);
- }
+ /*
+ * Even if we add multiple groups through the runtime
+ * param, they share same events.
+ */
+ if (eg->has_constraint) {
+ metricgroup__add_metric_non_group(events,
+ &eg->pctx);
+ } else {
+ metricgroup__add_metric_weak_group(events,
+ &eg->pctx);
}
return 0;
}
--
2.25.4
\
 
 \ /
  Last update: 2020-07-12 15:28    [W:0.565 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site