add vsz searching

This commit is contained in:
Zane C. B-H 2019-08-25 02:13:29 -05:00
parent 1039a1dc5b
commit 1758d71298
1 changed files with 40 additions and 17 deletions

View File

@ -69,12 +69,15 @@ sub help{
--tty Show TTYs.
-w <wchans> A string search for wait channels.
--wi Invert the wait channel search.
-u <UIDs> A comma seperated list of UIDs or usernames.
--ui Invert the UID/username search.
-vs <VSZs> A comma seperated list of VSZs to search for.
--vsi Invert the VSZ search.
-w <wchans> A string search for wait channels.
--wi Invert the wait channel search.
-z Show zombies procs.
';
@ -123,6 +126,8 @@ my $idle=0;
my $stats=0;
my $kern=0;
my $kern_invert=0;
my $vsz_string;
my $vsz_invert=0;
# get the commandline options
Getopt::Long::Configure ('no_ignore_case');
@ -172,6 +177,8 @@ GetOptions(
'stats' => \$stats,
'kern' => \$kern,
'kerni' => \$kern_invert,
'vs=s' => \$vsz_string,
'vsi' => \$vsz_invert,
);
# print the version info if requested
@ -325,6 +332,20 @@ if ( defined( $uids_string ) ){
});
}
#
# handles the virtual size search
#
if ( defined( $vsz_string ) ){
my @vszs=split(/\,/, $vsz_string );
push( @filters, {
type=>'Size',
invert=>$vsz_invert,
args=>{
sizes=>\@vszs,
},
});
}
#
# handles the kernel process search
#
@ -361,6 +382,22 @@ if ( $egid ){
});
}
#
# handles the states search
#
if ( defined( $states_string ) ){
my @states=split(/\,/, $states_string );
push( @filters, {
type=>'State',
invert=>$states_invert,
args=>{
states=>\@states,
},
});
}
# XOR common boolean CLI flags
if ( defined( $ENV{NCPS_jid} ) ){
$jid = $jid ^ 1;
@ -427,20 +464,6 @@ if ( ! $idle ){
});
}
#
# handles the time search
#
if ( defined( $states_string ) ){
my @states=split(/\,/, $states_string );
push( @filters, {
type=>'State',
invert=>$states_invert,
args=>{
states=>\@states,
},
});
}
my $args={
invert=>0,
cmajor_faults=>$cmajor_faults,