|
NAMEProc::ProcessTable::Colorizer - Like ps, but with colored columns and enhnaced functions for searching.VERSIONVersion 0.3.0SYNOPSISuse 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. METHODSnewCreates a new object. This method will never error.my $cps=Proc::ProcessTable::Colorizer->new; colorizeThis colorizes it and returns a setup Text::Table object with everything already setup.use Proc::ProcessTable::Colorizer; my $cps = Proc::ProcessTable::Colorizer->new; print $cps->colorize; fieldsGets a hash of possible fields from Proc::ProcessTable as an hash.This is really meant as a internal function. fieldsGetGets the currently set fields.Returns a array ref of current fields to be printed. my $fields=$cps->fieldsGet; nextColorReturns the next color.my $nextColor=$cps->nextColor; nextColorResets the next color to the first one.my $nextColor=$cps->nextColor; fieldsSetGets the currently set fields.Returns a list of current fields to be printed. my @fields=$cps->fieldsGet; pctcpuSearchGetReturns the current value for the PCT CPU search.The return is a array ref. my $pctcpu_search=$cps->pctcpuSearchGet; pctcpuSearchSetStringSearch 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'); pctmemSearchGetReturns the current value for the PCT MEM search.The return is a array ref. my $pctmem_search=$cps->pctmemSearchGet; pctmemSearchSetStringSearch for procs based on the memory 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 the memory $cps->pctmemSearchSetString('<60'); #shows procs with greater than 60% of the memory $cps->pctmemSearchSetString('>60'); processColorGetmy $timeColors=$cps->processColorGet; procSearchGetThis 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"; } procSearchSetThis 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' ); selfIgnoreGetselfIgnoreSetWether or not to show the PID of this processes in the list.undef Resets it to the default, 2. 0 Always show self PID in the list. 1 Never show self PID in the list. 2 Don't show self PID if it is a search. This is the default. startStringGenerates a short time string based on the supplied unix time.swappedOutSearchGetReturns 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"; } swappedOutSearchSetSets the swapped out search value.The value taken is a Perl boolean. $cps->swappedOutSearchSet( 1 ); timeColorsGetmy $timeColors=$cps->timeColorsGet; timeSearchGetReturns the current value for the time search.The return is a array ref. my $time_search=$cps->waitSearchGet; timeSearchSetStringSearch for procs based on the CPU time value.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 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'); timeStringTurns the raw run string into something usable.This returns a colorized item. my $time=$cps->timeString( $seconds ); userSearchGetThis 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; userSearchSetStringThis takes a string to set the user search for.An selection can be inverted via !. 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; waitSearchGetReturns the current value for the wait search.The return is a array ref. my $wait_search=$cps->waitSearchGet; waitSearchSetStringThis takes a string to set the wait channel search for.An selection can be inverted via !. The string may contain multiple users seperated by a comma. If the string is undef, all wait channels will be shown. #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; zombieSearchGetReturns the current value for the zombie search.The return is a Perl boolean. my $zombie_search=$cps->zombieSearchGet; if ( $zombie_search ){ print "only zombie procs will be shown"; } zombieSearchSetSets the zombie search value.The value taken is a Perl boolean. $cps->zombieSearchSet( 1 ); COLORSThese corresponds to Term::ANSIColor colors.TimeThe 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 ColumnsThe non-proc/time columns are colored in a rotating color sequence.The default is as below. BRIGHT_YELLOW BRIGHT_CYAN BRIGHT_MAGENTA BRIGHT_BLUE ERROR CODES/FLAGS1 / badTimeStringThe time search string contains errors.2 / badPctcpuStringThe PCT CPU search string contains errors.3 / badPctmemStringThe PCT MEM search string contains errors.AUTHORZane C. Bowers-Hadley, "<vvelox at vvelox.net>"BUGSPlease 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.SUPPORTYou can find documentation for this module with the perldoc command.perldoc Proc::ProcessTable::Colorizer You can also look for information at:
ACKNOWLEDGEMENTSLICENSE AND COPYRIGHTCopyright 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.
Visit the GSP FreeBSD Man Page Interface. |