Browse Source

more work on ncps and the module

master
Zane C. B-H 2 years ago
parent
commit
a0b93b9127
  1. 51
      Proc-ProcessTable-ncps/bin/ncps
  2. 6
      Proc-ProcessTable-ncps/lib/Proc/ProcessTable/ncps.pm

51
Proc-ProcessTable-ncps/bin/ncps

@ -24,13 +24,62 @@ sub help{
-m <pctmem search> A numeric search for memory usage percent
-w <wait channels> A string search for wait channels.
--wi
';
}
# defaults
my $wait_channels_string;
my $wait_channels_invert=0;
my $version;
my $help;
# get the commandline options
Getopt::Long::Configure ('no_ignore_case');
Getopt::Long::Configure ('bundling');
GetOptions(
'w=s' => \$wait_channels_string,
'wi' => \$wait_channels_invert,
'h' => \$help,
'help' => \$help,
'v' => \$version,
'version' => \$version,
);
# print the version info if requested
if ( $version ){
&version;
exit;
}
if ( $help ){
&version;
&help;
exit;
}
my @filters;
#
# handles wait channels
#
if ( defined( $wait_channels_string ) ){
my @wchans=split(/\,/, $wait_channels_string );
push( @filters, {
type=>'WChan',
invert=>$wait_channels_invert,
args=>{
wchans=>\@wchans,
},
});
}
my $args={
invert=>0,
match=>{
checks=>\@filters,
}
};
my $ncps=Proc::ProcessTable::ncps->new( $args );

6
Proc-ProcessTable-ncps/lib/Proc/ProcessTable/ncps.pm

@ -47,7 +47,11 @@ sub new {
};
bless $self;
if ( defined( $args{match} ) ){
if (
defined( $args{match} ) &&
defined( $args{match}{checks} ) &&
defined( $args{match}{checks}[0] )
){
$self->{match}=Proc::ProcessTable::Match->new( $args{match} );
}

Loading…
Cancel
Save