add state support

This commit is contained in:
Zane C. B-H 2019-08-21 05:53:58 -05:00
parent fc6a16ae1e
commit e678886a80
1 changed files with 21 additions and 0 deletions

View File

@ -30,6 +30,9 @@ sub help{
-s Show swapped out procs.
--si Invert the swapped out search.
--st <states> A comma seperated list of states to search for.
--sti Invert the state search.
-t <times> A comma seperated value of time, in seconds, to search for.
--ti Invert the time search.
@ -61,6 +64,8 @@ my $rss_string;
my $rss_invert=0;
my $time_string;
my $time_invert=0;
my $states_string;
my $states_invert=0;
# get the commandline options
Getopt::Long::Configure ('no_ignore_case');
@ -87,6 +92,8 @@ GetOptions(
'ri' => \$rss_invert,
't=s' => \$time_string,
'ti' => \$time_invert,
'st=s' => \$states_string,
'sti' => \$states_invert,
);
# print the version info if requested
@ -212,6 +219,20 @@ if ( defined( $time_string ) ){
});
}
#
# 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,
match=>{