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

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

πŸ‘‘ NAME

Sys::Statistics::Linux::DiskStats β€” the module that collects your linux disk stats, and yes she's from the 3pm perl manual section, bestie πŸ’–


✨ SYNOPSIS

use Sys::Statistics::Linux::DiskStats;

my $lxs = Sys::Statistics::Linux::DiskStats->new;
$lxs->init;
sleep 1;
my $stat = $lxs->get;

Or, like, the other way πŸ¦‹

my $lxs = Sys::Statistics::Linux::DiskStats->new(initfile => $file);
$lxs->init;
my $stat = $lxs->get;

🌸 DESCRIPTION

Okay so Sys::Statistics::Linux::DiskStats gathers disk statistics from the virtual /proc filesystem (procfs). That's it, that's the whole vibe πŸ’…

For more info, go read the docs of the front-end module Sys::Statistics::Linux. She's the main character, this one's her bestie 🫢


πŸ’Ύ DISK STATISTICS

Generated by /proc/diskstats or /proc/partitions. Here's what you get:

  • major β€” the mayor number of the disk
  • minor β€” the minor number of the disk
  • rdreq β€” number of read requests that were made to physical disk per second
  • rdbyt β€” number of bytes that were read from physical disk per second
  • wrtreq β€” number of write requests that were made to physical disk per second
  • wrtbyt β€” number of bytes that were written to physical disk per second
  • ttreq β€” total number of requests were made from/to physical disk per second
  • ttbyt β€” total number of bytes transmitted from/to physical disk per second

πŸŽ€ METHODS

new()

Call new() to create a new object. Slay.

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

Maybe you wanna store/load the initial statistics to/from a file? Iconic behaviour, go off:

my $lxs = Sys::Statistics::Linux::DiskStats->new(initfile => '/tmp/diskstats.yml');

If you set initfile, it's not necessary to call sleep before get(). Literally saving you a whole second of your life ✨

It's also possible to set the path to the proc filesystem:

 Sys::Statistics::Linux::DiskStats->new(
    files => {
        # This is the default
        path       => '/proc',
        diskstats  => 'diskstats',
        partitions => 'partitions',
    }
 );

init()

Call init() to initialize the statistics. Gotta warm her up first πŸ’–

$lxs->init;

get()

Call get() to get the statistics. get() returns the statistics as a hash reference. So you get a whole hash ref back, no cap.

my $stat = $lxs->get;

raw()

Get raw values. Just the raw, unfiltered, no-makeup truth πŸ™ˆ


🌈 EXPORTS

No exports. Nothing. Zero. Nada. She's not sharing like that 😭


πŸ‘€ SEE ALSO

proc(5) β€” go read her too, iykyk


πŸ’€ REPORTING BUGS

Please report all bugs to <jschulz.cpan(at)bloonix.de>. Found a bug? Tell Jonny, don't just vibe with it πŸ›


🌟 AUTHOR

Jonny Schulz <jschulz.cpan(at)bloonix.de>. The author. The legend. The moment πŸ‘‘


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. So like, go wild, but respectfully πŸ¦‹


And that's the whole page, bestie!! This one's from perl v5.36.0, dated 2022-11-19, and it lives in the Sys::S...skStats(3pm) manual. Mwah, go read your diskstats, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from