linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@arm.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-perf-users@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Leo Yan <leo.yan@linaro.org>,
	Zhengjun Xing <zhengjun.xing@linux.intel.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH 1/6] perf stat: Convert perf_stat_evsel.res_stats array
Date: Wed, 28 Sep 2022 11:33:56 +0100	[thread overview]
Message-ID: <55e74adc-0001-f08e-de10-913f36469da8@arm.com> (raw)
In-Reply-To: <20220926200757.1161448-2-namhyung@kernel.org>



On 26/09/2022 21:07, Namhyung Kim wrote:
> It uses only one member, no need to have it as an array.
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/util/stat-display.c |  2 +-
>  tools/perf/util/stat.c         | 10 +++-------
>  tools/perf/util/stat.h         |  2 +-
>  3 files changed, 5 insertions(+), 9 deletions(-)
> 

Reviewed-by: James Clark <james.clark@arm.com>

> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index b82844cb0ce7..234491f43c36 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -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)
> diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
> index ce5e9e372fc4..6bcd3dc32a71 100644
> --- a/tools/perf/util/stat.c
> +++ b/tools/perf/util/stat.c
> @@ -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);
>  }
>  
> @@ -440,7 +437,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;
>  
> @@ -458,8 +455,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",
> diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
> index 72713b344b79..3eba38a1a149 100644
> --- a/tools/perf/util/stat.h
> +++ b/tools/perf/util/stat.h
> @@ -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;
>  };

  reply	other threads:[~2022-09-28 10:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 20:07 [PATCHSET 0/6] perf stat: Small random cleanups (v1) Namhyung Kim
2022-09-26 20:07 ` [PATCH 1/6] perf stat: Convert perf_stat_evsel.res_stats array Namhyung Kim
2022-09-28 10:33   ` James Clark [this message]
2022-09-26 20:07 ` [PATCH 2/6] perf stat: Don't call perf_stat_evsel_id_init() repeatedly Namhyung Kim
2022-09-28 10:41   ` James Clark
2022-09-26 20:07 ` [PATCH 3/6] perf stat: Rename saved_value->cpu_map_idx Namhyung Kim
2022-09-28 10:50   ` James Clark
2022-09-28 23:56     ` Namhyung Kim
2022-09-29  1:58       ` Ian Rogers
2022-09-26 20:07 ` [PATCH 4/6] perf stat: Use thread map index for shadow stat Namhyung Kim
2022-09-28 14:49   ` James Clark
2022-09-29  2:10   ` Ian Rogers
2022-09-29  4:55     ` Namhyung Kim
2022-09-26 20:07 ` [PATCH 5/6] perf stat: Kill unused per-thread runtime stats Namhyung Kim
2022-09-28 14:51   ` James Clark
2022-09-26 20:07 ` [PATCH 6/6] perf stat: Don't compare runtime stat for shadow stats Namhyung Kim
2022-09-28 14:52   ` James Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55e74adc-0001-f08e-de10-913f36469da8@arm.com \
    --to=james.clark@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=zhengjun.xing@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).