Skip to contentSkip to conversation

tools: perf: consistently use PRIu64 for printing u64 values

PATCH Applied Will Deacon 3 participants 3 messages Apr 23, 2015 – May 1, 2015 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: perf: consistently use PRIu64 for printing u64 values

Building the perf tool for 32-bit ARM results in the following build error due to a combination of an incorrect conversion specifier and compiling with -Werror:

builtin-kmem.c: In function ‘print_page_summary’:
builtin-kmem.c:644:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64’ [-Werror=format=]

           nr_alloc_freed, (total_alloc_freed_bytes) / 1024);
           ^
  builtin-kmem.c:647:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64’ [-Werror=format=]
           (total_page_alloc_bytes - total_alloc_freed_bytes) / 1024);
           ^

cc1: all warnings being treated as errors

This patch fixes the problem by consistently using PRIu64 for printing out u64 values.

Cc Namhyung Kim <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/builtin-kmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-kmem.c +2 -2
index 63ea01349b6e..a1915b430044 100644
@@ -640,9 +640,9 @@ static void print_page_summary(void)
 	       nr_page_frees, total_page_free_bytes / 1024);
 	printf("\n");
 
-	printf("%-30s: %'16lu   [ %'16"PRIu64" KB ]\n", "Total alloc+freed requests",
+	printf("%-30s: %'16"PRIu64"   [ %'16"PRIu64" KB ]\n", "Total alloc+freed requests",
 	       nr_alloc_freed, (total_alloc_freed_bytes) / 1024);
-	printf("%-30s: %'16lu   [ %'16"PRIu64" KB ]\n", "Total alloc-only requests",
+	printf("%-30s: %'16"PRIu64"   [ %'16"PRIu64" KB ]\n", "Total alloc-only requests",
 	       nr_page_allocs - nr_alloc_freed,
 	       (total_page_alloc_bytes - total_alloc_freed_bytes) / 1024);
 	printf("%-30s: %'16lu   [ %'16"PRIu64" KB ]\n", "Total free-only requests",
Signature · 1 line
2.1.4
#1 lore raw

Em Thu, Apr 23, 2015 at 02:40:37PM +0100, Will Deacon escreveu:

Quoted 11 lines

Building the perf tool for 32-bit ARM results in the following build error due to a combination of an incorrect conversion specifier and compiling with -Werror:

builtin-kmem.c: In function ‘print_page_summary’:
builtin-kmem.c:644:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64’ [-Werror=format=]

           nr_alloc_freed, (total_alloc_freed_bytes) / 1024);
           ^
  builtin-kmem.c:647:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64’ [-Werror=format=]
           (total_page_alloc_bytes - total_alloc_freed_bytes) / 1024);
           ^
Quoted 4 lines

cc1: all warnings being treated as errors

This patch fixes the problem by consistently using PRIu64 for printing out u64 values.

Thanks, applied to perf/urgent.

- Arnaldo

#2 lore raw

[tip:perf/urgent] perf kmem: Consistently use PRIu64 for printing u64 values

In reply to Will Deacon
perf kmem: Consistently use PRIu64 for printing u64 values
Commit-ID:  6145c259cd454bcb7a1288f7bbb7b4fbc18175dd
Gitweb:     http://git.kernel.org/tip/6145c259cd454bcb7a1288f7bbb7b4fbc18175dd
Author:     Will Deacon <[email protected]>
AuthorDate: Thu, 23 Apr 2015 14:40:37 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 23 Apr 2015 17:08:22 -0300

perf kmem: Consistently use PRIu64 for printing u64 values

Building the perf tool for 32-bit ARM results in the following build error due to a combination of an incorrect conversion specifier and compiling with -Werror:

builtin-kmem.c: In function ‘print_page_summary’:
builtin-kmem.c:644:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64’ [-Werror=format=]

           nr_alloc_freed, (total_alloc_freed_bytes) / 1024);
           ^
  builtin-kmem.c:647:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64’ [-Werror=format=]
           (total_page_alloc_bytes - total_alloc_freed_bytes) / 1024);
           ^

cc1: all warnings being treated as errors

This patch fixes the problem by consistently using PRIu64 for printing out u64 values.

---
 tools/perf/builtin-kmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-kmem.c +2 -2
index 63ea013..a1915b4 100644
@@ -640,9 +640,9 @@ static void print_page_summary(void)
 	       nr_page_frees, total_page_free_bytes / 1024);
 	printf("\n");
 
-	printf("%-30s: %'16lu   [ %'16"PRIu64" KB ]\n", "Total alloc+freed requests",
+	printf("%-30s: %'16"PRIu64"   [ %'16"PRIu64" KB ]\n", "Total alloc+freed requests",
 	       nr_alloc_freed, (total_alloc_freed_bytes) / 1024);
-	printf("%-30s: %'16lu   [ %'16"PRIu64" KB ]\n", "Total alloc-only requests",
+	printf("%-30s: %'16"PRIu64"   [ %'16"PRIu64" KB ]\n", "Total alloc-only requests",
 	       nr_page_allocs - nr_alloc_freed,
 	       (total_page_alloc_bytes - total_alloc_freed_bytes) / 1024);
 	printf("%-30s: %'16lu   [ %'16"PRIu64" KB ]\n", "Total free-only requests",