pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Minor tweaks for pg_test_timing.
Date: Wed, 09 Jul 2025 15:27:00 +0000
Message-ID: <E1uZWhI-005ROz-1h@gemulon.postgresql.org> (raw)

Minor tweaks for pg_test_timing.

Increase the size of the "direct" histogram to 10K elements,
so that we can precisely track loop times up to 10 microseconds.
(Going further than that seems pretty uninteresting, even for
very old and slow machines.)

Relabel "Per loop time" as "Average loop time" for clarity.

Pre-zero the histogram arrays to make sure that they are loaded
into processor cache and any copy-on-write overhead has happened
before we enter the timing loop.  Also use unlikely() to keep
the compiler from thinking that the clock-went-backwards case
is part of the hot loop.  Neither of these hacks made a lot of
difference on my own machine, but they seem like they might help
on some platforms.

Discussion: https://postgr.es/m/be0339cc-1ae1-4892-9445-8e6d8995a44d@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9dcc7641444f6a99269b446ee3a45a080b6ceea3

Modified Files
--------------
doc/src/sgml/ref/pgtesttiming.sgml      |  2 +-
src/bin/pg_test_timing/pg_test_timing.c | 18 ++++++++++++++----
2 files changed, 15 insertions(+), 5 deletions(-)



Message-ID: <E1uZWhI-005ROz-1h@gemulon.postgresql.org>
Permalink:  ../E1uZWhI-005ROz-1h@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uZWhI-005ROz-1h@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Minor tweaks for pg_test_timing.
  In-Reply-To: <E1uZWhI-005ROz-1h@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox