Re: [PATCH v1] perf metrics: Remove the "No_group" metric group

From: Liang, Kan
Date: Fri Apr 05 2024 - 10:46:13 EST




On 2024-04-03 12:46 p.m., Ian Rogers wrote:
> Rather than place metrics without a metric group in "No_group" place
> them in a a metric group that is their name. Still allow such metrics
> to be selected if "No_group" is passed, this change just impacts perf
> list.
>
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>

Reviewed-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>

Thanks,
Kan

> ---
> tools/perf/util/metricgroup.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index 79ef6095ab28..6ec083af14a1 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -455,7 +455,7 @@ static int metricgroup__add_to_mep_groups(const struct pmu_metric *pm,
> const char *g;
> char *omg, *mg;
>
> - mg = strdup(pm->metric_group ?: "No_group");
> + mg = strdup(pm->metric_group ?: pm->metric_name);
> if (!mg)
> return -ENOMEM;
> omg = mg;
> @@ -466,7 +466,7 @@ static int metricgroup__add_to_mep_groups(const struct pmu_metric *pm,
> if (strlen(g))
> me = mep_lookup(groups, g, pm->metric_name);
> else
> - me = mep_lookup(groups, "No_group", pm->metric_name);
> + me = mep_lookup(groups, pm->metric_name, pm->metric_name);
>
> if (me) {
> me->metric_desc = pm->desc;