r26416 - in /branches/upstream/libsys-statistics-linux-perl/current: Build.PL ChangeLog META.yml README lib/Sys/Statistics/Linux.pm

rmayorga-guest at users.alioth.debian.org rmayorga-guest at users.alioth.debian.org
Sat Nov 1 01:52:34 UTC 2008


Author: rmayorga-guest
Date: Sat Nov  1 01:52:31 2008
New Revision: 26416

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=26416
Log:
[svn-upgrade] Integrating new upstream version, libsys-statistics-linux-perl (0.43)

Modified:
    branches/upstream/libsys-statistics-linux-perl/current/Build.PL
    branches/upstream/libsys-statistics-linux-perl/current/ChangeLog
    branches/upstream/libsys-statistics-linux-perl/current/META.yml
    branches/upstream/libsys-statistics-linux-perl/current/README
    branches/upstream/libsys-statistics-linux-perl/current/lib/Sys/Statistics/Linux.pm

Modified: branches/upstream/libsys-statistics-linux-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-statistics-linux-perl/current/Build.PL?rev=26416&op=diff
==============================================================================
--- branches/upstream/libsys-statistics-linux-perl/current/Build.PL (original)
+++ branches/upstream/libsys-statistics-linux-perl/current/Build.PL Sat Nov  1 01:52:31 2008
@@ -21,7 +21,6 @@
         'Test::More'  => 0,
         'Time::HiRes' => 0,
         'UNIVERSAL'   => 0,
-        'UNIVERSAL::require' => 0,
     },
 );
 

Modified: branches/upstream/libsys-statistics-linux-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-statistics-linux-perl/current/ChangeLog?rev=26416&op=diff
==============================================================================
--- branches/upstream/libsys-statistics-linux-perl/current/ChangeLog (original)
+++ branches/upstream/libsys-statistics-linux-perl/current/ChangeLog Sat Nov  1 01:52:31 2008
@@ -1,3 +1,7 @@
+0.43    Released at 2008-10-29.
+        - Kicked UNIVERSAL::require.
+        - Now it's possible to pass $sleep_time to get().
+
 0.42    Released at 2008-10-06.
         - Added $PAGES_TO_BYTES to Sys::Statistics::Linux::Processes.
           With this variable it's possible to get bytes/kilobytes instead

Modified: branches/upstream/libsys-statistics-linux-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-statistics-linux-perl/current/META.yml?rev=26416&op=diff
==============================================================================
--- branches/upstream/libsys-statistics-linux-perl/current/META.yml (original)
+++ branches/upstream/libsys-statistics-linux-perl/current/META.yml Sat Nov  1 01:52:31 2008
@@ -1,6 +1,6 @@
 ---
 name: Sys-Statistics-Linux
-version: 0.42
+version: 0.43
 author:
   - Jonny Schulz
 abstract: Front-end module to collect system statistics
@@ -13,11 +13,10 @@
   Test::More: 0
   Time::HiRes: 0
   UNIVERSAL: 0
-  UNIVERSAL::require: 0
 provides:
   Sys::Statistics::Linux:
     file: lib/Sys/Statistics/Linux.pm
-    version: 0.42
+    version: 0.43
   Sys::Statistics::Linux::Compilation:
     file: lib/Sys/Statistics/Linux/Compilation.pm
     version: 0.07

Modified: branches/upstream/libsys-statistics-linux-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-statistics-linux-perl/current/README?rev=26416&op=diff
==============================================================================
--- branches/upstream/libsys-statistics-linux-perl/current/README (original)
+++ branches/upstream/libsys-statistics-linux-perl/current/README Sat Nov  1 01:52:31 2008
@@ -4,7 +4,7 @@
 SYNOPSIS
         use Sys::Statistics::Linux;
 
-        my $lxs = Sys::Statistics::Linux->new(
+        my %options = (
             sysinfo   => 1,
             cpustats  => 1,
             procstats => 1,
@@ -19,14 +19,15 @@
             processes => 1,
         );
 
+        my $lxs = Sys::Statistics::Linux->new(\%options);
         sleep 1;
-
-        # $stat is a Sys::Statistics::Linux::Compilation object
         my $stat = $lxs->get;
 
-        foreach my $key ($stat->loadavg) {
-            print $key, " ", $stat->loadavg($key), "\n";
-        }
+    Or
+
+        my $sleep = 1;
+        my $lxs   = Sys::Statistics::Linux->new(\%options);
+        my $stat  = $lxs->get($sleep);
 
 DESCRIPTION
     Sys::Statistics::Linux is a front-end module and gather different linux
@@ -181,7 +182,13 @@
     Call "get()" to get the collected statistics. "get()" returns a
     Sys::Statistics::Linux::Compilation object.
 
-        my $stat = $lxs->get;
+        my $lxs  = Sys::Statistics::Linux->new(\%options);
+        sleep(1);
+        my $stat = $lxs->get();
+
+    Or you can pass the time to sleep with the call of "get()".
+
+        my $stat = $lxs->get($time_to_sleep);
 
     Now the statistcs are available with
 
@@ -205,7 +212,6 @@
 
         # initiate cpustats
         my $lxs = Sys::Statistics::Linux->new( cpustats => 1 );
-        sleep(1);
 
         while ( 1 ) {
             sleep(1800);
@@ -219,10 +225,9 @@
         my $lxs = Sys::Statistics::Linux->new( cpustats => 2 );
 
         while ( 1 ) {
-            $lxs->init;             # init the statistics
-            sleep(1);               # sleep for the deltas
-            my $stat = $lxs->get;   # get the statistics
-            sleep(1800);            # sleep until the next run
+            $lxs->init;              # init the statistics
+            my $stat = $lxs->get(1); # get the statistics
+            sleep(1800);             # sleep until the next run
         }
 
     If you want to write a simple command line utility that prints the
@@ -234,8 +239,7 @@
         my $lxs = Sys::Statistics::Linux->new( cpustats => 1 );
 
         while ( 1 ){
-            sleep(1);
-            my $cpu  = $lxs->get->cpustats;
+            my $cpu  = $lxs->get(1)->cpustats;
             my $time = $lxs->gettime;
             printf "%-20s%8s%8s%8s%8s%8s%8s%8s%8s\n",
                 $time, @{$cpu->{cpu}}{@order};
@@ -342,7 +346,6 @@
         Test::More
         Time::HiRes
         UNIVERSAL
-        UNIVERSAL::require
 
 EXPORTS
     No exports.

Modified: branches/upstream/libsys-statistics-linux-perl/current/lib/Sys/Statistics/Linux.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-statistics-linux-perl/current/lib/Sys/Statistics/Linux.pm?rev=26416&op=diff
==============================================================================
--- branches/upstream/libsys-statistics-linux-perl/current/lib/Sys/Statistics/Linux.pm (original)
+++ branches/upstream/libsys-statistics-linux-perl/current/lib/Sys/Statistics/Linux.pm Sat Nov  1 01:52:31 2008
@@ -6,7 +6,7 @@
 
     use Sys::Statistics::Linux;
 
-    my $lxs = Sys::Statistics::Linux->new(
+    my %options = (
         sysinfo   => 1,
         cpustats  => 1,
         procstats => 1,
@@ -21,14 +21,15 @@
         processes => 1,
     );
 
+    my $lxs = Sys::Statistics::Linux->new(\%options);
     sleep 1;
-
-    # $stat is a Sys::Statistics::Linux::Compilation object
     my $stat = $lxs->get;
 
-    foreach my $key ($stat->loadavg) {
-        print $key, " ", $stat->loadavg($key), "\n";
-    }
+Or
+
+    my $sleep = 1;
+    my $lxs   = Sys::Statistics::Linux->new(\%options);
+    my $stat  = $lxs->get($sleep);
 
 =head1 DESCRIPTION
 
@@ -178,7 +179,13 @@
 Call C<get()> to get the collected statistics. C<get()> returns a L<Sys::Statistics::Linux::Compilation>
 object.
 
-    my $stat = $lxs->get;
+    my $lxs  = Sys::Statistics::Linux->new(\%options);
+    sleep(1);
+    my $stat = $lxs->get();
+
+Or you can pass the time to sleep with the call of C<get()>.
+
+    my $stat = $lxs->get($time_to_sleep);
 
 Now the statistcs are available with
 
@@ -200,7 +207,6 @@
 
     # initiate cpustats
     my $lxs = Sys::Statistics::Linux->new( cpustats => 1 );
-    sleep(1);
 
     while ( 1 ) {
         sleep(1800);
@@ -214,10 +220,9 @@
     my $lxs = Sys::Statistics::Linux->new( cpustats => 2 );
 
     while ( 1 ) {
-        $lxs->init;             # init the statistics
-        sleep(1);               # sleep for the deltas
-        my $stat = $lxs->get;   # get the statistics
-        sleep(1800);            # sleep until the next run
+        $lxs->init;              # init the statistics
+        my $stat = $lxs->get(1); # get the statistics
+        sleep(1800);             # sleep until the next run
     }
 
 If you want to write a simple command line utility that prints the current workload
@@ -229,8 +234,7 @@
     my $lxs = Sys::Statistics::Linux->new( cpustats => 1 );
 
     while ( 1 ){
-        sleep(1);
-        my $cpu  = $lxs->get->cpustats;
+        my $cpu  = $lxs->get(1)->cpustats;
         my $time = $lxs->gettime;
         printf "%-20s%8s%8s%8s%8s%8s%8s%8s%8s\n",
             $time, @{$cpu->{cpu}}{@order};
@@ -337,7 +341,6 @@
     Test::More
     Time::HiRes
     UNIVERSAL
-    UNIVERSAL::require
 
 =head1 EXPORTS
 
@@ -364,18 +367,14 @@
 =cut
 
 package Sys::Statistics::Linux;
-our $VERSION = '0.42';
+our $VERSION = '0.43';
 
 use strict;
 use warnings;
 use Carp qw(croak);
 use POSIX qw(strftime);
 use UNIVERSAL;
-use UNIVERSAL::require;
 use Sys::Statistics::Linux::Compilation;
-
-# save loaded modules
-my %MODS;
 
 sub new {
     my $class = shift;
@@ -429,11 +428,12 @@
         if ($opts->{$opt}) {
             my $package = $class.'::'.$maps->{$opt};
 
-            # require mod if not loaded
-            unless ($MODS{$package}) {
-                $package->require or croak "$class: unable to load $package";
-                $MODS{$package} = 1;
-            }
+            # require module - require know which modules are loaded
+            # and doesn't load a module twice.
+            my $require = $package;
+            $require =~ s/::/\//g;
+            $require .= '.pm';
+            require $require;
 
             # create a new object if the object doesn't exist
             # or create a new process list object if $pids is set
@@ -459,6 +459,7 @@
     my $self  = shift;
     my $class = ref $self;
     my $maps  = $self->{maps};
+
     foreach my $opt (keys %{$self->{opts}}) {
         if ($self->{opts}->{$opt} > 0 && UNIVERSAL::can(ref($self->{obj}->{$opt}), 'init')) {
             $self->{obj}->{$opt}->init();
@@ -470,6 +471,7 @@
     my ($self, $time) = @_;
     sleep $time if $time;
     my %stat = ();
+
     foreach my $opt (keys %{$self->{opts}}) {
         if ($self->{opts}->{$opt}) {
             $stat{$opt} = $self->{obj}->{$opt}->get();
@@ -478,6 +480,7 @@
             }
         }
     }
+
     return Sys::Statistics::Linux::Compilation->new(\%stat);
 }
 




More information about the Pkg-perl-cvs-commits mailing list