All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: kan.liang@intel.com
Cc: acme@kernel.org, jolsa@kernel.org, ak@linux.intel.com,
	namhyung@kernel.org, eranian@google.com, adrian.hunter@intel.com,
	dsahern@gmail.com, a.p.zijlstra@chello.nl, mingo@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] perf,tools: get correct cpu id for print_aggr
Date: Tue, 30 Jun 2015 08:46:42 +0200	[thread overview]
Message-ID: <20150630064642.GC6008@krava.redhat.com> (raw)
In-Reply-To: <1435607735-6332-1-git-send-email-kan.liang@intel.com>

On Mon, Jun 29, 2015 at 03:55:34PM -0400, kan.liang@intel.com wrote:
> From: Kan Liang <kan.liang@intel.com>
> 
> print_aggr fails to print per-core/per-socket statistics after commit
> b7f0c203586b ("perf evlist: Propagate cpu maps to evsels in an evlist"),
> if events have differnt cpus. Because in print_aggr, aggr_get_id needs
> index (not cpu id) to find core/pkg id.
> This patch introduced perf_evsel__get_cpumap_index to get the index by
> cpu id for a given event. The index can be used to find correct cpu id
> for print_aggr.
> 

SNIP

> 
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 37e301a..a3ea735 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -708,6 +708,7 @@ static void print_aggr(char *prefix)
>  			nr = 0;
>  			for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) {
>  				cpu2 = perf_evsel__cpus(counter)->map[cpu];
> +				cpu2 = perf_evsel__get_cpumap_index(cpu2, evsel_list->cpus);
>  				s2 = aggr_get_id(evsel_list->cpus, cpu2);
>  				if (s2 != id)
>  					continue;

hum, looks like passing the actual cpu number was introduced in:
  582ec0829b3d perf stat: Fix per-socket output bug for uncore events

also, we already have the index into counter's cpus, why not use those
for getting aggregated id (core,socket).. what do I miss?

thanks,
jirka


---
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 37e301a32f43..47c3c1ffea45 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -694,7 +694,7 @@ static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg)
 static void print_aggr(char *prefix)
 {
 	struct perf_evsel *counter;
-	int cpu, cpu2, s, s2, id, nr;
+	int cpu, s, s2, id, nr;
 	double uval;
 	u64 ena, run, val;
 
@@ -707,8 +707,7 @@ static void print_aggr(char *prefix)
 			val = ena = run = 0;
 			nr = 0;
 			for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) {
-				cpu2 = perf_evsel__cpus(counter)->map[cpu];
-				s2 = aggr_get_id(evsel_list->cpus, cpu2);
+				s2 = aggr_get_id(perf_evsel__cpus(counter), cpu);
 				if (s2 != id)
 					continue;
 				val += perf_counts(counter->counts, cpu, 0)->val;

  parent reply	other threads:[~2015-06-30  6:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29 19:55 [PATCH 1/2] perf,tools: get correct cpu id for print_aggr kan.liang
2015-06-29 19:55 ` [PATCH 2/2] perf,tools: check and re-organize evsel cpu maps kan.liang
2015-06-30 12:14   ` Jiri Olsa
2015-06-30 13:42     ` Liang, Kan
2015-06-30 13:54       ` Jiri Olsa
2015-06-30 14:42         ` acme
2015-07-02 16:08           ` Jiri Olsa
2015-06-30 15:52   ` Stephane Eranian
2015-06-30 16:45     ` Liang, Kan
2015-07-02 16:10       ` Jiri Olsa
2015-06-30  6:46 ` Jiri Olsa [this message]
2015-06-30 13:24   ` [PATCH 1/2] perf,tools: get correct cpu id for print_aggr Liang, Kan

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=20150630064642.GC6008@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.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.