Re: [PATCH RFC 1/9] perf metrics: Delete metricgroup_add_iter_data.table

From: Ian Rogers
Date: Fri Jun 30 2023 - 13:23:12 EST


On Wed, Jun 28, 2023 at 3:30 AM John Garry <john.g.garry@xxxxxxxxxx> wrote:
>
> Member metricgroup_add_iter_data.table is only used in
> metricgroup__add_metric_sys_event_iter() as the @table arg to the
> add_metric() call there.
>
> However we only use the @table arg in add_metric() for resolving metrics,
> which is currently not relevant to sys event metrics. As such, don't
> bother passing this @table arg and use iter table instead, which is more
> sane.
>
> Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>

Acked-by: Ian Rogers <irogers@xxxxxxxxxx>

Thanks,
Ian

> ---
> tools/perf/util/metricgroup.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index a6a5ed44a679..4389ccd29fe7 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -798,7 +798,6 @@ struct metricgroup_add_iter_data {
> bool system_wide;
> struct metric *root_metric;
> const struct visited_metric *visited;
> - const struct pmu_metrics_table *table;
> };
>
> static bool metricgroup__find_metric(const char *pmu,
> @@ -1112,7 +1111,7 @@ static int add_metric(struct list_head *metric_list,
> }
>
> static int metricgroup__add_metric_sys_event_iter(const struct pmu_metric *pm,
> - const struct pmu_metrics_table *table __maybe_unused,
> + const struct pmu_metrics_table *table,
> void *data)
> {
> struct metricgroup_add_iter_data *d = data;
> @@ -1123,7 +1122,7 @@ static int metricgroup__add_metric_sys_event_iter(const struct pmu_metric *pm,
>
> ret = add_metric(d->metric_list, pm, d->modifier, d->metric_no_group,
> d->metric_no_threshold, d->user_requested_cpu_list,
> - d->system_wide, d->root_metric, d->visited, d->table);
> + d->system_wide, d->root_metric, d->visited, table);
> if (ret)
> goto out;
>
> @@ -1275,7 +1274,6 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con
> .system_wide = system_wide,
> .has_match = &has_match,
> .ret = &ret,
> - .table = table,
> },
> };
>
> --
> 2.35.3
>