Browse Source

display numthr

master
Zane C. B-H 2 years ago
parent
commit
a55e685a32
  1. 5
      Proc-ProcessTable-ncps/bin/ncps
  2. 17
      Proc-ProcessTable-ncps/lib/Proc/ProcessTable/ncps.pm

5
Proc-ProcessTable-ncps/bin/ncps

@ -26,6 +26,8 @@ sub help{
-F Show major faults.
-n Show number of threads.
-p <pctcpu> CPU usage percent to search for.
--pi Invert the CPU usage search.
@ -78,6 +80,7 @@ my $minor_faults=0;
my $major_faults=0;
my $cminor_faults=0;
my $cmajor_faults=0;
my $numthr=0;
# get the commandline options
Getopt::Long::Configure ('no_ignore_case');
@ -110,6 +113,7 @@ GetOptions(
'F' => \$major_faults,
'cf' => \$cminor_faults,
'cF' => \$cmajor_faults,
'n' => \$numthr,
);
# print the version info if requested
@ -255,6 +259,7 @@ my $args={
cminor_faults=>$cminor_faults,
major_faults=>$major_faults,
minor_faults=>$minor_faults,
numthr=>$numthr,
match=>{
checks=>\@filters,
}

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

@ -87,6 +87,10 @@ sub new {
$self->{cminor_faults}=$args{cminor_faults};
}
if ( defined( $args{numthr} ) ){
$self->{numthr}=$args{numthr};
}
return $self;
}
@ -198,6 +202,12 @@ sub run{
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->{numthr} ){
push( @headers, 'Thr' );
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' );
@ -406,6 +416,13 @@ sub run{
push( @new_line, color($self->nextColor).$proc->{cminflt}.color('reset') );
}
#
# number of threads
#
if ( $self->{numthr} ){
push( @new_line, color($self->nextColor).$proc->{numthr}.color('reset') );
}
#
# handles the start column
#

Loading…
Cancel
Save