Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Aug 2010 12:26:45 -0700
From:      Jeremy Chadwick <freebsd@jdc.parodius.com>
To:        Jesse Smith <jessefrgsmith@yahoo.ca>
Cc:        freebsd-ports <freebsd-ports@FreeBSD.org>
Subject:   Re: Converting from jiffies to ticks
Message-ID:  <20100819192645.GA84660@icarus.home.lan>
In-Reply-To: <1282245339.3094.24.camel@hp-laptop>
References:  <1282245339.3094.24.camel@hp-laptop>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 19, 2010 at 04:15:39PM -0300, Jesse Smith wrote:
> I am currently trying to port a program from Linux to FreeBSD which
> detects how much processor time a process is using. The native Linux
> code does this (in part) by reading the number of "jiffies" a given
> process uses. This info is pulled from the /proc/PID/stat file.
> 
> One function is failing on FreeBSD and it's obviously because FreeBSD
> does not have all the same files/data in the /proc directory.
> 
> I've looked around and, as I understand it, FreeBSD uses "ticks" instead
> of "jiffies" to measure process usage. However, how to gather that data
> is a bit lost on me.
> 
> This raises two questions for me:
> 1. Where can I find the equivalent information on FreeBSD? I assume
> there's a function call. Maybe in the kvm_* family? I need to be able to
> get the number of ticks a given PID is using.
> 
> 2. Any idea on what the conversion rate between ticks and jiffies is?
> Are they the same thing, but with different names? Or is it a kilometres
> and miles issue?
> 
> 
> The rest of the program measures everything in "jiffies", so it would be
> ideal for me to get the ticks used on FreeBSD (based on PID), convert it
> to "jiffies" and pass it back to the main program.

I would recommend you re-ask this question on freebsd-hackers.
freebsd-ports isn't really for this purpose.

-- 
| Jeremy Chadwick                                   jdc@parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100819192645.GA84660>