[Leaplist] need some jiffies

John Simpson jms1 at jms1.net
Mon Oct 8 22:56:43 EDT 2007


On 2007-10-08, at 1813, Doug Jones wrote:
>
> ... I need to do a little medium resolution
> timing.  My current learning experience is to try to get the linux  
> heartbeat
> system tic known as 'jiffies' rather than system time since jan 1,  
> 1970.
> The jiffies would put me back in paradigm I'm used to in embedded  
> stuff.
>
> So my question, anyone got a good C example of how to get jiffies  
> from user
> space?

the easiest way is to read /proc/uptime. the first number is total  
seconds since the system came up, and the other is the total number  
of "idle" seconds since the system came up.

and since a "jiffy" is 1/100th of a second, remove the period from  
the number and you have the count in jiffies rather than seconds.

> I've found linux/jiffies.h but when i include i get a bazillion
> compile errors.  I just need a simple example that shows all the  
> include
> files.  Yes, I googled and ended up in kernel development too much  
> (head
> exploded).

i don't have that header on my system, probably because i don't have  
(or need) the kernel sources at all.

what is it you're trying to do? could you do what you need using  
nanosleep() or setitimer() instead?

> Hopefully I'll see some of y'all at the redhat thing tomorrow (9oct).

i'm signed up to go, but that's reeeeeeally early for me... i don't  
honestly know if i'll be there or not.

----------------------------------------------------------------
| John M. Simpson    ---   KG4ZOW   ---    Programmer At Large |
| http://www.jms1.net/                         <jms1 at jms1.net> |
----------------------------------------------------------------
| http://video.google.com/videoplay?docid=-1656880303867390173 |
----------------------------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.leap-cf.org/pipermail/leaplist/attachments/20071008/b3d773d0/PGP.bin


More information about the Leaplist mailing list