From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org,
Frederic Weisbecker <fweisbec@gmail.com>,
Han Pingtian <phan@redhat.com>, Mike Galbraith <efault@gmx.de>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Tom Zanussi <tzanussi@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
mingo@elte.hu
Subject: Re: [GIT PULL||RFC 00/11] perf library and regression testing improvements
Date: Tue, 4 Jan 2011 12:27:15 -0200 [thread overview]
Message-ID: <20110104142715.GD19989@ghostprotocols.net> (raw)
In-Reply-To: <20110104141958.GC19989@ghostprotocols.net>
Em Tue, Jan 04, 2011 at 12:19:58PM -0200, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Jan 04, 2011 at 03:09:08PM +0100, Stephane Eranian escreveu:
> > Arnaldo,
> > Looks like what's wrong is not ps but count:
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread 0x7f96967fd6e0 (LWP 5156)]
> > 0x0000000000412b58 in read_counter_aggr (counter=0x7d4820) at builtin-stat.c:206
> > 206 update_stats(&ps->res_stats[i], count[i]);
> > (gdb) print ps
> > $1 = (struct perf_stat *) 0x7d48a0
> > (gdb) print *ps
> > $2 = {res_stats = {{n = 0, mean = 0, M2 = 0}, {n = 0, mean = 0, M2 =
> > 0}, {n = 0, mean = 0, M2 = 0}}}
> > (gdb) print count
> > $3 = (u64 *) 0x12
> > (gdb) print *count
> > Cannot access memory at address 0x12
> > (gdb) print count
> > $4 = (u64 *) 0x12
>
> Count is:
>
> u64 *count = counter->counts->aggr.values;
Can you try with this patch?
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 02b2d80..7876b11 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -196,12 +196,14 @@ static inline int nsec_counter(struct perf_evsel *evsel)
static int read_counter_aggr(struct perf_evsel *counter)
{
struct perf_stat *ps = counter->priv;
- u64 *count = counter->counts->aggr.values;
+ u64 *count;
int i;
if (__perf_evsel__read(counter, cpus->nr, threads->nr, scale) < 0)
return -1;
+ count = counter->counts->aggr.values;
+
for (i = 0; i < 3; i++)
update_stats(&ps->res_stats[i], count[i]);
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d337761..26962ea 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -89,8 +89,12 @@ int __perf_evsel__read(struct perf_evsel *evsel,
{
size_t nv = scale ? 3 : 1;
int cpu, thread;
- struct perf_counts_values *aggr = &evsel->counts->aggr, count;
+ struct perf_counts_values *aggr, count;
+ if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, ncpus) < 0)
+ return -ENOMEM;
+
+ aggr = &evsel->counts->aggr;
aggr->val = 0;
for (cpu = 0; cpu < ncpus; cpu++) {
next prev parent reply other threads:[~2011-01-04 14:27 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-04 3:48 [GIT PULL||RFC 00/11] perf library and regression testing improvements Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 01/11] perf tools: Introduce event selectors Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 02/11] perf evsel: Adopt MATCH_EVENT macro from 'stat' Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 03/11] perf util: Move do_read from session to util Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 04/11] perf evsel: Delete the event selectors at exit Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 05/11] perf evsel: Steal the counter reading routines from stat Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 06/11] perf evsel: Introduce per cpu and per thread open helpers Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 07/11] perf tools: Refactor cpumap to hold nr and the map Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 08/11] perf tools: Refactor all_tids " Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 09/11] perf evsel: Use {cpu,thread}_map to shorten list of parameters Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 10/11] perf evsel: Auto allocate resources needed for some methods Arnaldo Carvalho de Melo
2011-01-04 3:48 ` [PATCH 11/11] perf test: Add test for counting open syscalls Arnaldo Carvalho de Melo
2011-01-04 7:16 ` [GIT PULL||RFC 00/11] perf library and regression testing improvements Ingo Molnar
2011-01-04 13:59 ` Stephane Eranian
2011-01-04 14:03 ` Arnaldo Carvalho de Melo
2011-01-04 14:09 ` Stephane Eranian
2011-01-04 14:19 ` Arnaldo Carvalho de Melo
2011-01-04 14:27 ` Arnaldo Carvalho de Melo [this message]
2011-01-04 14:33 ` Stephane Eranian
2011-01-04 14:36 ` Arnaldo Carvalho de Melo
2011-01-04 14:46 ` Stephane Eranian
2011-01-04 14:59 ` Stephane Eranian
2011-01-04 15:10 ` Stephane Eranian
2011-01-04 15:24 ` Arnaldo Carvalho de Melo
2011-01-04 15:30 ` Stephane Eranian
2011-01-04 15:30 ` Stephane Eranian
2011-01-04 15:30 ` Arnaldo Carvalho de Melo
2011-01-04 14:29 ` Stephane Eranian
2011-01-04 14:34 ` Arnaldo Carvalho de Melo
2011-01-04 14:12 ` Arnaldo Carvalho de Melo
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=20110104142715.GD19989@ghostprotocols.net \
--to=acme@infradead.org \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=phan@redhat.com \
--cc=tglx@linutronix.de \
--cc=tzanussi@gmail.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