PDA

View Full Version : resource usage



KapTinKiRk
November 15th, 2000, 19:36
Some scripts use a lot of system resources, some don't. Is there a way to test a script and see how much resources it uses? It it simply the bandwith, or is it a whole other thing in itself.

atlas
November 15th, 2000, 23:37
Originally posted by KapTinKiRk
Some scripts use a lot of system resources, some don't. Is there a way to test a script and see how much resources it uses? It it simply the bandwith, or is it a whole other thing in itself.

Usually system resources refers to the memory and CPU a process takes up. Run the script, and if you have shell access run 'top' and see how much your script or program uses.

mjk@atlascgi.com

KapTinKiRk
November 15th, 2000, 23:48
hhmm, how do I read this thing, theres numbers all over the place :(

Grant
November 16th, 2000, 00:29
Originally posted by KapTinKiRk
Some scripts use a lot of system resources, some don't. Is there a way to test a script and see how much resources it uses? It it simply the bandwith, or is it a whole other thing in itself. The shell script 'top' is probably more accurate, but you can also use the perl Benchmark module. It is mainly used for testing a block of code. You use it like this:



use Benchmark;

$t0 = new Benchmark;
# code you want to test
$t1 = new Benchmark;

print "<p>Processing Time: " . timestr(timediff($t1, $t0)) . "\n";


Grant