Way to get current tick number in kernel?

mdf at FreeBSD.org mdf at FreeBSD.org
Sun Oct 2 18:26:26 UTC 2011


2011/10/2 Lev Serebryakov <lev at freebsd.org>:
> Hello, Freebsd-hackers.
>
>  What should I use to measure short intervals of time between events
> in kernel? I don't need any "time" in means of, for example, time(3)
> API, but some monotonically and uniformly increasing counter with
> known frequency. As cheap as possible, without complex calculations :)

There are several global variables that may suffice.

'ticks' is the current tick value.
'time_second' is the current time in seconds, but this is adjusted
when the system time is changed.
'time_uptime' is the current uptime in seconds and is the base upon
which time_second is computed, depending on the system clock.

Cheers,
matthew


More information about the freebsd-hackers mailing list