Re: Timing overhead and Linux clock sources

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Greg Smith <greg(at)2ndquadrant(dot)com>, Ants Aasma <ants(dot)aasma(at)eesti(dot)ee>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Timing overhead and Linux clock sources
Date: 2012-08-27 17:18:51
Message-ID: 20120827171851.GP11088@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 27, 2012 at 12:39:02PM -0400, Robert Haas wrote:
> On Sat, Aug 25, 2012 at 10:48 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > On Mon, Aug 20, 2012 at 03:11:51PM -0400, Robert Haas wrote:
> >> On Thu, Aug 16, 2012 at 10:28 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> >> > FYI, I am planning to go ahead and package this tool in /contrib for PG
> >> > 9.3.
> >>
> >> Isn't this exactly what we already did, in 9.2, in the form of
> >> contrib/pg_test_timing?
> >
> > Sorry, not sure how I missed that commit. Anyway, I am attaching a
> > patch for 9.3 that I think improves the output of the tool, plus adds
> > some C comments.
> >
> > The new output has the lowest duration times first:
> >
> > Testing timing overhead for 3 seconds.
> > Per loop time including overhead: 41.31 nsec
> > Histogram of timing durations:
> > < usec % of total count
> > 1 95.87135 69627856
> > 2 4.12759 2997719
> > 4 0.00086 628
> > 8 0.00018 133
> > 16 0.00001 5
> > 32 0.00000 1
> >
> > This should make the output clearer to eyeball for problems --- a good
> > timing has a high percentage on the first line, rather than on the last
> > line.
>
> I guess I'm not sure the output format is an improvement. I wouldn't
> care much one way or the other if we had made this change at the time
> in AS92, but I'm not sure it's really worth breaking compatibility for
> a format that may or may not be any better. The person who wrote the
> original code presumably preferred it way it already is.

He wrote it that way to allow for simpler C code --- he could just start
from 31 and keeping skipping entries until he hit a non-zero.

My format makes it easy to see which line should have the majority of
the entries, e.g. first line should be > 90%. I doubt there are enough
people running this cross-version that consistency in output makes any
difference between major PG versions.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-08-27 17:28:09 Re: spinlocks on HP-UX
Previous Message Bruce Momjian 2012-08-27 17:13:56 Re: unsigned and signed chars in libpq API