what is the best of replacing ClockCycles() so that I can still get a fairly high resolution timer on a x86 SMP system? I don’t want to “lock” the thread to a single CPU just to use ClockCycles(). I need a 1/4 of msec resolution for my timer. Thanks
If you have control over the processor you are using , check the spec, some guaranty the counter increments the same on every core.
You could use the RTC counter (clock) I think it can be program to generate interrupt at various rate, plenty of code on the web.
Or use ClockPeriod to change the tick from 1ms to .250ms.
do you think it would be a big penalty on the kernel if I change the tick from 1ms to 0.1ms? how do I know or detect an optimal tick resolution for my HW/system?
It’s all about overhead,if you go from 1ms to .1ms that means there will be 10000 interrupts per seconds instead of 1000. Depending on your processor that can be a lot.
If you have performance requirement for your system, then just check if by doing that you can still mean them. It’s as simple as that…
Usually there are other timers available in hardware that you just have to program. Check your hardware documentation or talk to the hardware vendor. Much better than creating extra overhead by decreasing the tick size.
got it, thanks the all your input.