-
-
18 Oct 2015 20:12:08 UTC
- Distribution: P9Y-ProcessTable
- Module version: 1.08
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (3)
- Testers (646 / 88 / 5)
- Kwalitee
Bus factor: 0- 74.02% Coverage
- License: artistic_2
- Perl: v5.8.8
- Activity
24 month- Tools
- Download (32.51KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- List::AllUtils
- Module::Runtime
- Moo
- Path::Class
- namespace::clean
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
P9Y::ProcessTable::Process - Base class for a single process
SYNOPSIS
use P9Y::ProcessTable; my $p = P9Y::ProcessTable->process; foreach my $f (P9Y::ProcessTable->fields) { my $has_f = 'has_'.$f; print $f, ": ", $p->$f(), "\n" if ( $p->$has_f() ); }
DESCRIPTION
This (Moo) class/object represents a single process.
METHODS
fields
Same as the one from P9Y::ProcessTable.
refresh
This refreshes the data for this process. Besides construction (via P9Y::ProcessTable), this is the only method that refreshes the data set. So, don't expect a call to, say,
utime
to actually look up the latest value from the OS.kill
Sends the signal specified to the process. For Windows, this is somewhat normalized, so a
$p->kill(9)
will terminate the process.pgrp / priority
Unlike the other data methods (below), these two are settable by passing a value. In most cases, this calls the
set*
command from CORE.Process data methods
Depending on the OS, the following methods are available. Also, all methods also have a
has_*
predicate, except forpid
.pid Process ID uid UID of process gid GID of process euid Effective UID egid Effective GID suid Saved UID sgid Saved GID ppid Parent PID pgrp Process group sess Session ID cwd Current working directory exe Executable (with a full path) root Process's root directory cmdline Full command line environ Environment variables for the process (as a HASHREF) fname Filename (typically without a path) winpid (Cygwin only) Windows PID winexe (Cygwin only) Windows Executable path minflt Minor page faults cminflt Minor page faults of children majflt Major page faults cmajflt Major page faults of children ttlflt Total page faults (min+maj; sometimes this is the only fault available) cttlflt Total page faults of children utime User mode time stime Kernel/system mode time cutime Child utime cstime Child stime time Total time (u+s; sometimes this is the only time available) ctime Total time of children start Start time of process (in epoch seconds) priority Priority / Nice value state State of process (with some level of normalization) ttynum TTY number ttydev TTY device name flags Process flags (not normalized) threads Number of threads/LWPs size Virtual memory size (in bytes) rss Resident/working set size (in bytes) wchan Address of current system call cpuid CPU ID of processor running on pctcpu Percent CPU used pctmem Percent memory used
Make no assumptions about what is available and what is not, not even
ppid
. Instead, use thehas_*
methods and plan for alternatives if that data isn't available.CAVEATS
Certain fields might not be normalized correctly. Patches welcome!
Until Win32::API is fixed,
kill
can't do gracefulWM_CLOSE
call to processes on Windows.
AVAILABILITY
The project homepage is https://github.com/SineSwiper/P9Y-ProcessTable.
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see https://metacpan.org/module/P9Y::ProcessTable/.
AUTHOR
Brendan Byrd <BBYRD@CPAN.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Brendan Byrd.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
Module Install Instructions
To install P9Y::ProcessTable, copy and paste the appropriate command in to your terminal.
cpanm P9Y::ProcessTable
perl -MCPAN -e shell install P9Y::ProcessTable
For more information on module installation, please visit the detailed CPAN module installation guide.