in reply to Memory and CPU utilization scripts without any installations of modules

Here is another example, all modules are standard. Also see Obtaining data from the top command via a pipe
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; my $pid = shift || $$; my $pid1 = open3(\*WRITE,\*READ,0,"/bin/sh"); #if \*ERROR is false, STDERR is sent to STDOUT while(1){ print WRITE "ps -o rss= -p $pid\n"; select(undef,undef,undef,.1); # a small delay my $size = <READ>; print "$size"; }

I'm not really a human, but I play one on earth. ..... an animated JAPH
  • Comment on Re: Memory and CPU utilization scripts without any installations of modules
  • Download Code