Invoking Unix commands from a Python app

Will McDonald wmcdonald at gmail.com
Sat Dec 17 09:04:06 EST 2005


On 16 Dec 2005 08:45:01 -0800, Rob Cowie <cowie.rob at gmail.com> wrote:
> Excellent... just the thing I was looking for. Thanks.
>
> Does anyone know of a unix app that could be used to monitor the
> duration of processes etc.?

If you have control over starting the program then "time" will probaby suffice.

time - time a simple command or give resource usage

DESCRIPTION
       The  time  command  runs  the specified program command with the given
       arguments.  When command finishes, time writes a message  to  standard
       output giving timing statistics about this program run.  These statis-
       tics consist of (i) the elapsed real time between invocation and  ter-
       mination,  (ii)  the  user  CPU  time  (the  sum  of the tms_utime and
       tms_cutime values in a struct tms as returned by times(2)), and  (iii)
       the system CPU time (the sum of the tms_stime and tms_cstime values in
       a struct tms as returned by times(2)).

[wmcdonald at stella ~]$ time find . > /dev/null 2>&1

real    0m0.010s
user    0m0.001s
sys     0m0.009s
[wmcdonald at stella ~]$


Will.



More information about the Python-list mailing list