From 02155522f68996d3b10ea51382b110ee7c5f01e8 Mon Sep 17 00:00:00 2001 From: "Zane C. Bowers-Hadley" Date: Wed, 8 Nov 2017 07:50:45 +0000 Subject: [PATCH] tag 0.2.0 git-svn-id: svn://127.0.0.1/Perl/Proc-ProcessTable-Colorizer/tags/0.2.0@978 0c1c3402-1be1-de11-8092-0022686faf23 --- Proc-ProcessTable-Colorizer/Changes | 11 +- Proc-ProcessTable-Colorizer/Makefile.PL | 16 +- Proc-ProcessTable-Colorizer/README | 23 +- Proc-ProcessTable-Colorizer/bin/cps | 168 ++ .../lib/Proc/ProcessTable/Colorizer.pm | 1595 ++++++++++++++++- Proc-ProcessTable-Colorizer/xt/boilerplate.t | 57 - 6 files changed, 1781 insertions(+), 89 deletions(-) create mode 100755 Proc-ProcessTable-Colorizer/bin/cps delete mode 100644 Proc-ProcessTable-Colorizer/xt/boilerplate.t diff --git a/Proc-ProcessTable-Colorizer/Changes b/Proc-ProcessTable-Colorizer/Changes index 3736bb0..b8ef21a 100644 --- a/Proc-ProcessTable-Colorizer/Changes +++ b/Proc-ProcessTable-Colorizer/Changes @@ -1,5 +1,12 @@ Revision history for Proc-ProcessTable-Colorizer -0.01 Date/time - First version, released on an unsuspecting world. +0.2.0 2017-11-08/02:00 + -Fix numeric search string checking involving numbers with decimal points. + -Move self ignore check to the end so it works properly. +0.1.0 2017-11-07/01:00 + -Only initilize BSD::Process once per process. + -Use require for BSD::Process instead of use. #123531/SREZIC + +0.0.0 2017-11-06/00:00 + -Initial release. diff --git a/Proc-ProcessTable-Colorizer/Makefile.PL b/Proc-ProcessTable-Colorizer/Makefile.PL index 2c5e729..84ebef7 100644 --- a/Proc-ProcessTable-Colorizer/Makefile.PL +++ b/Proc-ProcessTable-Colorizer/Makefile.PL @@ -3,6 +3,16 @@ use strict; use warnings; use ExtUtils::MakeMaker; +my %PREREQ_PM = ( + 'Error::Helper'=>'1.0.0', + 'Proc::ProcessTable'=>'0.53', + 'Term::ANSIColor'=>'4.06', + 'Text::Table'=>'1.133', + ); +if ( $^O =~ /bsd/ ){ + $PREREQ_PM{'BSD::Process'}='0.07'; +} + WriteMakefile( NAME => 'Proc::ProcessTable::Colorizer', AUTHOR => q{Zane C. Bowers-Hadley }, @@ -11,16 +21,14 @@ WriteMakefile( LICENSE => 'freebsd', PL_FILES => {}, MIN_PERL_VERSION => '5.006', + INST_SCRIPT => 'bin', CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => '0', }, BUILD_REQUIRES => { 'Test::More' => '0', }, - PREREQ_PM => { - #'ABC' => '1.6', - #'Foo::Bar::Module' => '5.0401', - }, + PREREQ_PM => \%PREREQ_PM, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Proc-ProcessTable-Colorizer-*' }, ); diff --git a/Proc-ProcessTable-Colorizer/README b/Proc-ProcessTable-Colorizer/README index b1a6b94..68e7c7f 100644 --- a/Proc-ProcessTable-Colorizer/README +++ b/Proc-ProcessTable-Colorizer/README @@ -1,16 +1,21 @@ Proc-ProcessTable-Colorizer -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. +This colorizes the output from Proc::ProcessTable. -A README file is required for CPAN modules since CPAN extracts the README -file from a module distribution so that people browsing the archive -can use it to get an idea of the module's uses. It is usually a good idea -to provide version information here so that people can decide whether -fixes for the module are worth downloading. +This is largely meant to be used from the command line instead of +as a module via the included bin script. +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 INSTALLATION diff --git a/Proc-ProcessTable-Colorizer/bin/cps b/Proc-ProcessTable-Colorizer/bin/cps new file mode 100755 index 0000000..7cce783 --- /dev/null +++ b/Proc-ProcessTable-Colorizer/bin/cps @@ -0,0 +1,168 @@ +#!/usr/bin/env perl +#Copyright (c) 2017, Zane C. Bowers-Hadley +#All rights reserved. +# +#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. + +use strict; +use warnings; +use Getopt::Std; +use Proc::ProcessTable::Colorizer; + +$Getopt::Std::STANDARD_HELP_VERSION = 1; + +#print help +sub main::HELP_MESSAGE { + print "\n". + "-z Show zombies procs.\n". + "-s Show swapped out procs.\n". + "-p Search procs using the matching regex.\n". + "-u A string search for users.\n". + "-t