public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Yang Shi <yang.shi@linaro.org>,
	linaro-kernel@lists.linaro.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 09/10] perf record: Change 'record.samples' type to unsigned long long
Date: Fri,  2 Oct 2015 17:25:44 -0300	[thread overview]
Message-ID: <1443817545-8551-10-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1443817545-8551-1-git-send-email-acme@kernel.org>

From: Yang Shi <yang.shi@linaro.org>

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>
---
 tools/perf/builtin-record.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 5e01c070dbf2..24ace2f318c1 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -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)
@@ -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;
-- 
2.1.0


  parent reply	other threads:[~2015-10-02 20:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 20:25 [GIT PULL 00/10] perf/cover improvements and fixes Arnaldo Carvalho de Melo
2015-10-02 20:25 ` [PATCH 01/10] perf record: Allocate area for sample_id_hdr in a synthesized comm event Arnaldo Carvalho de Melo
2015-10-02 20:25 ` [PATCH 02/10] perf top: Fix unresolved comm when -s comm is used Arnaldo Carvalho de Melo
2015-10-02 20:25 ` [PATCH 03/10] perf top: Register idle thread Arnaldo Carvalho de Melo
2015-10-02 20:25 ` [PATCH 04/10] perf report: Fix a bug on "--call-graph none" option Arnaldo Carvalho de Melo
2015-10-02 20:25 ` [PATCH 05/10] perf callchain: Allow for max_stack greater than PERF_MAX_STACK_DEPTH Arnaldo Carvalho de Melo
2015-10-02 20:25 ` [PATCH 06/10] perf list: Do event name substring search as last resort when no events found Arnaldo Carvalho de Melo
2015-10-02 20:25 ` [PATCH 07/10] perf list: Honour 'event_glob' whem printing selectable PMUs Arnaldo Carvalho de Melo
2015-10-02 20:25 ` [PATCH 08/10] perf probe: Allow probing on kmodules without dwarf Arnaldo Carvalho de Melo
2015-10-02 20:25 ` Arnaldo Carvalho de Melo [this message]
2015-10-02 20:25 ` [PATCH 10/10] perf stat: Reduce min --interval-print to 10ms Arnaldo Carvalho de Melo
2015-10-03  6:32 ` [GIT PULL 00/10] perf/cover improvements and fixes Ingo Molnar

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=1443817545-8551-10-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=yang.shi@linaro.org \
    /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