Skip to content

Commit

Permalink
perf record: Change 'record.samples' type to unsigned long long
Browse files Browse the repository at this point in the history
When run "perf record -e", the number of samples showed up is wrong on some
32 bit systems, i.e. powerpc and arm.

For example, run the below commands on 32 bit powerpc:

  perf probe -x /lib/libc.so.6 malloc
  perf record -e probe_libc:malloc -a ls perf.data
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.036 MB perf.data (13829241621624967218 samples) ]

Actually, "perf script" just shows 21 samples. The number of samples is also
absurd since samples is long type, but it is printed as PRIu64.

Build test ran on x86-64, x86, aarch64, arm, mips, ppc and ppc64.

Signed-off-by: Yang Shi <yang.shi@linaro.org>
Cc: linaro-kernel@lists.linaro.org
Link: http://lkml.kernel.org/r/1443563383-4064-1-git-send-email-yang.shi@linaro.org
[ Bumped the 'hits' var used together with record.samples to 'unsigned long long' too ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Yang Shi authored and Arnaldo Carvalho de Melo committed Oct 2, 2015
1 parent 1a8ac29 commit 9f06519
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct record {
int realtime_prio;
bool no_buildid;
bool no_buildid_cache;
long samples;
unsigned long long samples;
};

static int record__write(struct record *rec, void *bf, size_t size)
Expand Down Expand Up @@ -667,7 +667,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)

auxtrace_snapshot_enabled = 1;
for (;;) {
int hits = rec->samples;
unsigned long long hits = rec->samples;

if (record__mmap_read_all(rec) < 0) {
auxtrace_snapshot_enabled = 0;
Expand Down

0 comments on commit 9f06519

Please sign in to comment.