HZ = 1000 slows down application

Terry Lambert tlambert2 at mindspring.com
Wed Oct 8 00:20:29 PDT 2003


Luigi Rizzo wrote:
> On Tue, Oct 07, 2003 at 06:17:04PM -0400, akanwar at 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


More information about the freebsd-hackers mailing list