> thanks. question: why the counter in your code example?

<<I presume you mean the '$readIt++' - that is not really a counter,
more just a boolean flag.... We set it to zero and once we see that
the /$RightHeader/ we flip it on and get the next line of input. >>

yes, i understand that, i guess the question should have been, why do we
need it?
why not just do a next unless /REGEX/ then
        if /$find/ ....

>
> hmm..guess i should have scoured the man page before posting the question.
> turns out one can print just the Total columns with 'prstat -t'

<<which I presume means that it would gin up only the
   NPROC USERNAME  SIZE   RSS MEMORY      TIME  CPU

     17 prago    1596M  394M   2.9%   0:48.54  11%
     47 oracle     13G   12G    91%  38:17.25 4.1%
      5 patrol     36M   23M   0.2%  10:53.17 0.2%
     11 dbmsys     52M   20M   0.1%   0:00.53 0.1%
     53 root      173M  113M   0.8%   5:32.40 0.1%
Total: 208 processes, 875 lwps, load averages: 2.03, 2.04, 2.12
you will of course not that the code I offer you has no problem with that.
>>

yes

<<
or you might just go with
        my $pscmd='ps -ae -o user,rss,vsz,time';
        open(INPUTDATA, "$pscmd|") or
                die "silly critter puked on ps cmd:$!\n";

and do your own direct grovelling of the data set:

since your 'percentages' there are the ratio of RSS to VSZ...
once one had converted that to and from page sizes - or not -
if all you want is the percentages...
>>

funny you should say this. little background: the captured data will be
insterted into a few oracle DB tables for later querying. as of now i am
opening 2 pipes and will love to emlinate one of them. so your idea here may
be the solution. 
-snip--
$ps = '/usr/bin/ps -eo user,pcpu,pmem,vsz,comm';
$pr = '/usr/bin/prstat -t';
open (PIPE, "$ps|") or die "could not pipe command: $!";
open (PIPE2, "$pr|") or die "could not pipe command: $!";

while (<PIPE>) {
        next if $_ =~ /USER/;
        my($null,$user,$cpu,$mem,$vmem,$cmd) = split(/\s+/);
}

while (<PIPE2>) {
        next if $_ =~ /NPROC/;
        my($tuser,$tcpu,$tmem) = (split(/\s+/)) [2,5,7];
        last if $_ =~ /^Total/i;
}
..
..
close PIPE;
close PIPE2;
-snip--

now the other ugly problem is how to stop prstat in the while loop(just want
the first instance of stats then quit). i know there has to be a better way
then the ugly 'last if..'


<<
 I still say it would be fun to rip the prstat code apart and
get your head around what really gets done in 'top' and/or any
of it's variants....>>


hmm.. i will see how my weekend shapes up. if i need to kill a couple of
hours :-)


moving right along here:

<<I am a bit concerned by  Sudarsan Raghavan most elegant offer:
...
so I fear his (1../^NPROC/) isn't doing quite what he was hoping that
it would be doing.... >>

yes, i noticed that, but was easily fixed with minor adjustments





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to