Sys::S...mStats(3pm)
π Sys::Statistics::Linux::MemStats β the bestie who reads your memory π
okay so this is a Perl module, part of the User Contributed Perl Documentation, manual section 3pm. Its whole personality is Sys::Statistics::Linux::MemStats and its whole job is collecting linux memory information. no cap. π§ β¨
β¨ NAME β¨
Sys::Statistics::Linux::MemStats β Collect linux memory information.
πΈ SYNOPSIS πΈ
use Sys::Statistics::Linux::MemStats;
my $lxs = Sys::Statistics::Linux::MemStats->new;
my $stat = $lxs->get;
π¦ DESCRIPTION π¦
Sys::Statistics::Linux::MemStats gathers memory statistics from the virtual /proc filesystem, aka procfs. it just walks in there and reads the vibes, respectfully. π
for more info, go read the documentation of the front-end module Sys::Statistics::Linux. it's giving β¨main characterβ¨, go say hi.
π MEMORY INFORMATIONS π
Generated by /proc/meminfo. this is where the numbers live, bestie:
memusedβ Total size of used memory in kilobytes.memfreeβ Total size of free memory in kilobytes.memusedperβ Total size of used memory in percent.memtotalβ Total size of memory in kilobytes.buffersβ Total size of buffers used from memory in kilobytes.cachedβ Total size of cached memory in kilobytes.realfreeβ Total size of memory is real free (memfree + buffers + cached).realfreeperβ Total size of memory is real free in percent of total memory.swapusedβ Total size of swap space is used is kilobytes.swapfreeβ Total size of swap space is free in kilobytes.swapusedperβ Total size of swap space is used in percent.swaptotalβ Total size of swap space in kilobytes.swapcachedβ Memory that once was swapped out, is swapped back in but still also is in the swapfile.activeβ Memory that has been used more recently and usually not reclaimed unless absolutely necessary.inactiveβ Memory which has been less recently used and is more eligible to be reclaimed for other purposes. On earlier kernels (2.4)Inact_dirty + Inact_laundry + Inact_clean.
the following statistics are only available by kernels from 2.6. so if you're on something ancient, sorry bestie, these are not for you π
slabβ Total size of memory in kilobytes that used by kernel for data structure allocations.dirtyβ Total size of memory pages in kilobytes that waits to be written back to disk.mappedβ Total size of memory in kilbytes that is mapped by devices or libraries withmmap.writebackβ Total size of memory that was written back to disk.committed_asβ The amount of memory presently allocated on the system.
the following statistic is only available by kernels from 2.6.9. yes, a whole one (1) field, and it's iconic for it. π
commitlimitβ Total amount of memory currently available to be allocated on the system.
π METHODS π
π new()
call new() to create a new object. literally just spawn it.
my $lxs = Sys::Statistics::Linux::MemStats->new;
it's possible to set the path to the proc filesystem. so if your procfs is somewhere else (no judgement), say so:
Sys::Statistics::Linux::MemStats->new(
files => {
# This is the default
path => '/proc',
meminfo => 'meminfo',
}
);
π get()
call get() to get the statistics. get() returns the statistics as a hash reference. yes, a hashref. go get your numbers π«Ά
my $stat = $lxs->get;
π EXPORTS π
No exports. she gives nothing away, and honestly? respect. π
π₯ SEE ALSO π₯
π REPORTING BUGS π
Please report all bugs to <jschulz.cpan(at)bloonix.de>.
π AUTHOR π
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
πΈ 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.
and that's the whole page, bestie π documented asperl v5.36.0, dated2022-11-19, and yes the manual page header saidSys::S...mStats(3pm)and the footer saidSys::S...mStats(3pm)too. we folded those in up top so you didn't have to read them twice. slay. β¨π¦π
π¦ 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