Skip to main content

sample_disk_io

Function sample_disk_io 

Source
pub fn sample_disk_io() -> Vec<IoCounters>
Expand description

Samples cumulative disk byte counters for physical whole disks.

Linux reads /proc/diskstats; Windows queries IOCTL_DISK_PERFORMANCE per \\.\PhysicalDriveN; macOS reads the Statistics dictionary off each IOKit IOBlockStorageDriver. Elsewhere this returns an empty vector, so the field is simply absent rather than wrong (same shape as brightness, keyboard, tpm).

Partitions are excluded on all three because their traffic is already counted against the parent device — reporting both would double every disk’s apparent throughput. On Windows that falls out of addressing whole drives directly, and on macOS out of the counters living on the driver above the whole-disk media; on Linux it takes an explicit filter.