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

From: David Hagood
Date: Sun Jan 11 2015 - 11:00:44 EST


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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/