mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 10:46:33 +00:00
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 <jolsa@kernel.org> Reviewed-by: Kajol Jain <kjain@linux.ibm.com> Acked-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: John Garry <john.garry@huawei.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Clarke <pc@us.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20200719181320.785305-13-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
acf71b05d1
commit
98461d9dc1
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user