From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more
|
my @diskstats = qw(
major
minor
rdreq
rdbyt
wrtreq
wrtbyt
ttreq
ttbyt
) ;
my $lxs = Sys::Statistics::Linux->new;
eval { $lxs ->set( diskstats => 1) };
if ($@) {
if ($@ =~ /CONFIG_BLK_STATS/) {
plan skip_all => "your system seems not to be compiled with CONFIG_BLK_STATS=y! diskstats will not run on your system!" ;
} else {
plan tests => 1;
fail( "$@" );
}
} else {
plan tests => 8;
$lxs ->set( diskstats => 1);
sleep (1);
my $stats = $lxs ->get;
for my $dev ( keys %{ $stats ->diskstats}) {
ok( defined $stats ->diskstats->{ $dev }->{ $_ }, "checking diskstats $_" ) for @diskstats ;
last ;
}
}
|