Proc::ProcessTable::Colorizer - Like ps, but with colored columns and enhnaced functions for searching.
Version 0.2.0
use Proc::ProcessTable::Colorizer; my $cps = Proc::ProcessTable::Colorizer->new; print $cps->colorize;
This module uses Error::Helper for error reporting.
As of right now this module is not really user friend and will likely be going through lots of changes as it grows.
Linux is also not as well supported given the limitations of Proc::ProcessTable and there is nothig similar to BSD::Process for Linux.
Creates a new object. This method will never error.
my $cps=Proc::ProcessTable::Colorizer->new;
This colorizes it and returns a setup Text::Table object with everything already setup.
Gets a hash of possible fields from Proc::ProcessTable as an hash.
This is really meant as a internal function.
Gets the currently set fields.
Returns a array ref of current fields to be printed.
my $fields=$cps->fieldsGet;
Returns the next color.
my $nextColor=$cps->nextColor;
Resets the next color to the first one.
Returns a list of current fields to be printed.
my @fields=$cps->fieldsGet;
Returns the current value for the PCT CPU search.
The return is a array ref.
my $pctcpu_search=$cps->pctcpuSearchGet;
Search for procs based on the CPU usage.
The following equalities are understood.
<= < > >=
The string may contain multiple values seperated by a comma. Checking will stop after the first hit.
If the string is undef, all procs will be shown.
#search for procs with less than 60% of CPU usage $cps->pctcpuSearchSetString('<60'); #shows procs with greater than 60% of CPU usage $cps->pctcpuSearchSetString('>60');
Returns the current value for the PCT MEM search.
my $pctmem_search=$cps->pctmemSearchGet;
Search for procs based on the memory usage.
#search for procs with less than 60% of the memory $cps->pctmemSearchSetString('<60'); #shows procs with greater than 60% of the memory $cps->pctmemSearchSetString('>60');
my $timeColors=$cps->processColorGet;
This returns the search string value that will be used for matching the proc column.
The return is undefined if one is not set.
my $search_regex=$cps->procSearchGet; if ( defined( $search_regex ) ){ print "search regex: ".$search_regex."\n"; }else{ print "No search regex.\n"; }
This sets the proc column search regex to use.
If set to undef(the default), then it will show all procs.
#shows everything $cps->procSearchSet( undef ); #search for only those matching musicpd $cps->procSeearchSet( 'musicpd' ); #search for those that match /[Zz]whatever/ $cps->procSearchSet( '[Zz]whatever' );
Wether or not to show the PID of this processes in the list.
Resets it to the default, 2.
Always show self PID in the list.
Never show self PID in the list.
Don't show self PID if it is a search.
This is the default.
Generates a short time string based on the supplied unix time.
Returns the current value for the swapped out search.
The return is a Perl boolean.
my $swappedOut_search=$cps->swappedOutSearchGet; if ( $swappedOut_search ){ print "only swapped out procs will be shown"; }
Sets the swapped out search value.
The value taken is a Perl boolean.
$cps->swappedOutSearchSet( 1 );
my $timeColors=$cps->timeColorsGet;
Returns the current value for the time search.
my $time_search=$cps->waitSearchGet;
Search for procs based on the CPU time value.
If the string is undef, all wait channels will be shown.
#search for procs with less than 60 seconds of CPU time $cps->waitSearchSetString('<69'); #shows procs with less than 60 seconds and greater 120 seconds $cps->waitSearchSetString('<60,>120');
Turns the raw run string into something usable.
This returns a colorized item.
my $time=$cps->timeString( $seconds );
This gets the user to be searched for and if it should be inverted or not.
This returns an array reference of users to search for.
An selection can be inverted via !.
my $user_search=$cps->userSearchGet;
This takes a string to set the user search for.
The string may contain multiple users seperated by a comma.
If the string is undef, all users will be shown.
#search for user foo and bar $cps->userSearchSetString('foo,bar'); #show users not matching foo $cps->userSearchSetString('!foo'); #show all users, clearing any previous settings $cps->userSearchSetString;
Returns the current value for the wait search.
my $wait_search=$cps->waitSearchGet;
This takes a string to set the wait channel search for.
#search for wait channel wait and sleep $cps->waitSearchSetString('wait,sleep'); #shows wait channels not matching sbwait $cps->waitSearchSetString('!sbwait'); #show all users, clearing any previous settings $cps->waitSearchSetString;
Returns the current value for the zombie search.
my $zombie_search=$cps->zombieSearchGet; if ( $zombie_search ){ print "only zombie procs will be shown"; }
Sets the zombie search value.
$cps->zombieSearchSet( 1 );
These corresponds to Term::ANSIColor colors.
The color column is not a single color, but multiple depending on the amount of time.
The default is as below.
'GREEN', seconds 'BRIGHT_GREEN', minutes 'RED', hours 'BRIGHT_RED', 10+ hours
The non-proc/time columns are colored in a rotating color sequence.
BRIGHT_YELLOW BRIGHT_CYAN BRIGHT_MAGENTA BRIGHT_BLUE
The time search string contains errors.
The PCT CPU search string contains errors.
The PCT MEM search string contains errors.
Zane C. Bowers-Hadley, <vvelox at vvelox.net>
<vvelox at vvelox.net>
Please report any bugs or feature requests to bug-proc-processtable-colorizer at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Proc-ProcessTable-Colorizer. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-proc-processtable-colorizer at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Proc::ProcessTable::Colorizer
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Proc-ProcessTable-Colorizer
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Proc-ProcessTable-Colorizer
CPAN Ratings
http://cpanratings.perl.org/d/Proc-ProcessTable-Colorizer
Search CPAN
http://search.cpan.org/dist/Proc-ProcessTable-Colorizer/
Copyright 2017 Zane C. Bowers-Hadley.
This program is distributed under the (Simplified) BSD License: http://www.opensource.org/licenses/BSD-2-Clause
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
To install Proc::ProcessTable::Colorizer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Proc::ProcessTable::Colorizer
CPAN shell
perl -MCPAN -e shell install Proc::ProcessTable::Colorizer
For more information on module installation, please visit the detailed CPAN module installation guide.