SysBlockDeviceStat returns stats for the block device read from /sys/block/ /stat. The number of stats read will be 15 if the discard stats are available (kernel 4.18+) and 11 if they are not available.
(device string)
| 322 | // The number of stats read will be 15 if the discard stats are available (kernel 4.18+) |
| 323 | // and 11 if they are not available. |
| 324 | func (fs FS) SysBlockDeviceStat(device string) (IOStats, int, error) { |
| 325 | bytes, err := os.ReadFile(fs.sys.Path(sysBlockPath, device, "stat")) |
| 326 | if err != nil { |
| 327 | return IOStats{}, 0, err |
| 328 | } |
| 329 | return parseSysBlockDeviceStat(bytes) |
| 330 | } |
| 331 | |
| 332 | func parseSysBlockDeviceStat(data []byte) (IOStats, int, error) { |
| 333 | stat := IOStats{} |