Re: [GIT PULL||RFC 00/11] perf library and regression testing improvements

From: Stephane Eranian
Date: Tue Jan 04 2011 - 09:33:46 EST


No improvement with this patch.

On Tue, Jan 4, 2011 at 3:27 PM, Arnaldo Carvalho de Melo
<acme@xxxxxxxxxxxxx> wrote:
> 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++) {
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/