Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2009 17:37:39 -0900
From:      Mel Flynn <>
To:        cronfy <>
Subject:   Re: get accounting info for running process
Message-ID:  <>
In-Reply-To: <>
References:  <> <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Thu, 19 Nov 2009 20:01:02 +0300, cronfy <> wrote:
>>> Is it possible to find out how much a process have used CPU user=20
>>> time/system time/IO operations for now by it's pid? Like in sa, but f=

>>> running process.
>>>    =20
> Dan, Mel, thanks for your answers. I examined 'ps' sources and decided=20
> to use  kvm_getprocs() and rusage structure.
> I am trying to create a daemon that would report system accounting stat=
> for every X seconds, let's say 10.  'sa' reports about terminated=20
> processes only, but it would be nice to have more detailed system usage=
> stats per user for a given time interval (i.e. last 10 seconds),=20
> including tasks that are not finished at the moment of querying.
> I can achieve this by querying list of processes each 10 seconds and=20
> producing diffs between previous and current list, saving these to some=
> log and combining data with /var/account/acct file.
> The only thing I do not want to do is to invent a wheel ;-) I googled=20
> much for such solutions, but did not find any. May be someone knows=20
> existing products that has this functionality already?

I don't know of anything like that, but ... there is of course radius.
Depends what you want to do with the info. If usage restriction is your
ultimate goal, then radius is your friend.


Want to link to this message? Use this URL: <>