2014-12-02 20:13:14

by Tom Huynh

[permalink] [raw]
Subject: [PATCHv2] perf hists: change print format from lu to PRIu64

nr_events in tools/perf/ui/browsers/hists.c is of type u64, so the print
format (%lu) causes perf report to show 0 event count when running with
32-bit userspace without redirection. This patch fixes that problem by
printing nr_events as PRIu64.

Signed-off-by: Tom Huynh <[email protected]>
---
change since v1: replace %llu with PRIu64

tools/perf/ui/browsers/hists.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index cfb976b..c6d68b8 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1254,7 +1254,7 @@ static int hists__browser_title(struct hists *hists,

nr_samples = convert_unit(nr_samples, &unit);
printed = scnprintf(bf, size,
- "Samples: %lu%c of event '%s', Event count (approx.): %lu",
+ "Samples: %lu%c of event '%s', Event count (approx.): %" PRIu64,
nr_samples, unit, ev_name, nr_events);


--
1.9.1


Subject: [tip:perf/urgent] perf hists browser: Change print format from %lu to %PRIu64

Commit-ID: e641f696ebe4514efac00d1f4a485a06c8e94eea
Gitweb: http://git.kernel.org/tip/e641f696ebe4514efac00d1f4a485a06c8e94eea
Author: Tom Huynh <[email protected]>
AuthorDate: Tue, 2 Dec 2014 11:37:22 -0600
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 9 Dec 2014 09:14:32 -0300

perf hists browser: Change print format from %lu to %PRIu64

The nr_events variable in tools/perf/ui/browsers/hists.c is of type u64,
so the print format (%lu) causes 'perf report' to show 0 event count
when running with 32-bit userspace without redirection.

This patch fixes that problem by printing nr_events as PRIu64.

Signed-off-by: Tom Huynh <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kim Phillips <[email protected]>
Cc: Matt Mullins <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/ui/browsers/hists.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 502daff..e6bb04b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1252,7 +1252,7 @@ static int hists__browser_title(struct hists *hists,

nr_samples = convert_unit(nr_samples, &unit);
printed = scnprintf(bf, size,
- "Samples: %lu%c of event '%s', Event count (approx.): %lu",
+ "Samples: %lu%c of event '%s', Event count (approx.): %" PRIu64,
nr_samples, unit, ev_name, nr_events);