You are not logged in.

#1 2008-10-29 01:20:50

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

mem / cpu usage of a script

Hi,
is there a way to monitor the memory / cpu usage of a python script?
thanks
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#2 2008-10-29 01:34:31

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: mem / cpu usage of a script

Take a look at "man top" if you want to monitor the script externally. I don't know how to make the script report back on its own cpu and memory usage.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2008-10-29 19:14:42

briest
Member
From: Katowice, PL
Registered: 2006-05-04
Posts: 468

Re: mem / cpu usage of a script

It depends -- what do you mean by "monitor"? If the script is run once, try time (/usr/bin/time from package time, not the shell builtin), with -v option. For long running, daemon-like scripts I'd use something like monit with few thresholds.

Offline

Board footer

Powered by FluxBB