perf stat: Convert perf_stat_evsel.res_stats array
authorNamhyung Kim <namhyung@kernel.org>
Fri, 30 Sep 2022 20:21:04 +0000 (13:21 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 6 Oct 2022 11:03:53 +0000 (08:03 -0300)
It uses only one member, no need to have it as an array.

Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20220930202110.845199-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/stat-display.c
tools/perf/util/stat.c
tools/perf/util/stat.h

index b82844cb0ce77845ec1480def525e841fa65acb6..234491f43c36b9c786e4929c85f98c863634012c 100644 (file)
@@ -67,7 +67,7 @@ static void print_noise(struct perf_stat_config *config,
                return;
 
        ps = evsel->stats;
-       print_noise_pct(config, stddev_stats(&ps->res_stats[0]), avg);
+       print_noise_pct(config, stddev_stats(&ps->res_stats), avg);
 }
 
 static void print_cgroup(struct perf_stat_config *config, struct evsel *evsel)
index cef943377ad7f4d2f3809b37a84c8823671d8f67..8d27ba77f8ab07c772733058e5d553baa631342d 100644 (file)
@@ -132,12 +132,9 @@ static void perf_stat_evsel_id_init(struct evsel *evsel)
 
 static void evsel__reset_stat_priv(struct evsel *evsel)
 {
-       int i;
        struct perf_stat_evsel *ps = evsel->stats;
 
-       for (i = 0; i < 3; i++)
-               init_stats(&ps->res_stats[i]);
-
+       init_stats(&ps->res_stats);
        perf_stat_evsel_id_init(evsel);
 }
 
@@ -437,7 +434,7 @@ int perf_stat_process_counter(struct perf_stat_config *config,
        struct perf_counts_values *aggr = &counter->counts->aggr;
        struct perf_stat_evsel *ps = counter->stats;
        u64 *count = counter->counts->aggr.values;
-       int i, ret;
+       int ret;
 
        aggr->val = aggr->ena = aggr->run = 0;
 
@@ -455,8 +452,7 @@ int perf_stat_process_counter(struct perf_stat_config *config,
                evsel__compute_deltas(counter, -1, -1, aggr);
        perf_counts_values__scale(aggr, config->scale, &counter->counts->scaled);
 
-       for (i = 0; i < 3; i++)
-               update_stats(&ps->res_stats[i], count[i]);
+       update_stats(&ps->res_stats, *count);
 
        if (verbose > 0) {
                fprintf(config->output, "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n",
index 72713b344b7929e4e53a8800eec1823c1c861fb3..3eba38a1a1499280fb6b06d002e409daec40dad7 100644 (file)
@@ -43,7 +43,7 @@ enum perf_stat_evsel_id {
 };
 
 struct perf_stat_evsel {
-       struct stats             res_stats[3];
+       struct stats             res_stats;
        enum perf_stat_evsel_id  id;
        u64                     *group_data;
 };