Skip to main content

storage_write_bytes

Function storage_write_bytes 

Source
pub fn storage_write_bytes(pid: u32) -> Option<i64>
Expand description

Bytes this process has caused to be written to storage so far (cumulative), read on demand: the part of write_bytes that reached the disk, so it leaves out writes the page cache coalesced or dropped. Linux: write_bytes less cancelled_write_bytes in /proc/<pid>/io (writeback avoided by truncating or deleting). macOS: ri_diskio_byteswritten. Windows has no such counter (None).

Signed on purpose: a process that truncates data another process dirtied is credited the cancellation but not the write (the kernel documents this “negative” I/O), so one process’s value can be below zero. Add the values of a set of processes first and clamp the sum, never each one.