Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Oct 2003 00:19:40 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Luigi Rizzo <rizzo@icir.org>
Cc:        "akanwar@digitarchy.com" <akanwar@digitarchy.com>
Subject:   Re: HZ = 1000 slows down application
Message-ID:  <3F83BA8C.7149BB52@mindspring.com>
References:  <410-22003102722174477@M2W077.mail2web.com> <20031007163552.A92652@xorpc.icir.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Luigi Rizzo wrote:
> On Tue, Oct 07, 2003 at 06:17:04PM -0400, akanwar@digitarchy.com wrote:
> > We did some intensive profiling of our application. It does not seem like
> > we are depending on clock ticks for any calculations.
> >
> > On the other hand we notice that our slow iterations happen almost at the
> > same instant as "microuptime went backward" messages in the system log. We
> 
> if this is the case, probably your code at some point computes a
> time difference which turns out negative (or if it is unsigned, it
> becomes very very large) upon those events, thus causing some loop
> to explode.
> It should be easy to check if this is the case, and just ignore
> those outliers rather than trying to figure out why the clock
> goes backward. I used to see the same "microuptime went backwards"
> msg on some of my 400MHz boxes, even without NTP enabled.
> Maybe a buggy timer, not sure which timecounter was used on that
> box (i read some time ago that the cpu on the soekris4801 has a
> weird TSC implementation where the upper 32 bits change when the
> lower 32 bits are 0xfffffffd, who knows what other bugs might be
> in other hardware...)

FWIW: Internally, MacOS X supports "monotime", which is a
monotonically increasing time counter, guaranteed to not go
backwards.  That avoids problems exactly like what you are
describing.  FreeBSD should consider supporting a "monotime".

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F83BA8C.7149BB52>