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....@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 majord...@freebsd.org with "unsubscribe freebsd-hackers" in the body of the message