Home » Questions » Computers [ Ask a new question ]

How to obtain the current number of jiffies since reboot in Linux?

How to obtain the current number of jiffies since reboot in Linux?

Linux's /proc/PID/stat lists several metrics that are measured in jiffies. Is there a way to get the current # of jiffies since reboot? Jiffies I also assume to be seconds times the USER_HZ value.

Asked by: Guest | Views: 391
Total answers/comments: 3
bert [Entry]

"Technically jiffy in computer parlance is the duration of 1 tick of the system timer interrupt. It's not absolute though. For Linux 2.6.13+ on Intel x86 jiffy is 4ms, but can range from 1ms to 10ms depending upon architecture and kernel version.

From the Kernel Timer Systems page:

Historically, the kernel used 100 as the value for HZ, yielding a jiffy interval of 10 ms. With 2.4, the HZ value for i386 was changed to 1000, yeilding a jiffy interval of 1 ms. Recently (2.6.13) the kernel changed HZ for i386 to 250. (1000 was deemed too high).

It lists /proc/timer_list and /proc/timer_stats.

You can activate the timer_stats at boot time, then cat this file to print stats."
bert [Entry]

"In later Linux Kernels you can query /proc/timer_list and find out the number of jiffies since reboot from each CPU that's present within the system. They should always match.

$ grep -E ""^cpu|^jiff"" /proc/timer_list
cpu: 0
jiffies: 4299690231
cpu: 1
jiffies: 4299690231

If you take a look at the code behind timer_list.c the bit that prints the above:

...
...
P_ns(iowait_sleeptime);
P(last_jiffies);
P(next_timer);
P_ns(idle_expires);
SEQ_printf(m, ""jiffies: %Lu\n"",
(unsigned long long)jiffies);

Notice that it's unsigned long long."
Jnscjh [Entry]

buy atorvastatin 20mg generic <a href="https://lipiws.top/">order atorvastatin 10mg online cheap</a> order lipitor 80mg for sale