Parses /proc/diskstats into per-device I/O counters.
Each line is major minor name <stats...>. This reads the cumulative sector
counts (sectors_read, column 6; sectors_written, column 10) and converts them
to bytes - a sector is 512 bytes by kernel convention, independent of the disk's
physical sector size.
Every device line is returned as-is: whole disks, partitions, and loop/dm/nbd virtual devices alike. Which devices count toward a metric (and how to avoid double-counting a disk and its partitions) is the caller's policy, not this parser's concern.
Summary
Functions
Parse a /proc/diskstats payload into one Device per device line.
Read and parse /proc/diskstats.
Functions
@spec parse(String.t()) :: [Sys.Linux.Proc.Diskstats.Device.t()]
Parse a /proc/diskstats payload into one Device per device line.
@spec read() :: {:ok, [Sys.Linux.Proc.Diskstats.Device.t()]} | {:error, File.posix()}
Read and parse /proc/diskstats.