get active processes in python

Joseph Koshy jkoshy at FreeBSD.org
Thu Jul 12 19:45:46 UTC 2007


[Trimming soc-admins@ from the CC list]

mp> do you recommend a method to get active processes in a python script,
mp> as with "ps" or "top" in order to put the result into a list ? (python
mp> package, shell call...)

One option would be to wrap "kvm_getprocs(3)" and use that.

mp> PS: I would like to fire this regularly, eg every second

This shouldn't be a problem.  Most GUI toolkits offer a way of
registering a callback that will be invoked periodically.

Regards,
Koshy
<jkoshy at freebsd.org>


More information about the freebsd-hackers mailing list