Sys::S...ocStats(3pm)
π Sys::Statistics::Linux::ProcStats β the manual, but make it cute π
okay bestie, so this is Sys::S...ocStats(3pm) β a User Contributed Perl Documentation page, and it's literally the moment you finally learn how to get your Linux process stats without crying. i gotchu π«Ά
β¨ NAME β¨
Sys::Statistics::Linux::ProcStats β Collect linux process statistics.
like, it collects linux process statistics. that's the whole vibe. π
β¨ SYNOPSIS β¨
use Sys::Statistics::Linux::ProcStats;
my $lxs = Sys::Statistics::Linux::ProcStats->new;
$lxs->init;
sleep 1;
my $stat = $lxs->get;
Or, if you're feeling fancy:
my $lxs = Sys::Statistics::Linux::ProcStats->new(initfile => $file);
$lxs->init;
my $stat = $lxs->get;
β¨ DESCRIPTION β¨
So Sys::Statistics::Linux::ProcStats gathers process statistics from the virtual /proc filesystem (that's procfs, iykyk). π
For more deets, go read the documentation of the front-end module Sys::Statistics::Linux. it's the main character, this one's the supporting bestie. π
β¨ IMPORTANT β¨
not me renaming things π β the keyprocs_blockedgot renamed toblocked! write that down bestie, it WILL matter.
β¨ LOAD AVERAGE STATISTICS β¨
These are generated by /proc/stat and /proc/loadavg. iconic duo fr fr π
newβ Number of new processes that were produced per second.runqueueβ The number of currently executing kernel scheduling entities (processes, threads).countβ The number of kernel scheduling entities that currently exist on the system (processes, threads).blockedβ Number of processes blocked waiting for I/O to complete (Linux 2.5.45 onwards).runningβ Number of processes in runnable state (Linux 2.5.45 onwards).
β¨ METHODS β¨
πΈ new()
Call new() to create a new object. boom. you have a thing now. β¨
my $lxs = Sys::Statistics::Linux::ProcStats->new;
Maybe you want to store/load the initial statistics to/from a file? say less:
my $lxs = Sys::Statistics::Linux::ProcStats->new(initfile => '/tmp/procstats.yml');
If you set initfile it's not necessary to call sleep before get(). so you can just skip the nap, no biggie π΄β
It's also possible to set the path to the proc filesystem:
Sys::Statistics::Linux::ProcStats->new(
files => {
# This is the default
path => '/proc',
loadavg => 'loadavg',
stat => 'stat',
}
);
πΈ init()
Call init() to initialize the statistics. it's giving setup era π
$lxs->init;
πΈ get()
Call get() to get the statistics. get() returns the statistics as a hash reference. yes, a hash reference, hold it gently π
my $stat = $lxs->get;
πΈ raw()
Get raw values. just the raw, unfiltered truth. no cap. π
β¨ EXPORTS β¨
No exports. nothing. zero. not a single one. it's giving minimalist. π
β¨ SEE ALSO β¨
proc(5) β go read that too, bestie, it's the source material. π
β¨ REPORTING BUGS β¨
Please report all bugs to <jschulz.cpan(at)bloonix.de>. found a bug? don't be shy, tell them, they wanna know π«Ά
β¨ AUTHOR β¨
Jonny Schulz <jschulz.cpan(at)bloonix.de>. the legend themselves π
β¨ COPYRIGHT β¨
Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay and that's the whole page bestie, you ate that. πβ¨ππ¦
this was Sys::S...ocStats(3pm), straight from perl v5.36.0, dated 2022-11-19 β mwah, slay, periodt. π
πΈ
π¦ where this page comes from
- debian bookworm: libsys-statistics-linux-perl 0.66-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libsys-statistics-linux-perl 0.66-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libsys-statistics-linux-perl 0.66-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsys-statistics-linux-perl 0.66-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsys-statistics-linux-perl 0.66-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms