Skip to contentSkip to conversation

perf dlfilter: dlfilter-show-cycles: Fix types for print format

PATCH Superseded Adrian Hunter 1 participant 2 messages Sep 5, 2022 perf events

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Adrian Hunter

author reviewer
#0 lore raw

PATCH 1/1 perf dlfilter: dlfilter-show-cycles: Fix types for print format

Avoid compiler warning about format %llu that expects long long unsigned int but argument has type __u64.

---
 tools/perf/dlfilters/dlfilter-show-cycles.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/dlfilters/dlfilter-show-cycles.c +2 -2
index 9eccc97bff82..6d47298ebe9f 100644
@@ -98,9 +98,9 @@ int filter_event_early(void *data, const struct perf_dlfilter_sample *sample, vo
 static void print_vals(__u64 cycles, __u64 delta)
 {
 	if (delta)
-		printf("%10llu %10llu ", cycles, delta);
+		printf("%10llu %10llu ", (unsigned long long)cycles, (unsigned long long)delta);
 	else
-		printf("%10llu %10s ", cycles, "");
+		printf("%10llu %10s ", (unsigned long long)cycles, "");
 }
 
 int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ctx)
Signature · 1 line
2.25.1
author reviewer
#1 lore raw
Quoted 3 lines · Adrian Hunter

Avoid compiler warning about format %llu that expects long long unsigned int but argument has type __u64.

Fixes c3afd6e50fce ("perf dlfilter: Add dlfilter-show-cycles")
Quoted 21 lines
---
 tools/perf/dlfilters/dlfilter-show-cycles.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/dlfilters/dlfilter-show-cycles.c +2 -2
index 9eccc97bff82..6d47298ebe9f 100644
@@ -98,9 +98,9 @@ int filter_event_early(void *data, const struct perf_dlfilter_sample *sample, vo
 static void print_vals(__u64 cycles, __u64 delta)
 {
 	if (delta)
-		printf("%10llu %10llu ", cycles, delta);
+		printf("%10llu %10llu ", (unsigned long long)cycles, (unsigned long long)delta);
 	else
-		printf("%10llu %10s ", cycles, "");
+		printf("%10llu %10s ", (unsigned long long)cycles, "");
 }
 
 int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ctx)