misc documentation cleanups

use require instead of use for BSD::Process

only init BSD::Process once now instead of multiple times for each proc


git-svn-id: svn://127.0.0.1/Perl/Proc-ProcessTable-Colorizer/trunk@974 0c1c3402-1be1-de11-8092-0022686faf23
This commit is contained in:
Zane C. B-H 2017-11-07 06:43:53 +00:00
parent 3134d9e8e7
commit 71c138d6a6
2 changed files with 14 additions and 19 deletions

View File

@ -10,12 +10,12 @@ Among other fun things, it allows searching of the process table.
Searching is currently possible against the folowing criteria.
zombie
swapped out
regex command line matching
CPU seconds used by a process
percent of memory usage
percent of CPU usage
wait channel in use
swapped out
regex command line matching
CPU seconds used by a process
percent of memory usage
percent of CPU usage
wait channel in use
INSTALLATION

View File

@ -10,7 +10,7 @@ use Text::Table;
use Term::Size;
if ( $^O =~ /bsd/ ){
use BSD::Process;
require BSD::Process;
}
=head1 NAME
@ -19,11 +19,11 @@ Proc::ProcessTable::Colorizer - Like ps, but with colored columns and enhnaced f
=head1 VERSION
Version 0.0.0
Version 0.1.0
=cut
our $VERSION = '0.0.0';
our $VERSION = '0.1.0';
=head1 SYNOPSIS
@ -165,6 +165,11 @@ sub colorize{
#goes through it all and gathers the information
foreach my $proc ( @{$pt->table} ){
my $bproc;
if ($^O =~ /bsd/){
$bproc=BSD::Process::info( $proc->pid );
}
#process the requested fields
$fieldInt=0;
@ -176,8 +181,6 @@ sub colorize{
($^O =~ /bsd/) &&
( $field =~ /pctcpu/ )
){
my $bproc=BSD::Process::info( $proc->pid );
my $pctcpu=$bproc->{pctcpu};
if ( ! defined( $pctcpu ) ){
@ -193,8 +196,6 @@ sub colorize{
($^O =~ /bsd/) &&
( $field =~ /pctmem/ )
){
use BSD::Process;
my $bproc=BSD::Process::info( $proc->pid );
my $rss=$bproc->{rssize};
if ( defined( $rss ) ){
$rss=$rss*1024*4;
@ -211,8 +212,6 @@ sub colorize{
($^O =~ /bsd/) &&
( $field =~ /size/ )
){
my $bproc=BSD::Process::info( $proc->pid );
$values{size}=$bproc->{size};
}elsif(
($^O =~ /bsd/) &&
@ -241,9 +240,7 @@ sub colorize{
#may possible be a zombie, run checks for on FreeBSD
if ($^O =~ /bsd/){
my $bproc=BSD::Process::info( $proc->pid );
$kernel_proc=$bproc->{kthread};
}
#need to find something similar as above for Linux
@ -272,7 +269,6 @@ sub colorize{
$values{state}=$proc->state;
if ($^O =~ /bsd/){
my $bproc=BSD::Process::info( $proc->pid );
$values{controlling_tty_active}=$bproc->{isctty};
$values{is_session_leader}=$bproc->{issleader};
$values{is_being_forked}=$bproc->{stat_1};
@ -282,7 +278,6 @@ sub colorize{
$values{traced_by_debugger}=$bproc->{traced};
$values{is_stopped}=$bproc->{stat_4};
$values{posix_advisory_lock}=$bproc->{advlock};
}
}else{