Re: [PATCH] perf tools: Fix reading of perf.data file header

From: Brice Goglin
Date: Thu Aug 06 2009 - 15:03:02 EST


$ /mnt/scratch/bgoglin/cpunode/linux-2.6.31/tools/perf/perf report -D |
grep _READ | sort -k5
0x8bb8 [0x30]: PERF_EVENT_READ: 6268 6268 raw 0x1000001e0 494628
0x8fc0 [0x30]: PERF_EVENT_READ: 6268 6268 raw 0x1000002e0 209113
0x9698 [0x30]: PERF_EVENT_READ: 6268 6268 raw 0x1000004e0 307215
0x9cf8 [0x30]: PERF_EVENT_READ: 6268 6268 raw 0x1000008e0 9203221
0x8a08 [0x30]: PERF_EVENT_READ: 6268 6269 raw 0x1000001e0 9210788
0x9020 [0x30]: PERF_EVENT_READ: 6268 6269 raw 0x1000002e0 302344
0x9608 [0x30]: PERF_EVENT_READ: 6268 6269 raw 0x1000004e0 198705
0x9d28 [0x30]: PERF_EVENT_READ: 6268 6269 raw 0x1000008e0 473471
[...]

Now I know which thread actually reads from where.
Looks like we're good to go now! thanks a lot Peter!

Tested-by: Brice Goglin <Brice.Goglin@xxxxxxxx>

Brice



Peter Zijlstra wrote:
> Subject: perf tools: Fix reading of perf.data file header
>
> A silly mistake made us re-read the first attribute for every attribute.
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> ---
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 450384b..95a44bc 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -213,9 +213,10 @@ struct perf_header *perf_header__read(int fd)
>
> for (i = 0; i < nr_attrs; i++) {
> struct perf_header_attr *attr;
> - off_t tmp = lseek(fd, 0, SEEK_CUR);
> + off_t tmp;
>
> do_read(fd, &f_attr, sizeof(f_attr));
> + tmp = lseek(fd, 0, SEEK_CUR);
>
> attr = perf_header_attr__new(&f_attr.attr);
>
>
>
>

--
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/