Re: gettimeofday() goes backwards on FreeBSD 4.9

From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Darcy Buskermolen <darcy(at)wavefire(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: gettimeofday() goes backwards on FreeBSD 4.9
Date: 2003-11-29 02:04:31
Message-ID: 20031128220142.U99096@ganymede.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 28 Nov 2003, Marc G. Fournier wrote:

> On Fri, 28 Nov 2003, Tom Lane wrote:
>
> > "Marc G. Fournier" <scrappy(at)postgresql(dot)org> writes:
> > > I'm suspecting that the issue is amplified by load on the server itself
> >
> > That would fit right in with my idea that the failure occurs when the
> > process loses its timeslice partway through gettimeofday(). Heavier
> > load would presumably make it more likely to lose the CPU.
>
> I'm posting to the freebsd lists about it, see if they have anything to
> say ...

Just got my first response on this, and, in fact, this is 'acceptable
behaviour' to a certain extent ... there is a kernel tuneable called
kern.timecounter.method, that is either 1 or 0:

0 sacrifice precision in favor of faster code execution

1 return the more precise time (the same as calling microtime() or
nanotime()).

The intent of the getmicrotime() and getnanotime() functions is to
enforce the user's preference for timer accuracy versus execution time.

Now, reading the man page, there seems to be a 'microtime' vs
'getmicrotime' function ... these might be preferable to using
gettimeofday on FreeBSD?

----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy(at)hub(dot)org Yahoo!: yscrappy ICQ: 7615664

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2003-11-29 02:06:01 cvs head configure broken for --with-krb5 on RH9
Previous Message Nigel J. Andrews 2003-11-29 01:46:30 Re: gettimeofday() goes backwards on FreeBSD 4.9