Skip to content

Commit 3f427c1

Browse files
committed
pg_test_timing: Lame hack to work around compiler warning.
Fujii Masao, plus a comment by me. While I'm at it, correctly tabify this chunk of code.
1 parent b75fbe9 commit 3f427c1

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

contrib/pg_test_timing/pg_test_timing.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ test_timing(int32 duration)
107107
instr_time start_time, end_time, temp;
108108

109109
static int64 histogram[32];
110+
char buf[100];
110111

111112
total_time = duration > 0 ? duration * 1000000 : 0;
112113

@@ -150,13 +151,15 @@ test_timing(int32 duration)
150151
printf("%9s: %10s %9s\n", "< usec", "count", "percent");
151152

152153
found = 0;
153-
for (i = 31; i >= 0; i--)
154-
{
155-
if (found || histogram[i])
156-
{
157-
found = 1;
158-
printf("%9ld: %10ld %8.5f%%\n", 1l << i, histogram[i],
159-
(double) histogram[i] * 100 / loop_count);
160-
}
161-
}
154+
for (i = 31; i >= 0; i--)
155+
{
156+
if (found || histogram[i])
157+
{
158+
found = 1;
159+
/* lame hack to work around INT64_FORMAT deficiencies */
160+
snprintf(buf, sizeof(buf), INT64_FORMAT, histogram[i]);
161+
printf("%9ld: %10s %8.5f%%\n", 1l << i, buf,
162+
(double) histogram[i] * 100 / loop_count);
163+
}
164+
}
162165
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy