MCPcopy Create free account
hub / github.com/prometheus/procfs / SysBlockDeviceIOStat

Method SysBlockDeviceIOStat

blockdevice/stats.go:507–524  ·  view source on GitHub ↗

SysBlockDeviceIO returns stats for the block device io counters IO done count: /sys/block/ /device/iodone_cnt IO error count: /sys/block/ /device/ioerr_cnt.

(device string)

Source from the content-addressed store, hash-verified

505// IO done count: /sys/block/<disk>/device/iodone_cnt
506// IO error count: /sys/block/<disk>/device/ioerr_cnt.
507func (fs FS) SysBlockDeviceIOStat(device string) (IODeviceStats, error) {
508 var (
509 ioDeviceStats IODeviceStats
510 err error
511 )
512 for file, p := range map[string]*uint64{
513 "iodone_cnt": &ioDeviceStats.IODoneCount,
514 "ioerr_cnt": &ioDeviceStats.IOErrCount,
515 } {
516 var val uint64
517 val, err = util.ReadHexFromFile(fs.sys.Path(sysBlockPath, device, sysDevicePath, file))
518 if err != nil {
519 return IODeviceStats{}, err
520 }
521 *p = val
522 }
523 return ioDeviceStats, nil
524}

Callers

nothing calls this directly

Calls 2

ReadHexFromFileFunction · 0.92
PathMethod · 0.45

Tested by

no test coverage detected