BSD::devstat - interface to devstat(3) API
use BSD::devstat; my $ds = BSD::devstat->new(); printf "Number of devices: %d\n", $ds->numdevs; my $devidx = $ds->numdevs; # this is last device. my $dev = $ds->devices($devidx); printf "%s%d block_size=%d\n", $dev->{device_name}, $dev->{unit_number}, $dev->{block_size}; # Stat in 2 seconds. my $stat = $ds->compute_statistics($devidx, 2.0); printf "BUSY_PCT=%.2f\n", $stat->{BUSY_PCT};
BSD::devstat is interface to devstat(3) API. You can grab device statistics information which is provided by devstat(9) kernel interface via devstat(3) userland interface.
Retrieve device statistics and store it as BSD::devstat object.
Return the number of devices which devstat(3) API provided.
$device_index is index for device, which can be from 0 to ($self->numdevs() - 1). Returns hash reference. This contains various values described in devstat(9) manpage. This method will croak if error occured.
$device_index is index for device, which can be from 0 to ($self->numdevs() - 1). $elapse_time is second (can be float number) between two snapshots of statistics and calculation by done with these statistics. Returns hash reference. This contains various values described at devstat_compute_statistics() function in devstat(3) manpage. This method will croak if error occured.
Jun Kuriyama <kuriyama@FreeBSD.org>
devstat(3), devstat(9).
Currently supports only FreeBSD.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install BSD::devstat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BSD::devstat
CPAN shell
perl -MCPAN -e shell install BSD::devstat
For more information on module installation, please visit the detailed CPAN module installation guide.