Linux-Info

 view release on metacpan or  search on metacpan

lib/Linux/Info/ProcStats.pm  view on Meta::CPAN

    my $self  = shift;
    my $class = ref $self;
    my $file  = $self->{files};
    my $lavg  = $self->_procs;

    my $filename =
      $file->{path} ? "$file->{path}/$file->{loadavg}" : $file->{loadavg};
    open my $fh, '<', $filename
      or croak "$class: unable to open $filename ($!)";
    ( $lavg->{runqueue}, $lavg->{count} ) =
      ( split m@/@, ( split /\s+/, <$fh> )[3] );
    close($fh);

    return $lavg;
}

sub _procs {
    my $self  = shift;
    my $class = ref $self;
    my $file  = $self->{files};
    my %stat  = ();



( run in 2.573 seconds using v1.01-cache-2.11-cpan-71847e10f99 )