add more options
This commit is contained in:
parent
a0b93b9127
commit
fc6a16ae1e
|
@ -12,19 +12,31 @@ sub version{
|
||||||
sub help{
|
sub help{
|
||||||
print '
|
print '
|
||||||
|
|
||||||
-z Show zombies procs.
|
-c <regex> Search procs using the matching regex.
|
||||||
-s Show swapped out procs.
|
--ci Invert the command search.
|
||||||
|
|
||||||
-p <regex> Search procs using the matching regex.
|
-m <pctmem> Memory usage percent to search for.
|
||||||
|
--mi Invert the memory usage search.
|
||||||
|
|
||||||
-u <users> A string search for users.
|
-p <pctcpu> CPU usage percent to search for.
|
||||||
|
--pi Invert the CPU usage search.
|
||||||
|
|
||||||
-t <time search> A numeric search for CPU time-c <pctcpu search> A numeric search for CPU usage percent
|
--pid <pids> PIDs to search for.
|
||||||
|
--pidi Invert the PID search.
|
||||||
|
|
||||||
-m <pctmem search> A numeric search for memory usage percent
|
-r <RSSs> A comma seperated list of RSS values to search for.
|
||||||
|
--ri Invert the RSS search.
|
||||||
|
|
||||||
-w <wait channels> A string search for wait channels.
|
-s Show swapped out procs.
|
||||||
--wi
|
--si Invert the swapped out search.
|
||||||
|
|
||||||
|
-t <times> A comma seperated value of time, in seconds, to search for.
|
||||||
|
--ti Invert the time search.
|
||||||
|
|
||||||
|
-w <wchans> A string search for wait channels.
|
||||||
|
--wi Invert the wait channel search.
|
||||||
|
|
||||||
|
-z Show zombies procs.
|
||||||
|
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
|
@ -32,8 +44,23 @@ sub help{
|
||||||
# defaults
|
# defaults
|
||||||
my $wait_channels_string;
|
my $wait_channels_string;
|
||||||
my $wait_channels_invert=0;
|
my $wait_channels_invert=0;
|
||||||
|
my $zombie=0,
|
||||||
|
my $swapped=0,
|
||||||
|
my $swapped_invert=0;
|
||||||
my $version;
|
my $version;
|
||||||
my $help;
|
my $help;
|
||||||
|
my $commands_string;
|
||||||
|
my $commands_invert=0;
|
||||||
|
my $pids_string;
|
||||||
|
my $pids_invert=0;
|
||||||
|
my $cpu_string;
|
||||||
|
my $cpu_invert=0;
|
||||||
|
my $mem_string;
|
||||||
|
my $mem_invert=0;
|
||||||
|
my $rss_string;
|
||||||
|
my $rss_invert=0;
|
||||||
|
my $time_string;
|
||||||
|
my $time_invert=0;
|
||||||
|
|
||||||
# get the commandline options
|
# get the commandline options
|
||||||
Getopt::Long::Configure ('no_ignore_case');
|
Getopt::Long::Configure ('no_ignore_case');
|
||||||
|
@ -45,6 +72,21 @@ GetOptions(
|
||||||
'help' => \$help,
|
'help' => \$help,
|
||||||
'v' => \$version,
|
'v' => \$version,
|
||||||
'version' => \$version,
|
'version' => \$version,
|
||||||
|
'z'=> \$zombie,
|
||||||
|
's'=> \$swapped,
|
||||||
|
'si' => \$swapped_invert,
|
||||||
|
'c=s' => \$commands_string,
|
||||||
|
'ci' => \$commands_invert,
|
||||||
|
'pid=s' => \$pids_string,
|
||||||
|
'pidi' => \$pids_invert,
|
||||||
|
'p=s' => \$cpu_string,
|
||||||
|
'pi' => \$cpu_invert,
|
||||||
|
'm=s' => \$mem_string,
|
||||||
|
'mi' => \$mem_invert,
|
||||||
|
'r=s' => \$rss_string,
|
||||||
|
'ri' => \$rss_invert,
|
||||||
|
't=s' => \$time_string,
|
||||||
|
'ti' => \$time_invert,
|
||||||
);
|
);
|
||||||
|
|
||||||
# print the version info if requested
|
# print the version info if requested
|
||||||
|
@ -75,6 +117,101 @@ if ( defined( $wait_channels_string ) ){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# handles swappped procs search
|
||||||
|
#
|
||||||
|
if ( $swapped ){
|
||||||
|
push( @filters, {
|
||||||
|
type=>'Swapped',
|
||||||
|
invert=>$swapped_invert,
|
||||||
|
args=>{},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# handles the commands search
|
||||||
|
#
|
||||||
|
if ( defined( $commands_string ) ){
|
||||||
|
my @commands=split(/\,/, $commands_string );
|
||||||
|
push( @filters, {
|
||||||
|
type=>'Command',
|
||||||
|
invert=>$commands_invert,
|
||||||
|
args=>{
|
||||||
|
commands=>\@commands,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# handles the PIDs search
|
||||||
|
#
|
||||||
|
if ( defined( $pids_string ) ){
|
||||||
|
my @pids=split(/\,/, $pids_string );
|
||||||
|
push( @filters, {
|
||||||
|
type=>'PID',
|
||||||
|
invert=>$pids_invert,
|
||||||
|
args=>{
|
||||||
|
pids=>\@pids,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# handles the CPU search
|
||||||
|
#
|
||||||
|
if ( defined( $cpu_string ) ){
|
||||||
|
my @cpus=split(/\,/, $cpu_string );
|
||||||
|
push( @filters, {
|
||||||
|
type=>'PctCPU',
|
||||||
|
invert=>$cpu_invert,
|
||||||
|
args=>{
|
||||||
|
pctcpus=>\@cpus,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# handles the memory search
|
||||||
|
#
|
||||||
|
if ( defined( $mem_string ) ){
|
||||||
|
my @mems=split(/\,/, $mem_string );
|
||||||
|
push( @filters, {
|
||||||
|
type=>'PctMem',
|
||||||
|
invert=>$mem_invert,
|
||||||
|
args=>{
|
||||||
|
pctmems=>\@mems,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# handles the RSS search
|
||||||
|
#
|
||||||
|
if ( defined( $rss_string ) ){
|
||||||
|
my @rss=split(/\,/, $rss_string );
|
||||||
|
push( @filters, {
|
||||||
|
type=>'RSS',
|
||||||
|
invert=>$rss_invert,
|
||||||
|
args=>{
|
||||||
|
rss=>\@rss,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# handles the time search
|
||||||
|
#
|
||||||
|
if ( defined( $time_string ) ){
|
||||||
|
my @times=split(/\,/, $time_string );
|
||||||
|
push( @filters, {
|
||||||
|
type=>'Time',
|
||||||
|
invert=>$time_invert,
|
||||||
|
args=>{
|
||||||
|
times=>\@times,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
my $args={
|
my $args={
|
||||||
invert=>0,
|
invert=>0,
|
||||||
match=>{
|
match=>{
|
||||||
|
|
Loading…
Reference in New Issue