Sys::S...tStats(3pm)
π Sys::S...tStats(3pm) β aka Sys::Statistics::Linux::NetStats π
okay bestie, so this is a User Contributed Perl Documentation page, and it's the manual for Sys::Statistics::Linux::NetStats (the header up top is just being dramatic and abbreviating it to Sys::S...tStats(3pm), we don't have to talk about it π).
β¨ NAME β¨
Sys::Statistics::Linux::NetStats β collect linux net statistics. that's it, that's the whole vibe. π
β¨ SYNOPSIS β¨
the classic three-step:
use Sys::Statistics::Linux::NetStats;
my $lxs = Sys::Statistics::Linux::NetStats->new;
$lxs->init;
sleep 1;
my $stat = $lxs->get;
Or:
my $lxs = Sys::Statistics::Linux::NetStats->new(initfile => $file);
$lxs->init;
my $stat = $lxs->get;
β¨ DESCRIPTION β¨
Sys::Statistics::Linux::NetStats gathers net statistics from the virtual /proc filesystem (procfs). iconic behaviour tbh. πΈ
if you want more info, go read the docs of the front-end module Sys::Statistics::Linux. it's giving "the main character module" and this one is its little sister. π
β¨ NET STATISTICS β¨
these are generated by /proc/net/dev. every single one is a per second number, no cap:
rxbytβ Number of bytes received per second.rxpcksβ Number of packets received per second.rxerrsβ Number of errors that happend while received packets per second.rxdropβ Number of packets that were dropped per second.rxfifoβ Number of FIFO overruns that happend on received packets per second.rxframeβ Number of carrier errors that happend on received packets per second.rxcomprβ Number of compressed packets received per second.rxmultiβ Number of multicast packets received per second.txbytβ Number of bytes transmitted per second.txpcksβ Number of packets transmitted per second.txerrsβ Number of errors that happend while transmitting packets per second.txdropβ Number of packets that were dropped per second.txfifoβ Number of FIFO overruns that happend on transmitted packets per second.txcollsβ Number of collisions that were detected per second.txcarrβ Number of carrier errors that happend on transmitted packets per second.txcomprβ Number of compressed packets transmitted per second.ttpcksβ Number of total packets (received + transmitted) per second.ttbytβ Number of total bytes (received + transmitted) per second.
β¨ METHODS β¨
π new()
call new() to create a new object. brand new, fresh out the box, main character energy.
my $lxs = Sys::Statistics::Linux::NetStats->new;
maybe you wanna store/load the initial statistics to/from a file? go off:
my $lxs = Sys::Statistics::Linux::NetStats->new(initfile => '/tmp/netstats.yml');
if you set initfile it's not necessary to call sleep before get(). so you can skip the nap. π΄β‘οΈπ«
it's also possible to set the path to the proc filesystem:
Sys::Statistics::Linux::NetStats->new(
files => {
# This is the default
path => '/proc',
netdev => 'net/dev',
}
);
π init()
call init() to initialize the statistics. gotta warm up first, yk?
$lxs->init;
π get()
call get() to get the statistics. get() returns the statistics as a hash reference.
my $stat = $lxs->get;
π raw()
the same as get_raw() but it's not necessary to call init() first. lowkey the convenient one. π
π get_raw()
call get_raw() to get the raw data β no deltas. just the honest raw numbers, no math, no filter. π
β¨ EXPORTS β¨
No exports. none. zero. empty. it's giving minimalist. β¨
β¨ SEE ALSO β¨
proc(5) β go read it, bestie, it's where all the lore lives. π
β¨ REPORTING BUGS β¨
Please report all bugs to <jschulz.cpan(at)bloonix.de>. (yes that's the actual email format, don't come for me, I'm just the messenger π«Ά)
β¨ AUTHOR β¨
Jonny Schulz <jschulz.cpan(at)bloonix.de>. legend behaviour. π
β¨ 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. slay. π
and that's the whole page, bestie!! no notes, we ate. π
okay so the fine print: this whole thing came from perl v5.36.0, dated 2022-11-19, and it's the Sys::S...tStats(3pm) page from User Contributed Perl Documentation. 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