All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org,
	Kan Liang <kan.liang@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 1/2] perf stat: Reset aggr stats for each run
Date: Sat, 17 Jun 2023 20:45:10 +0200	[thread overview]
Message-ID: <ZI3/Nmch0ufFJ7Dp@krava> (raw)
In-Reply-To: <20230616073211.1057936-1-namhyung@kernel.org>

On Fri, Jun 16, 2023 at 12:32:10AM -0700, Namhyung Kim wrote:
> When it runs multiple times with -r option, it missed to reset the
> aggregation counters and the values were added up.  The aggregation
> count has the values to be printed in the end.  It should reset the
> counters at the beginning of each run.  But the current code does that
> only when -I/--interval-print option is given.
> 
> Fixes: 91f85f98da7a ("perf stat: Display event stats using aggr counts")
> Reported-by: Jiri Olsa <jolsa@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/builtin-stat.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index c87c6897edc9..e549862f90f0 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -725,6 +725,8 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
>  			all_counters_use_bpf = false;
>  	}
>  
> +	evlist__reset_aggr_stats(evsel_list);
> +

would it be better to call this below before read_counters call,
together with the other counts setup calls?

jirka

>  	evlist__for_each_cpu(evlist_cpu_itr, evsel_list, affinity) {
>  		counter = evlist_cpu_itr.evsel;
>  
> -- 
> 2.41.0.162.gfafddb0af9-goog
> 

  parent reply	other threads:[~2023-06-17 18:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16  7:32 [PATCH 1/2] perf stat: Reset aggr stats for each run Namhyung Kim
2023-06-16  7:32 ` [PATCH 2/2] perf stat: Show average value on multiple runs Namhyung Kim
2023-06-17 18:45   ` Jiri Olsa
2023-06-19 20:00     ` Namhyung Kim
2023-06-17 18:45 ` Jiri Olsa [this message]
2023-06-19 19:53   ` [PATCH 1/2] perf stat: Reset aggr stats for each run Namhyung Kim

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=ZI3/Nmch0ufFJ7Dp@krava \
    --to=olsajiri@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=irogers@google.com \
    --cc=kan.liang@linux.intel.com \
    --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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.