pgsql: Track spinlock delay in microsecond granularity.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Track spinlock delay in microsecond granularity.
Date: 2013-06-28 09:46:29
Message-ID: E1UsVG9-0004s8-Vm@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Track spinlock delay in microsecond granularity.

On many platforms the OS will round the sleep time to millisecond
resolution, but there is no reason for us to pre-emptively round the
argument to pg_usleep.

When the delay was measured in milliseconds and started from 1 ms, it
sometimes took many attempts until the logic that increases the delay by
multiplying with a random value between 1 and 2 actually managed to bump it
from 1 ms to 2 ms. That lead to a sequence of 1 ms waits until the delay
started to increase. This wasn't really a problem but it looked odd if you
observed the waits. There is no measurable difference in performance, but
it's more readable this way.

Jeff Janes

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/9e0bc7c1e84d7fffb93130f2b7d079a0853329ed

Modified Files
--------------
src/backend/storage/lmgr/s_lock.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2013-06-28 13:34:36 pgsql: Define Trap and TrapMacro even in non-cassert builds.
Previous Message pgsql 2013-06-28 01:13:29 pgsql: Tag refs/tags/REL9_3_BETA2 was created