# `Sys.Linux.Proc.Diskstats`
[🔗](https://github.com/harmont-dev/hyper/blob/main/lib/sys/linux/proc/diskstats.ex#L1)

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.

# `parse`

```elixir
@spec parse(String.t()) :: [Sys.Linux.Proc.Diskstats.Device.t()]
```

Parse a `/proc/diskstats` payload into one `Device` per device line.

# `read`

```elixir
@spec read() :: {:ok, [Sys.Linux.Proc.Diskstats.Device.t()]} | {:error, File.posix()}
```

Read and parse `/proc/diskstats`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
