stat: fix printf format specifier
authorSitsofe Wheeler <sitsofe@yahoo.com>
Mon, 26 Jun 2017 23:38:59 +0000 (00:38 +0100)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Mon, 26 Jun 2017 23:46:54 +0000 (00:46 +0100)
54c05828da413f6b4f9eec800a30624c453a4d90 introduced the printing of the
number of samples but on 64 bit macOS with clang the format specifier
generates warnings like:

stat.c:502:4: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t'
      (aka 'unsigned long long') [-Wformat]
                        (&ts->bw_stat[ddir])->samples);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix this by using the PRIu64 macro.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
stat.c

diff --git a/stat.c b/stat.c
index e1c25a674a6384604fbf975ac7c3ebcbddee85e4..d496e8f968fee2f47d761f4c9e244e6c6ad08744 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -497,13 +497,13 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
                }
 
                log_buf(out, "   bw (%5s/s): min=%5llu, max=%5llu, per=%3.2f%%, "
-                       "avg=%5.02f, stdev=%5.02f, samples=%5lu\n",
+                       "avg=%5.02f, stdev=%5.02f, samples=%" PRIu64 "\n",
                        bw_str, min, max, p_of_agg, mean, dev,
                        (&ts->bw_stat[ddir])->samples);
        }
        if (calc_lat(&ts->iops_stat[ddir], &min, &max, &mean, &dev)) {
                log_buf(out, "   iops        : min=%5llu, max=%5llu, "
-                       "avg=%5.02f, stdev=%5.02f, samples=%5lu\n",
+                       "avg=%5.02f, stdev=%5.02f, samples=%" PRIu64 "\n",
                        min, max, mean, dev, (&ts->iops_stat[ddir])->samples);
        }
 }
@@ -935,12 +935,12 @@ static void show_ddir_status_terse(struct thread_stat *ts,
 
        if (ver == 5) {
                if (bw_stat)
-                       log_buf(out, ";%lu", (&ts->bw_stat[ddir])->samples);
+                       log_buf(out, ";%" PRIu64, (&ts->bw_stat[ddir])->samples);
                else
                        log_buf(out, ";%lu", 0UL);
 
                if (calc_lat(&ts->iops_stat[ddir], &min, &max, &mean, &dev))
-                       log_buf(out, ";%llu;%llu;%f;%f;%lu", min, max,
+                       log_buf(out, ";%llu;%llu;%f;%f;%" PRIu64, min, max,
                                mean, dev, (&ts->iops_stat[ddir])->samples);
                else
                        log_buf(out, ";%llu;%llu;%f;%f;%lu", 0ULL, 0ULL, 0.0, 0.0, 0UL);