Skip to content

Commit 82e4297

Browse files
Add microsecs/op display to pg_test_fsync utility
e.g. fsync 2103.613 ops/sec ( 475 microsecs/op) Peter Geoghegan
1 parent bc43331 commit 82e4297

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

contrib/pg_test_fsync/pg_test_fsync.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626
#define LABEL_FORMAT " %-32s"
2727
#define NA_FORMAT "%18s"
28-
#define OPS_FORMAT "%9.3f ops/sec"
28+
#define OPS_FORMAT "%9.3f ops/sec (%6.f microsecs/op)"
29+
#define USECS_SEC 1000000
2930

3031
/* These are macros to avoid timing the function call overhead. */
3132
#ifndef WIN32
@@ -568,8 +569,9 @@ print_elapse(struct timeval start_t, struct timeval stop_t, int ops)
568569
double total_time = (stop_t.tv_sec - start_t.tv_sec) +
569570
(stop_t.tv_usec - start_t.tv_usec) * 0.000001;
570571
double per_second = ops / total_time;
572+
double avg_op_time_us = (total_time / ops) * USECS_SEC;
571573

572-
printf(OPS_FORMAT "\n", per_second);
574+
printf(OPS_FORMAT "\n", per_second, avg_op_time_us);
573575
}
574576

575577
#ifndef WIN32

doc/src/sgml/pgtestfsync.sgml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@
3030
<application>pg_test_fsync</> is intended to give you a reasonable
3131
idea of what the fastest <xref linkend="guc-wal-sync-method"> is on your
3232
specific system,
33-
as well as supplying diagnostic information in the event of an
34-
identified I/O problem. However, differences shown by <application>pg_test_fsync</application>
35-
might not make any difference in real database throughput, especially
36-
since many database servers are not speed-limited by their transaction
37-
logs.
33+
as well as supplying diagnostic information in the event of an identified I/O
34+
problem. However, differences shown by
35+
<application>pg_test_fsync</application> might not make any significant
36+
difference in real database throughput, especially since many database servers
37+
are not speed-limited by their transaction logs.
38+
<application>pg_test_fsync</application> reports average file sync operation
39+
time in microseconds for each wal_sync_method, which can be used to inform
40+
efforts to optimize the value of <varname>commit_delay</varname>.
3841
</para>
3942
</refsect1>
4043

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