Sys::S...leStats(3pm)

πŸ“¦
version 0.66 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Sys::Statistics::Linux::FileStats πŸ’–

okay bestie so this is a page from the User Contributed Perl Documentation collection, and it's literally all about collecting linux file statistics. no cap. it's giving very specific, very useful, very slay.


✨ NAME ✨

Sys::Statistics::Linux::FileStats β€” collect linux file statistics. that's the whole job. she's focused. she's an icon.


🌸 SYNOPSIS 🌸

okay so this is the whole vibe in four lines, look:

use Sys::Statistics::Linux::FileStats;

my $lxs  = Sys::Statistics::Linux::FileStats->new;
my $stat = $lxs->get;

that's it. that's the post. build an object, grab the stats. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

Sys::Statistics::Linux::FileStats gathers file statistics from the virtual /proc filesystem (aka procfs). it's not out here reading your actual files, she's reading the virtual one. huge difference. very demure.

if you want the full picture, go read the documentation of the front-end module Sys::Statistics::Linux. this one's like the little sister module. still iconic though.


πŸŽ€ FILE STATISTICS πŸŽ€

these beauties are generated by /proc/sys/fs/file-nr, /proc/sys/fs/inode-nr and /proc/sys/fs/dentry-state. three files, one glow-up. ✨

  • fhalloc β€” number of allocated file handles.
  • fhfree β€” number of free file handles.
  • fhmax β€” number of maximum file handles.
  • inalloc β€” number of allocated inodes.
  • infree β€” number of free inodes.
  • inmax β€” number of maximum inodes.
  • dentries β€” dirty directory cache entries.
  • unused β€” free directory cache size.
  • agelimit β€” time in seconds the dirty cache entries can be reclaimed.
  • wantpages β€” pages that are requested by the system when memory is short.

ten little stats, all living their best life. memorize them for the vibe check. 🫢


πŸ’œ METHODS πŸ’œ

new()

call new() to create a new object. it's giving constructor. it's giving main character energy.

my $lxs = Sys::Statistics::Linux::FileStats->new;

and plot twist: you can also set the path to the proc filesystem. customize your little heart out:

Sys::Statistics::Linux::FileStats->new(
   files => {
       # This is the default
       path     => '/proc',
       file_nr  => 'sys/fs/file-nr',
       inode_nr => 'sys/fs/inode-nr',
       dentries => 'sys/fs/dentry-state',
   }
);
note the # This is the default comment in there β€” those paths are the defaults, so if you don't pass anything you get exactly that. don't come for me, come for the defaults. πŸ’€

get()

call get() to get the statistics. get() returns the statistics as a hash reference. yes, a hash reference. she's returning data, not vibes. (well, both.)

my $stat = $lxs->get;

🌈 EXPORTS 🌈

no exports.

literally none. zero. the girl exports nothing, she just exists and delivers. periodt. πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

one reference. quality over quantity, bestie.


πŸ› REPORTING BUGS πŸ›

please report all bugs to <jschulz.cpan(at)bloonix.de>. be nice about it, they're doing their best. πŸ™ˆ


⭐ AUTHOR ⭐

Jonny Schulz <jschulz.cpan(at)bloonix.de>. the moment. the legend. 🫢


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 so that's the whole page, and fr fr you're now a Sys::Statistics::Linux::FileStats expert. go collect those file statistics, bestie, you've earned it. πŸ§šπŸ’–

and for the cute sign-off: this gorgeous little page came from perl v5.36.0, dated 2022-11-19 β€” shoutout to that version and that date, they understood the assignment. 🌸

πŸ“¦ where this page comes from