Skip to content

Commit

Permalink
perf tools: Fix multi-counter stat bug caused by incorrect reading of…
Browse files Browse the repository at this point in the history
… perf.data file header

Brice Goglin reported that only the first result from a
multi-counter perf record --stat run is accurate, the
rest looks bogus.

A silly mistake made us re-read the first attribute for
every recorded attribute.

Reported-by: Brice Goglin <Brice.Goglin@inria.fr>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Tested-by: Brice Goglin <Brice.Goglin@inria.fr>
Cc: paulus@samba.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Aug 9, 2009
1 parent 1953287 commit 1c222bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1c222bc

Please sign in to comment.