linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Riccardo Mancini <rickyman7@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/1] perf bench evlist-open-close: Use PRIu64 with u64 to fix build on 32-bit architectures
Date: Mon, 30 Aug 2021 15:49:49 -0300	[thread overview]
Message-ID: <YS0oTcA9Zuy8Wjm9@kernel.org> (raw)

Hi Riccardo,

	I'm applying this one here, please take this into account in the
future when using u64 in printf-like routines.

- Arnaldo

From: Arnaldo Carvalho de Melo <acme@redhat.com>

  73     9.00 ubuntu:18.04-x-powerpc        : FAIL gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
    bench/evlist-open-close.c: In function 'bench_evlist_open_close__run':
    bench/evlist-open-close.c:173:12: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'u64 {aka long long unsigned int}' [-Werror=format=]
       pr_debug("Iteration %d took:\t%ldus\n", i, runtime_us);
                ^
    bench/../util/debug.h:18:21: note: in definition of macro 'pr_fmt'
     #define pr_fmt(fmt) fmt
                         ^~~
    bench/evlist-open-close.c:173:3: note: in expansion of macro 'pr_debug'
       pr_debug("Iteration %d took:\t%ldus\n", i, runtime_us);
       ^~~~~~~~
    cc1: all warnings being treated as errors
    /git/perf-5.14.0/tools/build/Makefile.build:139: recipe for target 'bench' failed

Cc: Riccardo Mancini <rickyman7@gmail.com>
Fixes: 4241eabf59d5b7e9 ("perf bench: Add benchmark for evlist open/close operations")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/evlist-open-close.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/bench/evlist-open-close.c b/tools/perf/bench/evlist-open-close.c
index 674cb14cbaa9ef2c..83e9897c64a13179 100644
--- a/tools/perf/bench/evlist-open-close.c
+++ b/tools/perf/bench/evlist-open-close.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
@@ -170,7 +171,7 @@ static int bench_evlist_open_close__run(char *evstr)
 		update_stats(&time_stats, runtime_us);
 
 		evlist__delete(evlist);
-		pr_debug("Iteration %d took:\t%ldus\n", i, runtime_us);
+		pr_debug("Iteration %d took:\t%" PRIu64 "us\n", i, runtime_us);
 	}
 
 	time_average = avg_stats(&time_stats);
-- 
2.31.1


                 reply	other threads:[~2021-08-30 18:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=YS0oTcA9Zuy8Wjm9@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rickyman7@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).