Linux system clock tick?

Jul 28, 2006 2 Replies

is there any system calls that you can invoke in order to get the system clock tick? This is for a soft real time application that we would like to develop. Any pointers is appreciated.



getconf/sysconf and "CLK_TCK" might be what you want.

rick jones

The glass is neither half-empty nor half-full. The glass has a leak. The real question is "Can it be patched?" these opinions are mine, all mine; HP might not want them anyway... :) feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

With Kernel 2.6 that is not that easy.

The define value HZ tells you the frequency value (in 1/sec) of the the "virtual" system clock. In kernel space this is the frequency of the Kernel hardware timer and the value the scheduling uses to calculate the time slices. Depending on the architecture the default is something between 100 and 1000. It can be changed in a header file before recompiling the Kernel. This of course needs to be done in a way that the hardware (timer and CPU) can handle it.

In user land the same define HZ can be another value, it actually always is 100. Things like jiffies are appropriately converted between user land and Kernel space by the APIs. This value _can_ be changed but it should not, as many user land software takes HZ = 100 for granted.

-Michael

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required