in reply to time and mem usage of pgm

On linux, one might use the following:

sub mem{ `ps -o rss $$` =~ m[(\d+)] }
But directly reading the process stats is preferable:
sub mem { local $/; open my $fh, '/proc/self/status'; <$fh> =~ /^VmRSS:\s*(\d+)/m; }

Replies are listed 'Best First'.
Re^2: time and mem usage of pgm
by carolw (Sexton) on Feb 06, 2015 at 07:33 UTC

    yes, it is under linux that I want to measure.

    How about the time that the whole program takes (sytem, user, wall clock)?

      How about the time that the whole program takes (sytem, user, wall clock)?

      See times for 2 out of 3.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
      In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked