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

Method SysBlockDeviceStat

blockdevice/stats.go:324–330  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
324func (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
332func parseSysBlockDeviceStat(data []byte) (IOStats, int, error) {
333 stat := IOStats{}

Callers 1

TestBlockDeviceFunction · 0.95

Calls 2

parseSysBlockDeviceStatFunction · 0.85
PathMethod · 0.45

Tested by 1

TestBlockDeviceFunction · 0.76