Howdy all,

I've been messing around with perl Kstat module trying to scratch an itch,
and I ended up writting a new module that adds object semantics.  I've
since used it to proto-type lots of different small tools in a very short
amount of time.  I'm hoping that other people might find it interesting.

I'm looking for some guidence from Solaris old hands on getting this
putback if it passes muster.  I would be happy to make this available
outside of Sun once I get some ideas on how to do that and appease the
lawyers at the same time :)

It's available interally to Sun at:

  http://tools.central/projects/Kstat2

and the man page can be found at:

  http://saeaustin.central/wiki/Kstat2

Excerpted from that document:

  "Sun::Solaris::Kstat2" extends the class "Sun::Solaris::Kstat" by
  providing object methods to locate and access kstat data.

  ...
  
  The main goal of the "Sun::Solaris::Kstat2" module is provide short hand
  notation and methods for aggregating and accessing data from groups of
  related kstats. For instance, on large SMP machines there are many
  kstats related to CPUs. If you wanted to find all of the kstats whose
  module was "cpu_stat" you would do something similar to:
  
    $ks = new Sun::Solaris::Kstat;
    ...
    foreach $inst ( keys %{$ks->{"cpu_stat"}} ){
      foreach $name ( keys %{$ks->{"cpu_stat"}{$inst}} ){
        while( ($stat,$val) = each %{$ks->{"cpu_stat"}{$inst}{$name}} ){
          # do stuff here.  
        }
      }
    }
  
  Using "Sun::Solaris::Kstat2", the equivilant would look something like:
  
    $cpu_stats = new Sun::Solaris::Kstat2 "cpu_stat:::";
  
    Sun::Solaris::Kstat2->update;

    # do stuff here.

  Sampling and aggregation of multiple kstats' data is handled
  automatically for the user. The user can concentrate on what they want
  to do with the kstat data, rather than how to manage the acquisition
  of data.

Included in with the module are two examples scripts which re-implement
vmstat and mpstat with some small added features ( timestamped output! )

Thanks for reading!

-ejo

---
 erik.oshaughnessy at sun.com:Sun Microsystems Austin TX:512-401-1070:x64070
"We've secretly replaced his brains with oatmeal, let's see if he notices!"

Reply via email to