Sys-Statistics-Linux
view release on metacpan or search on metacpan
lib/Sys/Statistics/Linux/Processes.pm view on Meta::CPAN
Sys::Statistics::Linux::Processes gathers process information from the virtual
F</proc> filesystem (procfs).
For more information read the documentation of the front-end module
L<Sys::Statistics::Linux>.
=head1 PROCESS STATISTICS
Generated by F</proc/E<lt>pidE<gt>/stat>, F</proc/E<lt>pidE<gt>/status>,
F</proc/E<lt>pidE<gt>/cmdline> and F<getpwuid()>.
Note that if F</etc/passwd> isn't readable, the key owner is set to F<N/a>.
ppid - The parent process ID of the process.
nlwp - The number of light weight processes that runs by this process.
owner - The owner name of the process.
pgrp - The group ID of the process.
state - The status of the process.
session - The session ID of the process.
ttynr - The tty the process use.
lib/Sys/Statistics/Linux/Processes.pm view on Meta::CPAN
Get raw values.
=head1 EXPORTS
No exports.
=head1 SEE ALSO
B<proc(5)>
B<perldoc -f getpwuid>
=head1 REPORTING BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>.
=head1 AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
=head1 COPYRIGHT
lib/Sys/Statistics/Linux/Processes.pm view on Meta::CPAN
sub _get_owner {
my ($self, $pid) = @_;
my $file = $self->{files};
my $owner = "N/a";
open my $fh, '<', "$file->{path}/$pid/$file->{status}"
or return undef;
while (my $line = <$fh>) {
if ($line =~ /^Uid:(?:\s+|\t+)(\d+)/) {
$owner = getpwuid($1) || "N/a";
last;
}
}
close($fh);
return $owner;
}
sub _get_cmdline {
my ($self, $pid) = @_;
( run in 0.343 second using v1.01-cache-2.11-cpan-8d75d55dd25 )