public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"mingo@elte.hu" <mingo@elte.hu>,
	"ak@linux.intel.com" <ak@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	"Liang, Kan" <kan.liang@intel.com>,
	David Ahern <dsahern@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH] perf stat: fix per-pkg event reporting bug
Date: Thu, 3 Sep 2015 14:13:10 +0200	[thread overview]
Message-ID: <20150903121310.GG13114@krava.redhat.com> (raw)
In-Reply-To: <CABPqkBSMSBYpcwODbYxQ5n9y7MtT03aMgwO0fQQLQ-A7fdSJkA@mail.gmail.com>

On Thu, Sep 03, 2015 at 05:05:32AM -0700, Stephane Eranian wrote:
> On Thu, Sep 3, 2015 at 5:01 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> > On Thu, Sep 03, 2015 at 04:48:52AM -0700, Stephane Eranian wrote:
> >> On Thu, Sep 3, 2015 at 3:01 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> >> > On Wed, Sep 02, 2015 at 03:17:51PM +0200, Stephane Eranian wrote:
> >> >
> >> > SNIP
> >> >
> >> >> +     /*
> >> >> +      * we do not consider an event that has not run as a good
> >> >> +      * instance to mark a package as used (skip=1). Otherwise
> >> >> +      * we may run into a situation where the first CPU in a package
> >> >> +      * is not running anything, yet the second is, and this function
> >> >> +      * would mark the package as used after the first CPU and would
> >> >> +      * not read the values from the second CPU.
> >> >> +      */
> >> >> +     if (!(vals->run && vals->ena))
> >> >> +             return 0;
> >> >> +
> >> >>       s = cpu_map__get_socket(cpus, cpu);
> >> >>       if (s < 0)
> >> >>               return -1;
> >> >> @@ -235,7 +247,7 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel
> >> >>       static struct perf_counts_values zero;
> >> >>       bool skip = false;
> >> >>
> >> >> -     if (check_per_pkg(evsel, cpu, &skip)) {
> >> >> +     if (check_per_pkg(evsel, aggr, cpu, &skip)) {
> >> >
> >> > should we pass 'count' instead o 'aggr' ?
> >> >
> >> the reason I passed counts_values is in case this function needs to be
> >> called from other places which do
> >> not use aggr mode.
> >
> > sure, but 'aggr' is being computed within process_counter_values
> >
> > process_counter_values gets 'count' argument with values read
> > for given cpu/thread for further processing, and it seems to
> > me that 'count' values should be passed to check_per_pkg
> >
> You do not want to aggregate values, you want to look at the individual events
> for each CPU because you need to look at their run/ena fields.

yes, but for 'count' not 'aggr'

jirka


---
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index f1d83599217b..2d065d065b67 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -247,7 +247,7 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel
 	static struct perf_counts_values zero;
 	bool skip = false;
 
-	if (check_per_pkg(evsel, aggr, cpu, &skip)) {
+	if (check_per_pkg(evsel, count, cpu, &skip)) {
 		pr_err("failed to read per-pkg counter\n");
 		return -1;
 	}

  reply	other threads:[~2015-09-03 12:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 13:17 [PATCH] perf stat: fix per-pkg event reporting bug Stephane Eranian
2015-09-02 20:26 ` Andi Kleen
2015-09-03 10:05   ` Jiri Olsa
2015-09-03 10:01 ` Jiri Olsa
2015-09-03 11:48   ` Stephane Eranian
2015-09-03 12:01     ` Jiri Olsa
2015-09-03 12:05       ` Stephane Eranian
2015-09-03 12:13         ` Jiri Olsa [this message]
2015-09-03 12:16           ` Stephane Eranian
2015-09-03 12:25             ` Jiri Olsa
2015-09-03 16:53               ` Arnaldo Carvalho de Melo
2015-09-03 17:12                 ` Stephane Eranian
2015-09-03 20:42                   ` Arnaldo Carvalho de Melo
2015-09-03 21:37                     ` Stephane Eranian

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=20150903121310.GG13114@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox