Skip to contentSkip to conversation

On a tickless kernel, how to convert jiffies into a real time

DISCUSSION David Hagood 1 participant 1 message Jan 11, 2015

lore
Share & tools
lore
#0 lore raw

On a kernel configured for full tickless operation, how can a user space program take a value reported by the kernel in jiffies and convert it into a meaningful wall clock time?

I am asking specifically in terms of parsing the output from /proc/net/xt_recent/*, but there are other places where user space gets jiffies from the kernel, so this is a bit more generic.

I have seen several suggestions of just reading the parameters via sysconf(_SC_CLK_TCK), but that does not work - that reports 1000 jiffies per second, but that is NOT the value that is being used by the kernel - as best as I can tell by inspection, it seems to be running somewhere around 2145 ticks per second, and seems to vary based upon what the system is doing. If the value does indeed vary, then there's really no way to compute a jiffies value to wall clock time save at the instant that jiffies value is captured.