Here's an older thread discussing jiffies, answering the question "what are they?"
From: sting sting [email blocked] To: linux-kernel Subject: short explanation -jiffies (newbie) Date: Thu, 16 Oct 2003 21:55:22 +0200 Hello, can someone give a short explanation what jiffies are? regards sting
From: Richard B. Johnson [email blocked] Subject: Re: short explanation -jiffies (newbie) Date: Thu, 16 Oct 2003 16:13:56 -0400 (EDT) On Thu, 16 Oct 2003, sting sting wrote: It is a variable that keeps increasing forever until it wraps back to zero at which time it still keeps increasing. It gets increased at the HZ (a defined constant) rate as a result of a hardware interrupt. It is used for various timing functions within the kernel. Cheers, Dick Johnson Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips). Note 96.31% of all statistics are fiction.
From: Jesper Juhl [email blocked] Subject: Re: short explanation -jiffies (newbie) Date: Thu, 16 Oct 2003 23:01:37 +0200 (CEST) On Thu, 16 Oct 2003, sting sting wrote: > Hello, > can someone give a short explanation what jiffies are? A short explanation : "Basic packet of kernel time, around 10ms on x86. Related to HZ, the basic resolution of the operating system. The timer interrupt is raised each 10ms, which then performs some h/w timer related stuff, and marks a couple of bh's ready to run if applicable." is given at : http://www.kernelnewbies.org/glossary/#J For more details you could take a look at these files (there are more) in the kernel source : include/linux/delay.h init/main.c to find more relevant files try something like this in the kernel source tree : for i in `find -name *.[ch]`; do grep -H jiffy $i; done Kind regards, Jesper Juhl
In Linux 2.6, how many jiffies used by process?
So, how do you find out how many jiffies worth of CPU time were used by a process?
For 2.6 kernel, is there anything more accurate than:
clock_t times(struct tms *buf);
Re: In Linux 2.6, how many jiffies used by process?
For 2.6 kernel, is there anything more accurate than:
clock_t times(struct tms *buf);
if you actually want jiffies, times(...) (or parsing through /proc/self/stat) is the way to go.
however, if actual time is alright (it's more accurate than jiffies) you can use getrusage. it returns a struct full of all kinds of stuff but the fields of interest are ru_utime and ru_stime, which are the amount of user and system time the process has used.
try "man getrusage" for information on the system call and the struct.