python process accounting

Dave Angel davea at davea.name
Tue Apr 30 12:49:58 EDT 2013


On 04/30/2013 12:38 PM, Dave Angel wrote:

Oops, a typo.  See below.

> On 04/30/2013 12:25 PM, Rita wrote:
>> Hi,
>>
>> I was wondering if it possible to write a python wrapper which will
>> account
>> my processes. I would like to account for all the children processes
>> (fork)
>> by looking at their /proc/<pid> info. Such as memory, io, open files,
>> stats.
>>
>> So, instead of me running "/bin/sleep 10", i would like to run it as
>> "pywrap.py /bin/sleep 10" and it will do an exec /bin/sleep 10 and do a
>> periodic snapshot for whats in /proc/<pid>/stats.
>>
>>
>
> I only understood a quarter of that.  But if you want to sleep, why not
> just call  time.sleep ?
>

import time
while True:
       time.sleep(10)
       ...  do some stuff with the processes.

>
> If you want help in the other portion, you'd better explain:
>
> <<<<<<
> Running Python xx.xx in Operating System yy.
>
>  From the bash prompt, I'd like to do:
>     zzzzz, and zzzz
>
> And here's what I mean by child processes.  Children of the current bash
> shell?  Or what?
> <<<<<<


-- 
DaveA



More information about the Python-list mailing list