Skip to main content

Module disk

Module disk 

Source
Expand description

Disks: how busy the busiest device is and how much each device reads and writes, from /proc/diskstats; and how full the fullest filesystem is, from statvfs (SRD-118 §3.2, §3.5).

Structs§

DiskCounters
One device’s cumulative counters from /proc/diskstats.
DiskRate
What one device read and wrote over a sample window.

Functions§

disk_rates
Each device’s throughput between two snapshots dt_s apart, for the devices counted accepts and that are in both snapshots.
is_whole_device
True for a device whose throughput is reported: a whole block device (it has a directory in /sys/block; a partition does not) that is not a loop, RAM or compressed-RAM device.
max_disk_util
The highest per-device utilization between two diskstats snapshots taken dt_ms apart. Devices present in only one snapshot are skipped (hotplug between samples); an empty intersection yields None.
parse_dev_mounts
WRITABLE /dev/-backed mount points from /proc/mounts, deduplicated by source device (bind mounts and btrfs subvolumes re-list one device many times; space is a per-DEVICE fact).
parse_diskstats
Every device’s cumulative counters. Field layout per the kernel’s Documentation/iostats: major minor name <stat fields>, where reads completed is stat field 1, sectors read 3, writes completed 5, sectors written 7 and io_ticks 10 (whitespace tokens 3, 5, 7, 9 and 12).