r76287 - in /trunk/libsys-statistics-linux-perl: ChangeLog MANIFEST META.yml README debian/changelog debian/copyright examples/processes.pl examples/processes.pm examples/pstop.pl lib/Sys/Statistics/Linux.pm lib/Sys/Statistics/Linux/Processes.pm

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Wed Jun 22 21:18:18 UTC 2011


Author: carnil
Date: Wed Jun 22 21:18:06 2011
New Revision: 76287

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=76287
Log:
* Email change: Ansgar Burchardt -> ansgar at debian.org
* New upstream release
* Email change: Salvatore Bonaccorso -> carnil at debian.org
* debian/copyright: Update copyright years for debian/* packaging.

Added:
    trunk/libsys-statistics-linux-perl/examples/processes.pl
      - copied unchanged from r76286, branches/upstream/libsys-statistics-linux-perl/current/examples/processes.pl
    trunk/libsys-statistics-linux-perl/examples/pstop.pl
      - copied unchanged from r76286, branches/upstream/libsys-statistics-linux-perl/current/examples/pstop.pl
Removed:
    trunk/libsys-statistics-linux-perl/examples/processes.pm
Modified:
    trunk/libsys-statistics-linux-perl/ChangeLog
    trunk/libsys-statistics-linux-perl/MANIFEST
    trunk/libsys-statistics-linux-perl/META.yml
    trunk/libsys-statistics-linux-perl/README
    trunk/libsys-statistics-linux-perl/debian/changelog
    trunk/libsys-statistics-linux-perl/debian/copyright
    trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux.pm
    trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux/Processes.pm

Modified: trunk/libsys-statistics-linux-perl/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsys-statistics-linux-perl/ChangeLog?rev=76287&op=diff
==============================================================================
--- trunk/libsys-statistics-linux-perl/ChangeLog (original)
+++ trunk/libsys-statistics-linux-perl/ChangeLog Wed Jun 22 21:18:06 2011
@@ -1,3 +1,12 @@
+0.60    Released at 2011-06-22.
+        - Just a full release. Have fun :-)
+
+0.59_02 Released at 2011-04-16.
+        - Fixed a little bug in Processes.pm (_init).
+
+0.59_01 Released at 2011-04-14.
+        - Added statistics from /proc/pid/io to Processes.pm. See RT #67459.
+
 0.59    Released at 2010-09-28.
         - Added key "arch" to SysInfo.pm.
 

Modified: trunk/libsys-statistics-linux-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsys-statistics-linux-perl/MANIFEST?rev=76287&op=diff
==============================================================================
--- trunk/libsys-statistics-linux-perl/MANIFEST (original)
+++ trunk/libsys-statistics-linux-perl/MANIFEST Wed Jun 22 21:18:06 2011
@@ -2,7 +2,8 @@
 ChangeLog
 examples/diskusage.pl
 examples/loadavg.pl
-examples/processes.pm
+examples/processes.pl
+examples/pstop.pl
 INSTALL
 lib/Sys/Statistics/Linux.pm
 lib/Sys/Statistics/Linux/Compilation.pm

Modified: trunk/libsys-statistics-linux-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsys-statistics-linux-perl/META.yml?rev=76287&op=diff
==============================================================================
--- trunk/libsys-statistics-linux-perl/META.yml (original)
+++ trunk/libsys-statistics-linux-perl/META.yml Wed Jun 22 21:18:06 2011
@@ -1,24 +1,19 @@
 ---
+abstract: 'Front-end module to collect system statistics'
+author:
+  - 'Jonny Schulz'
+configure_requires:
+  Module::Build: 0.36
+generated_by: 'Module::Build version 0.3607'
+license: perl
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
 name: Sys-Statistics-Linux
-version: 0.59
-author:
-  - Jonny Schulz
-abstract: Front-end module to collect system statistics
-license: perl
-resources:
-  license: http://dev.perl.org/licenses/
-requires:
-  Carp: 0
-  POSIX: 0
-  Test::More: 0
-  Time::HiRes: 0
-  UNIVERSAL: 0
-recommends:
-  YAML::Syck: 0
 provides:
   Sys::Statistics::Linux:
     file: lib/Sys/Statistics/Linux.pm
-    version: 0.59
+    version: 0.60
   Sys::Statistics::Linux::Compilation:
     file: lib/Sys/Statistics/Linux/Compilation.pm
     version: 0.10
@@ -51,14 +46,21 @@
     version: 0.20
   Sys::Statistics::Linux::Processes:
     file: lib/Sys/Statistics/Linux/Processes.pm
-    version: 0.32
+    version: 0.34
   Sys::Statistics::Linux::SockStats:
     file: lib/Sys/Statistics/Linux/SockStats.pm
     version: 0.09
   Sys::Statistics::Linux::SysInfo:
     file: lib/Sys/Statistics/Linux/SysInfo.pm
     version: 0.13
-generated_by: Module::Build version 0.280801
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.2.html
-  version: 1.2
+recommends:
+  YAML::Syck: 0
+requires:
+  Carp: 0
+  POSIX: 0
+  Test::More: 0
+  Time::HiRes: 0
+  UNIVERSAL: 0
+resources:
+  license: http://dev.perl.org/licenses/
+version: 0.60

Modified: trunk/libsys-statistics-linux-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsys-statistics-linux-perl/README?rev=76287&op=diff
==============================================================================
--- trunk/libsys-statistics-linux-perl/README (original)
+++ trunk/libsys-statistics-linux-perl/README Wed Jun 22 21:18:06 2011
@@ -48,7 +48,7 @@
     long time ago) on kernel versions 2.4 and/or 2.6. It's possible that it
     doesn't run on all linux distributions if some procfs features are
     deactivated or too much modified. As example the linux kernel 2.4 can
-    compiled with the option "CONFIG_BLK_STATS" what turn on or off block
+    compiled with the option `CONFIG_BLK_STATS' what turn on or off block
     statistics for devices.
 
     Don't give up if some of the modules doesn't run on your hardware! Tell
@@ -56,9 +56,9 @@
     first move and to send me a mail. :-)
 
 VIRTUAL MACHINES
-    Note that if you try to install or run "Sys::Statistics::Linux" under
+    Note that if you try to install or run `Sys::Statistics::Linux' under
     virtual machines on guest systems that some statistics are not
-    available, such as "SockStats", "PgSwStats" and "DiskStats". The reason
+    available, such as `SockStats', `PgSwStats' and `DiskStats'. The reason
     is that not all /proc data are passed to the guests.
 
     If the installation fails then try to force the installation with
@@ -69,24 +69,24 @@
     available on the virtual machine - sorry.
 
 DELTAS
-    The statistics for "CpuStats", "ProcStats", "PgSwStats", "NetStats",
-    "DiskStats" and "Processes" are deltas, for this reason it's necessary
-    to initialize the statistics before the data can be prepared by "get()".
-    These statistics can be initialized with the methods "new()", "set()"
-    and "init()". For any option that is set to 1, the statistics will be
-    initialized by the call of "new()" or "set()". The call of init()
+    The statistics for `CpuStats', `ProcStats', `PgSwStats', `NetStats',
+    `DiskStats' and `Processes' are deltas, for this reason it's necessary
+    to initialize the statistics before the data can be prepared by `get()'.
+    These statistics can be initialized with the methods `new()', `set()'
+    and `init()'. For any option that is set to 1, the statistics will be
+    initialized by the call of `new()' or `set()'. The call of init()
     re-initialize all statistics that are set to 1 or 2. By the call of
-    "get()" the initial statistics will be updated automatically. Please
-    refer the section "METHODS" to get more information about the usage of
-    "new()", "set()", "init()" and "get()".
+    `get()' the initial statistics will be updated automatically. Please
+    refer the section METHODS to get more information about the usage of
+    `new()', `set()', `init()' and `get()'.
 
     Another exigence is to sleep for a while - at least for one second -
-    before the call of "get()" if you want to get useful statistics. The
-    statistics for "SysInfo", "MemStats", "SockStats", "DiskUsage",
-    "LoadAVG" and "FileStats" are no deltas. If you need only one of these
-    information you don't need to sleep before the call of "get()".
-
-    The method "get()" prepares all requested statistics and returns the
+    before the call of `get()' if you want to get useful statistics. The
+    statistics for `SysInfo', `MemStats', `SockStats', `DiskUsage',
+    `LoadAVG' and `FileStats' are no deltas. If you need only one of these
+    information you don't need to sleep before the call of `get()'.
+
+    The method `get()' prepares all requested statistics and returns the
     statistics as a Sys::Statistics::Linux::Compilation object. The inital
     statistics will be updated.
 
@@ -101,8 +101,8 @@
 OPTIONS
     All options are identical with the package names of the distribution in
     lowercase. To activate the gathering of statistics you have to set the
-    options by the call of "new()" or "set()". In addition you can
-    deactivate statistics with "set()".
+    options by the call of `new()' or `set()'. In addition you can
+    deactivate statistics with `set()'.
 
     The options must be set with one of the following values:
 
@@ -123,7 +123,7 @@
             },
         );
 
-    Option "initfile" is useful if you want to store initial statistics on
+    Option `initfile' is useful if you want to store initial statistics on
     the filesystem.
 
         my $lxs = Sys::Statistics::Linux->new(
@@ -200,9 +200,9 @@
 
 METHODS
   new()
-    Call "new()" to create a new Sys::Statistics::Linux object. You can call
-    "new()" with options. This options would be passed to the method
-    "set()".
+    Call `new()' to create a new Sys::Statistics::Linux object. You can call
+    `new()' with options. This options would be passed to the method
+    `set()'.
 
     Without options
 
@@ -216,7 +216,7 @@
 
         my $lxs = Sys::Statistics::Linux->new( cpustats => 0 );
 
-    It's possible to call "new()" with a hash reference of options.
+    It's possible to call `new()' with a hash reference of options.
 
         my %options = (
             cpustats => 1,
@@ -226,11 +226,11 @@
         my $lxs = Sys::Statistics::Linux->new(\%options);
 
   set()
-    Call "set()" to activate or deactivate options.
-
-    The following example would call "new()" and initialize
-    "Sys::Statistics::Linux::CpuStats" and delete the object of
-    "Sys::Statistics::Linux::SysInfo".
+    Call `set()' to activate or deactivate options.
+
+    The following example would call `new()' and initialize
+    `Sys::Statistics::Linux::CpuStats' and delete the object of
+    `Sys::Statistics::Linux::SysInfo'.
 
         $lxs->set(
             processes =>  0, # deactivate this statistic
@@ -238,7 +238,7 @@
             netstats  =>  2, # activate the statistic and call new() if necessary but not init()
         );
 
-    It's possible to call "set()" with a hash reference of options.
+    It's possible to call `set()' with a hash reference of options.
 
         my %options = (
             cpustats => 2,
@@ -248,14 +248,14 @@
         $lxs->set(\%options);
 
   get()
-    Call "get()" to get the collected statistics. "get()" returns a
+    Call `get()' to get the collected statistics. `get()' returns a
     Sys::Statistics::Linux::Compilation object.
 
         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()".
+    Or you can pass the time to sleep with the call of `get()'.
 
         my $stat = $lxs->get($time_to_sleep);
 
@@ -271,10 +271,10 @@
     for more information.
 
   init()
-    The call of "init()" initiate all activated statistics that are
+    The call of `init()' initiate all activated statistics that are
     necessary for deltas. That could be helpful if your script runs in a
     endless loop with a high sleep interval. Don't forget that if you call
-    "get()" that the statistics are deltas since the last time they were
+    `get()' that the statistics are deltas since the last time they were
     initiated.
 
     The following example would calculate average statistics for 30 minutes:
@@ -315,19 +315,19 @@
         }
 
   settime()
-    Call "settime()" to define a POSIX formatted time stamp, generated with
+    Call `settime()' to define a POSIX formatted time stamp, generated with
     localtime().
 
         $lxs->settime('%Y/%m/%d %H:%M:%S');
 
-    To get more information about the formats take a look at "strftime()" of
-    POSIX.pm or the manpage strftime(3).
+    To get more information about the formats take a look at `strftime()' of
+    POSIX.pm or the manpage `strftime(3)'.
 
   gettime()
-    "gettime()" returns a POSIX formatted time stamp, @foo in list and $bar
+    `gettime()' returns a POSIX formatted time stamp, @foo in list and $bar
     in scalar context. If the time format isn't set then the default format
     "%Y-%m-%d %H:%M:%S" will be set automatically. You can also set a time
-    format with "gettime()".
+    format with `gettime()'.
 
         my $date_time = $lxs->gettime;
 
@@ -370,7 +370,7 @@
         print $lxs->gettime, "\n";
 
     If you want to know how the data structure looks like you can use
-    "Data::Dumper" to check it:
+    `Data::Dumper' to check it:
 
         use strict;
         use warnings;
@@ -398,7 +398,7 @@
     The old options and keys - CpuStats, NetStats, etc - are still available
     but deprecated! It's not possible to access the statistics via
     Sys::Statistics::Linux::Compilation and it's not possible to call
-    "search()" and "psfind()" if you use the old options.
+    `search()' and `psfind()' if you use the old options.
 
     You should use the new options and access the statistics over the
     accessors

Modified: trunk/libsys-statistics-linux-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsys-statistics-linux-perl/debian/changelog?rev=76287&op=diff
==============================================================================
--- trunk/libsys-statistics-linux-perl/debian/changelog (original)
+++ trunk/libsys-statistics-linux-perl/debian/changelog Wed Jun 22 21:18:06 2011
@@ -1,12 +1,14 @@
-libsys-statistics-linux-perl (0.59-2) UNRELEASED; urgency=low
+libsys-statistics-linux-perl (0.60-1) UNRELEASED; urgency=low
+
+  [ Ansgar Burchardt ]
+  * Email change: Ansgar Burchardt -> ansgar at debian.org
 
   [ Salvatore Bonaccorso ]
-  * Update my email address.
+  * New upstream release
+  * Email change: Salvatore Bonaccorso -> carnil at debian.org
+  * debian/copyright: Update copyright years for debian/* packaging.
 
-  [ Ansgar Burchardt ]
-  * Update my email address.
-
- -- Salvatore Bonaccorso <carnil at debian.org>  Sun, 10 Oct 2010 15:03:39 +0200
+ -- Salvatore Bonaccorso <carnil at debian.org>  Wed, 22 Jun 2011 23:17:20 +0200
 
 libsys-statistics-linux-perl (0.59-1) unstable; urgency=low
 

Modified: trunk/libsys-statistics-linux-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsys-statistics-linux-perl/debian/copyright?rev=76287&op=diff
==============================================================================
--- trunk/libsys-statistics-linux-perl/debian/copyright (original)
+++ trunk/libsys-statistics-linux-perl/debian/copyright Wed Jun 22 21:18:06 2011
@@ -15,7 +15,7 @@
  2009, Ryan Niebur <ryan at debian.org>
  2009, gregor herrmann <gregoa at debian.org>
  2010, Ansgar Burchardt <ansgar at debian.org>
- 2010, Salvatore Bonaccorso <carnil at debian.org>
+ 2010, 2011, Salvatore Bonaccorso <carnil at debian.org>
 License: Artistic or GPL-1+
 
 License: Artistic

Modified: trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux.pm?rev=76287&op=diff
==============================================================================
--- trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux.pm (original)
+++ trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux.pm Wed Jun 22 21:18:06 2011
@@ -433,7 +433,7 @@
 =cut
 
 package Sys::Statistics::Linux;
-our $VERSION = '0.59';
+our $VERSION = '0.60';
 
 use strict;
 use warnings;

Modified: trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux/Processes.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux/Processes.pm?rev=76287&op=diff
==============================================================================
--- trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux/Processes.pm (original)
+++ trunk/libsys-statistics-linux-perl/lib/Sys/Statistics/Linux/Processes.pm Wed Jun 22 21:18:06 2011
@@ -80,6 +80,18 @@
     # or with
     Sys::Statistics::Linux::Processes->new(pages_to_bytes => 4096);
 
+Generated by F</proc/E<lt>pidE<gt>/io>.
+
+    rchar                 -  Bytes read from storage (might have been from pagecache).
+    wchar                 -  Bytes written.
+    syscr                 -  Number of read syscalls.
+    syscw                 -  Numner of write syscalls.
+    read_bytes            -  Bytes really fetched from storage layer.
+    write_bytes           -  Bytes sent to the storage layer.
+    cancelled_write_bytes -  Refer to docs.
+
+See Documentation/filesystems/proc.txt for more (from kernel 2.6.20)
+
 =head1 METHODS
 
 =head2 new()
@@ -105,6 +117,7 @@
             cmdline => 'cmdline',
             wchan   => 'wchan',
             fd      => 'fd',
+            io      => 'io',
         }
     );
 
@@ -165,7 +178,7 @@
 use Time::HiRes;
 use constant NUMBER => qr/^-{0,1}\d+(?:\.\d+){0,1}\z/;
 
-our $VERSION = '0.32';
+our $VERSION = '0.34';
 our $PAGES_TO_BYTES = 0;
 
 sub new {
@@ -182,6 +195,7 @@
             cmdline => 'cmdline',
             wchan   => 'wchan',
             fd      => 'fd',
+            io      => 'io',
         },
     );
 
@@ -267,6 +281,13 @@
             delete $stats{$pid};
             next;
         }
+        if (open my $fh, '<', "$file->{path}/$pid/$file->{io}") {
+            while (my $line = <$fh>) {
+                next unless $line =~ /^([a-z_]+): (\d+)/;
+                $stats{$pid}{io}{$1} = $2;
+            }
+            close($fh);
+        }
     }
 
     return \%stats;
@@ -295,6 +316,14 @@
     }
 
     PID: foreach my $pid (@$pids) {
+
+        if (open my $fh, '<', "$file->{path}/$pid/$file->{io}") {
+            while (my $line = <$fh>) {
+                next unless $line =~ /^([a-z_]+):\s+(\d+)/;
+                $stats{$pid}{io}{$1} = $2;
+            }
+            close($fh);
+        }
 
         # memory usage for each process
         if (open my $fh, '<', "$file->{path}/$pid/$file->{statm}") {
@@ -438,7 +467,23 @@
                     $lpid->{$k} = sprintf('%.2f', $lpid->{$k});
                 }
             }
+
             $lpid->{ttime} = sprintf('%.2f', $lpid->{stime} + $lpid->{utime});
+
+            for my $k (qw(rchar wchar syscr syscw read_bytes write_bytes cancelled_write_bytes)) {
+                if(defined $ipid->{io}->{$k} && defined $lpid->{io}->{$k}){
+                    if($ipid->{io}->{$k} !~ NUMBER || $lpid->{io}->{$k} !~ NUMBER){
+                        croak "$class: invalid value for io key '$k'";
+                    }
+                    $lpid->{io}->{$k} -= $ipid->{io}->{$k};
+                    $ipid->{io}->{$k} += $lpid->{io}->{$k};
+                    if ($lpid->{io}->{$k} > 0 && $time > 0) { 
+                        $lpid->{io}->{$k} = sprintf('%.2f', $lpid->{io}->{$k} / $time);
+                    } else {
+                        $lpid->{io}->{$k} = sprintf('%.2f', $lpid->{io}->{$k});
+                    }
+                }
+            }
         } else {
             # calculate the statistics since process creation
             for my $k (qw(minflt cminflt mayflt cmayflt utime stime cutime cstime)) {
@@ -451,6 +496,18 @@
                     $lpid->{$k} = sprintf('%.2f', $lpid->{$k});
                 }
             }
+
+            for my $k (qw(rchar wchar syscr syscw read_bytes write_bytes cancelled_write_bytes)) {
+                my $p_uptime = $uptime - $lpid->{sttime} / 100;
+                $istat->{$pid}->{io}->{$k} = $lpid->{io}->{$k};
+
+                if ($p_uptime > 0) {
+                    $lpid->{io}->{$k} = sprintf('%.2f', $lpid->{io}->{$k} / $p_uptime);
+                } else {
+                    $lpid->{io}->{$k} = sprintf('%.2f', $lpid->{io}->{$k});
+                }
+            }
+
             $lpid->{ttime} = sprintf('%.2f', $lpid->{stime} + $lpid->{utime});
             $istat->{$pid}->{sttime} = $lpid->{sttime};
         }




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