Re: LWLOCK_STATS

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: LWLOCK_STATS
Date: 2012-01-07 21:48:23
Message-ID: 4F08BDA7.4090203@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 07.01.2012 19:18, Tom Lane wrote:
> Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
>> A couple of weeks ago I wrote a little patch that's similar to
>> LWLOCK_STATS, but it prints out % of wallclock time that is spent
>> acquiring, releasing, or waiting for a lock. I find that more useful
>> than the counters.
>
> I would think that the measurement overhead required to obtain two
> wall-clock values for every LWLock touch would be so high as to render
> any results from this quite suspect.

It's based on sampling. The timer calls a callback every X ms, which
checks if it's waiting for any lock at that moment, and bumps a counter
if so. In LWLockAcquire/Release you just set/reset a global status variable.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2012-01-08 06:10:06 Re: Progress on fast path sorting, btree index creation time
Previous Message Tom Lane 2012-01-07 21:41:42 Re: return values of backend sub-main functions