hmm...  I'm looking at an export I wrote that deal with proc data for
specific processes and what I'm doing is the following, noting that
I'm looking at the hash of the processes which have been sorted and
using that key to set me to the index of the associate process.

  foreach $key (sort keys %procSort)
  {
    # if we had partial data for this pid don't try to print!
    $i=$procIndexes{$procSort{$key}};
    next    if !defined($procSTimeTot[$i]);

    # If wide mode we include the command arguments AND chop trailing spaces
    ($cmd0, $cmd1)=(defined($procCmd[$i])) ?
split(/\s+/,$procCmd[$i],2) : ($procName[$i],'');

I suppose you could also do something like

for (my $i=0l $i<@ProcsCmd; $i+++)

I'm thinking either would work, but admit I haven't actually tried it.
 let me know if this gets you what you need

-mark

On Wed, Feb 20, 2013 at 9:09 AM, Matthew Mulhern <[email protected]> wrote:
> Hi,
> My name is Matt Mulhern and I have been recently working on an export .ph
> file to allow collectl to output in a format which in turn can be used with
> ITRS.
>
> Everything has been going well, I have pulled out the –sC and –sN data that
> we need for now and can print this at will.
> Basically, looking at the sexpr example, I have been able to populate
> variables with the data I need by cycling through each CPU for –sC and each
> network interface for –sN:
> E.g.
>     if ($subsys=~/C/)
>     {
>         my ($name, $userTot, $niceTot, $sysTot, $waitTot, $irqTot, $softTot,
> $stealTot, $idleTot, $intTot)=
>            ('','','','','','','','','','');
>
>         for (my $i=0; $i<$NumCpus; $i++)
> ……
> }
> And
>
>     if ($subsys=~/N/)
>     {
>       my ($netname, $kbinT, $pktinT, $kboutT, $pktoutT)=('','','','','');
>       for ($i=0; $i<@netOrder; $i++)
>       {
>         $netName=$netOrder[$i];
>         next    if !defined($netSeen[$i]);
>         next    if ($netFiltKeep eq '' && $netName=~/$netFiltIgnore/) ||
> ($netFiltKeep ne '' && $netName!~/$netFiltKeep/);
>         next    if $netName=~/lo|sit/;
>
>         $netname.=   "$netName ";
>         $kbinT.=  "$netRxKBLast[$i] ";
>         $pktinT.= "$netRxPktLast[$i] ";
>         $kboutT.= "$netTxKBLast[$i] ";
>         $pktoutT.="$netTxPktLast[$i] ";
> .....
> }
>
>
> My only problem is figuring out how to cycle through every process with –sZ
> used.
>
> E.g.
>     if ($subsys=~/Z/)
>     {
>       my ($pid, $ppid, $vsz, $rss, $cp, $pct, $majF, $minF, $cmd
> )=('','','','','','','','','');
>       for ($i=0; $i<$NumProcs; $i++)
>       {
> ..…
> }
>
> Is there a variable I can refer to which is the total number of processes
> being monitored,  (replacing NumProcs highlighted above)?
>
>
> Any help would be greatly appreciated.
>
> With thanks,
> Matt Mulhern
>
>
>
> ________________________________
>
> Please consider the environment before printing this e-mail.
>
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient or have received this e-mail in error, please
> advise the sender immediately by reply e-mail and delete this message and
> any attachments without retaining a copy.
>
> Any unauthorised copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> Collectl-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/collectl-interest
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Collectl-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/collectl-interest

Reply via email to