1Sys::Statistics::Linux:U:sPerrocCeosnstersi(b3u)ted PerlSyDso:c:uSmteanttiasttiiocns::Linux::Processes(3)
2
3
4

NAME

6       Sys::Statistics::Linux::Processes - Collect linux process statistics.
7

SYNOPSIS

9           use Sys::Statistics::Linux::Processes;
10
11           my $lxs = Sys::Statistics::Linux::Processes->new;
12           # or Sys::Statistics::Linux::Processes->new(pids => \@pids)
13
14           $lxs->init;
15           sleep 1;
16           my $stat = $lxs->get;
17

DESCRIPTION

19       Sys::Statistics::Linux::Processes gathers process information from the
20       virtual /proc filesystem (procfs).
21
22       For more information read the documentation of the front-end module
23       Sys::Statistics::Linux.
24

PROCESS STATISTICS

26       Generated by /proc/<pid>/stat, /proc/<pid>/status, /proc/<pid>/cmdline
27       and getpwuid().
28
29       Note that if /etc/passwd isn't readable, the key owner is set to N/a.
30
31           ppid      -  The parent process ID of the process.
32           nlwp      -  The number of light weight processes that runs by this process.
33           owner     -  The owner name of the process.
34           pgrp      -  The group ID of the process.
35           state     -  The status of the process.
36           session   -  The session ID of the process.
37           ttynr     -  The tty the process use.
38           minflt    -  The number of minor faults the process made.
39           cminflt   -  The number of minor faults the child process made.
40           mayflt    -  The number of mayor faults the process made.
41           cmayflt   -  The number of mayor faults the child process made.
42           stime     -  The number of jiffies the process have beed scheduled in kernel mode.
43           utime     -  The number of jiffies the process have beed scheduled in user mode.
44           ttime     -  The number of jiffies the process have beed scheduled (user + kernel).
45           cstime    -  The number of jiffies the process waited for childrens have been scheduled in kernel mode.
46           cutime    -  The number of jiffies the process waited for childrens have been scheduled in user mode.
47           prior     -  The priority of the process (+15).
48           nice      -  The nice level of the process.
49           sttime    -  The time in jiffies the process started after system boot.
50           actime    -  The time in D:H:M:S (days, hours, minutes, seconds) the process is active.
51           vsize     -  The size of virtual memory of the process.
52           nswap     -  The size of swap space of the process.
53           cnswap    -  The size of swap space of the childrens of the process.
54           cpu       -  The CPU number the process was last executed on.
55           wchan     -  The "channel" in which the process is waiting.
56           fd        -  This is a subhash containing each file which the process has open, named by its file descriptor.
57                        0 is standard input, 1 standard output, 2 standard error, etc. Because only the owner or root
58                        can read /proc/<pid>/fd this hash could be empty.
59           cmd       -  Command of the process.
60           cmdline   -  Command line of the process.
61
62       Generated by /proc/<pid>/statm. All statistics provides information
63       about memory in pages:
64
65           size      -  The total program size of the process.
66           resident  -  Number of resident set size, this includes the text, data and stack space.
67           share     -  Total size of shared pages of the process.
68           trs       -  Total text size of the process.
69           drs       -  Total data/stack size of the process.
70           lrs       -  Total library size of the process.
71           dtp       -  Total size of dirty pages of the process (unused since kernel 2.6).
72
73       It's possible to convert pages to bytes or kilobytes. Example - if the
74       pagesize of your system is 4kb:
75
76           $Sys::Statistics::Linux::Processes::PAGES_TO_BYTES =    0; # pages (default)
77           $Sys::Statistics::Linux::Processes::PAGES_TO_BYTES =    4; # convert to kilobytes
78           $Sys::Statistics::Linux::Processes::PAGES_TO_BYTES = 4096; # convert to bytes
79
80           # or with
81           Sys::Statistics::Linux::Processes->new(pages_to_bytes => 4096);
82

METHODS

84   new()
85       Call "new()" to create a new object.
86
87           my $lxs = Sys::Statistics::Linux::Processes->new;
88
89       It's possible to handoff an array reference with a PID list.
90
91           my $lxs = Sys::Statistics::Linux::Processes->new(pids => [ 1, 2, 3 ]);
92
93       It's also possible to set the path to the proc filesystem.
94
95            Sys::Statistics::Linux::Processes->new(
96               files => {
97                   # This is the default
98                   path    => '/proc',
99                   uptime  => 'uptime',
100                   stat    => 'stat',
101                   statm   => 'statm',
102                   status  => 'status',
103                   cmdline => 'cmdline',
104                   wchan   => 'wchan',
105                   fd      => 'fd',
106               }
107           );
108
109   init()
110       Call "init()" to initialize the statistics.
111
112           $lxs->init;
113
114   get()
115       Call "get()" to get the statistics. "get()" returns the statistics as a
116       hash reference.
117
118           my $stat = $lxs->get;
119
120       Note:
121
122       Processes that were created between the call of init() and get() are
123       returned as well, but the keys minflt, cminflt, mayflt, cmayflt, utime,
124       stime, cutime, and cstime are set to the value 0.00 because there are
125       no inititial values to calculate the deltas.
126
127   raw()
128       Get raw values.
129

EXPORTS

131       No exports.
132

SEE ALSO

134       proc(5)
135
136       perldoc -f getpwuid
137

REPORTING BUGS

139       Please report all bugs to <jschulz.cpan(at)bloonix.de>.
140

AUTHOR

142       Jonny Schulz <jschulz.cpan(at)bloonix.de>.
143
145       Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved.
146
147       This program is free software; you can redistribute it and/or modify it
148       under the same terms as Perl itself.
149
150
151
152perl v5.12.2                      2010-12-1S4ys::Statistics::Linux::Processes(3)
Impressum