App-Iops

 view release on metacpan or  search on metacpan

lib/App/Iops.pm  view on Meta::CPAN

package App::Iops;
BEGIN {
  $App::Iops::VERSION = '0.006';
}

=head1 NAME

App::Iops - Show process I/O operations

=head1 VERSION

version 0.006

=head1 SYNOPSIS

  iops [options]

      --pid [pid]
      --help

=head1 DESCRIPTION

Summarize a process's I/O operations in real time.

Attach to an existing process:

  $ iops -p 3251
  read /dev/random...............................
  write /var/log/message..
  close /dev/random

=head1 API

Methods are still subject to change.

=head2 new

Returns a new object.

=over

=item help

  use App::Iops;
  App::Iops->new( 'help' )->run;

Prints the help and exits. This is very side-effectful. This might
throw exceptions.

=item pid => $pid

  use App::Iops;
  App::Iops->new( pid => $a_pid )->run;

Associates a process id to attach to.

=back

=head2 run

Actually executes whatever action was requested.

=head1 THANKS TO

Thanks to the following people:

=over

=item Alan Haggai Alavi

=back

=cut

use strict;

use English '-no_match_vars';
use Getopt::Long ();
use Pod::Usage ();

sub new {
    my $class = shift;
    my $self = {
        pid        => undef,
        strace_pid => undef,
        strace_fh  => undef,
        files      => {},
        prev       => '',
        @_
    };
    bless $self, $class;

    $self->_read_arguments( @_ );

    return $self;
}

sub run {
    my $self = shift;

    if ($self->{help}) {
        Pod::Usage::pod2usage(
            -exitval => 0,
            -verbose => 2,
        );
    }
    else {
        $self->_proc_readlinks;



( run in 1.045 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )