in reply to time and mem usage of pgm
In Windows, this does the trick provided whole seconds are good enough:
#! perl -slw use strict; sub mem{ `tasklist /nh /fi "PID eq $$"` =~ m[(\S+ K)$] } END{ print time - $^T, " seconds\nRam:", mem; } sleep $ARGV[0]; __END__ C:\test>junk33 5 5 seconds Ram:4,836 K C:\test>junk33 10 10 seconds Ram:4,832 K
Finding the *nix equivalent of tasklist left as an exercise.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: time and mem usage of pgm
by carolw (Sexton) on Mar 10, 2015 at 08:40 UTC | |
by BrowserUk (Patriarch) on Mar 10, 2015 at 09:14 UTC | |
by Anonymous Monk on Mar 11, 2015 at 08:16 UTC | |
by hippo (Archbishop) on Mar 11, 2015 at 08:44 UTC | |
by carolw (Sexton) on Mar 16, 2015 at 10:37 UTC | |
| |
by Anonymous Monk on Mar 11, 2015 at 20:15 UTC | |
by BrowserUk (Patriarch) on Mar 11, 2015 at 20:26 UTC | |
by hippo (Archbishop) on Mar 10, 2015 at 09:53 UTC | |
by Anonymous Monk on Mar 10, 2015 at 09:29 UTC | |
by BrowserUk (Patriarch) on Mar 10, 2015 at 09:38 UTC |