From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: git@vger.kernel.org
Cc: garima.singh@microsoft.com,
"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [PATCH] test-path-utils: use a C89 compatible format for double printf
Date: Mon, 9 Aug 2021 00:25:51 -0700 [thread overview]
Message-ID: <20210809072551.94391-1-carenas@gmail.com> (raw)
In-Reply-To: <20210809063004.73736-1-carenas@gmail.com>
a62f9d1ace (test-path-utils: offer to run a protectNTFS/protectHFS
benchmark, 2019-09-04) add a tool for testing that uses a double
variable to keep track of time but prints them with "%lf".
while correct for newer C standards, it is not defined in C89 and
it is not needed, since both float and double will be promoted to
double by printf and should therefore use "%f"; change it accordingly.
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
t/helper/test-path-utils.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index 229ed416b0..3d33d2a3e7 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -275,18 +275,18 @@ static int protect_ntfs_hfs_benchmark(int argc, const char **argv)
for (j = 0; j < nr; j++)
verify_path(names[j], file_mode);
end = getnanotime();
- printf("protect_ntfs = %d, protect_hfs = %d: %lfms\n", protect_ntfs, protect_hfs, (end-begin) / (double)1e6);
+ printf("protect_ntfs = %d, protect_hfs = %d: %fms\n", protect_ntfs, protect_hfs, (end-begin) / (double)1e6);
cumul += end - begin;
cumul2 += (end - begin) * (end - begin);
}
m[protect_ntfs][protect_hfs] = cumul / (double)repetitions;
v[protect_ntfs][protect_hfs] = my_sqrt(cumul2 / (double)repetitions - m[protect_ntfs][protect_hfs] * m[protect_ntfs][protect_hfs]);
- printf("mean: %lfms, stddev: %lfms\n", m[protect_ntfs][protect_hfs] / (double)1e6, v[protect_ntfs][protect_hfs] / (double)1e6);
+ printf("mean: %fms, stddev: %fms\n", m[protect_ntfs][protect_hfs] / (double)1e6, v[protect_ntfs][protect_hfs] / (double)1e6);
}
for (protect_ntfs = 0; protect_ntfs < 2; protect_ntfs++)
for (protect_hfs = 0; protect_hfs < 2; protect_hfs++)
- printf("ntfs=%d/hfs=%d: %lf%% slower\n", protect_ntfs, protect_hfs, (m[protect_ntfs][protect_hfs] - m[0][0]) * 100 / m[0][0]);
+ printf("ntfs=%d/hfs=%d: %f%% slower\n", protect_ntfs, protect_hfs, (m[protect_ntfs][protect_hfs] - m[0][0]) * 100 / m[0][0]);
return 0;
}
--
2.33.0.rc1.373.gc715f1a457
next prev parent reply other threads:[~2021-08-09 7:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-09 6:30 [PATCH 0/2] fsmonitor: fixup to avoid warnings from pedantic Carlo Marcelo Arenas Belón
2021-08-09 6:30 ` [PATCH 1/2] fixup! fsmonitor-ipc: create client routines for git-fsmonitor--daemon Carlo Marcelo Arenas Belón
2021-08-09 6:30 ` [PATCH 2/2] fixup! fsmonitor--daemon: implement handle_client callback Carlo Marcelo Arenas Belón
2021-08-09 7:25 ` Carlo Marcelo Arenas Belón [this message]
2021-08-09 14:34 ` [PATCH 0/2] fsmonitor: fixup to avoid warnings from pedantic Jeff Hostetler
2021-08-09 16:49 ` Junio C Hamano
2021-08-10 5:49 ` Carlo Arenas
2021-08-10 13:52 ` Jeff Hostetler
2021-08-10 13:41 ` Jeff Hostetler
2021-08-27 5:37 ` Junio C Hamano
2021-08-27 6:04 ` Carlo Arenas
2021-08-27 17:11 ` Junio C Hamano
2021-08-28 9:45 ` Carlo Arenas
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=20210809072551.94391-1-carenas@gmail.com \
--to=carenas@gmail.com \
--cc=garima.singh@microsoft.com \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.