Browse Source

add cmin/cmaj faults

master
Zane C. B-H 2 years ago
parent
commit
cd4526dc68
  1. 10
      Proc-ProcessTable-ncps/bin/ncps
  2. 34
      Proc-ProcessTable-ncps/lib/Proc/ProcessTable/ncps.pm

10
Proc-ProcessTable-ncps/bin/ncps

@ -15,6 +15,10 @@ sub help{
-c <regex> Search procs using the matching regex.
--ci Invert the command search.
--cf Show children minor faults.
--cF Show children major faults.
-m <pctmem> Memory usage percent to search for.
--mi Invert the memory usage search.
@ -72,6 +76,8 @@ my $states_string;
my $states_invert=0;
my $minor_faults=0;
my $major_faults=0;
my $cminor_faults=0;
my $cmajor_faults=0;
# get the commandline options
Getopt::Long::Configure ('no_ignore_case');
@ -102,6 +108,8 @@ GetOptions(
'sti' => \$states_invert,
'f' => \$minor_faults,
'F' => \$major_faults,
'cf' => \$cminor_faults,
'cF' => \$cmajor_faults,
);
# print the version info if requested
@ -243,6 +251,8 @@ if ( defined( $states_string ) ){
my $args={
invert=>0,
cmajor_faults=>$cmajor_faults,
cminor_faults=>$cminor_faults,
major_faults=>$major_faults,
minor_faults=>$minor_faults,
match=>{

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

@ -79,6 +79,14 @@ sub new {
$self->{minor_faults}=$args{minor_faults};
}
if ( defined( $args{cmajor_faults} ) ){
$self->{cmajor_faults}=$args{cmajor_faults};
}
if ( defined( $args{cminor_faults} ) ){
$self->{cminor_faults}=$args{cminor_faults};
}
return $self;
}
@ -178,6 +186,18 @@ sub run{
if (( $header_int % 2 ) != 0){ $padding=1; }else{ $padding=0; }
$tb->set_column_style($header_int, pad => $padding ); $header_int++;
}
# add children major faults if needed
if ( $self->{cmajor_faults} ){
push( @headers, 'cMajF' );
if (( $header_int % 2 ) != 0){ $padding=1; }else{ $padding=0; }
$tb->set_column_style($header_int, pad => $padding ); $header_int++;
}
# add children minor faults if needed
if ( $self->{minor_faults} ){
push( @headers, 'cminF' );
if (( $header_int % 2 ) != 0){ $padding=1; }else{ $padding=0; }
$tb->set_column_style($header_int, pad => $padding ); $header_int++;
}
if (( $header_int % 2 ) != 0){ $padding=1; }else{ $padding=0; }
$tb->set_column_style($header_int, pad => $padding ); $header_int++;
push( @headers, 'Start' );
@ -372,6 +392,20 @@ sub run{
push( @new_line, color($self->nextColor).$proc->{minflt}.color('reset') );
}
#
# children major faults
#
if ( $self->{cmajor_faults} ){
push( @new_line, color($self->nextColor).$proc->{cmajflt}.color('reset') );
}
#
# children major faults
#
if ( $self->{cminor_faults} ){
push( @new_line, color($self->nextColor).$proc->{cminflt}.color('reset') );
}
#
# handles the start column
#

Loading…
Cancel
Save