Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jul 1999 20:24:58 +0200 (SAT)
From:      John Hay <jhay@mikom.csir.co.za>
To:        jen@vulture.dmem.strath.ac.uk (Jennifer Clark)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Advice on deriving accurate time values from the kernel?
Message-ID:  <199907151824.UAA70423@zibbi.mikom.csir.co.za>
In-Reply-To: <378E10C4.9AD7979E@vulture.dmem.strath.ac.uk> from Jennifer Clark at "Jul 15, 1999 05:48:04 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
If you only want to timestamp events and not generate the event, you
can use microtime() or nanotime(). On a 400MHz PII non-SMP you should
get 2.5 ns resolution with nanotime(). On a normal kernel with
kern.timecounter.method at the default of 0, the get... versions
give you time at the last tick or even worse, so they are no good
for that.

John
-- 
John Hay -- John.Hay@mikom.csir.co.za

> Hi,
> 
> I am in the process of developing a device driver for the purpose of
> stepper motor control. The timing of each pulse is determined by
> external timing hardware on an I/O board, which will fire an interrupt
> after the time requested. Using this method, I am able to generate
> streams of pulses at approximately 5000Hz on a Pentium II 400MHz system.
> 
> Everything seems to be working well, but I'd really like to gather some
> accurate timing data in order to derive some statistics to from the
> system. Intuition tells me I'll need a clock with a tick rate of at
> least 20000 Hz to derive this.
> 
> So, is such a thing available in the kernel? I've searched through
> various mailing list archives and have found reference to the "HZ"
> option to the kernel, which works to a point. However, it is not ideal
> as setting HZ to high values generates far too much kernel overhead.
> Also being considered is additional external timing hardware, but this
> is something I'd rather avoid for many reasons.
> 
> What I am after is not a "timer" as such - all I need to do is derive a
> time value at an initial time, and a subsequent value at a later time.
> I've used "getmicrouptime", but this appears dependent on the "Hz"
> option, and as such is of limited use.
> 
> I've just had some input from a colleauge who has suggested using the
> Pentium profiling registers, which we are currently investigating...
> 
> Any advice gratefully received,
> 
> --
> Jennifer Clark
> http://telepresence.dmem.strath.ac.uk
> http://www.crmjewellery.co.uk
> http://www.furniturenet.co.uk



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907151824.UAA70423>