Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diskstats ¶
type Diskstats struct { Info IOStats // IoStatsCount contains the number of io stats read. For kernel versions // 4.18+, there should be 18 fields read. For earlier kernel versions this // will be 14 because the discard values are not available. IoStatsCount int }
Diskstats combines the device Info and IOStats
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS represents the pseudo-filesystems proc and sys, which provides an interface to kernel data structures.
func NewDefaultFS ¶ added in v0.0.2
NewDefaultFS returns a new blockdevice fs using the default mountPoints for proc and sys. It will error if either of these mount points can't be read.
func NewFS ¶
NewFS returns a new blockdevice fs using the given mountPoints for proc and sys. It will error if either of these mount points can't be read.
func (FS) ProcDiskstats ¶
ProcDiskstats reads the diskstats file and returns an array of Diskstats (one per line/device)
func (FS) SysBlockDeviceStat ¶
SysBlockDeviceStat returns stats for the block device read from /sys/block/<device>/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.
func (FS) SysBlockDevices ¶
SysBlockDevices lists the device names from /sys/block/<dev>
type IOStats ¶
type IOStats struct { // ReadIOs is the number of reads completed successfully. ReadIOs uint64 // ReadMerges is the number of reads merged. Reads and writes // which are adjacent to each other may be merged for efficiency. ReadMerges uint64 // ReadSectors is the total number of sectors read successfully. ReadSectors uint64 // ReadTicks is the total number of milliseconds spent by all reads. ReadTicks uint64 // WriteIOs is the total number of writes completed successfully. WriteIOs uint64 // WriteMerges is the number of reads merged. WriteMerges uint64 // WriteSectors is the total number of sectors written successfully. WriteSectors uint64 // WriteTicks is the total number of milliseconds spent by all writes. WriteTicks uint64 // IOsInProgress is number of I/Os currently in progress. IOsInProgress uint64 // IOsTotalTicks is the number of milliseconds spent doing I/Os. // This field increases so long as IosInProgress is nonzero. IOsTotalTicks uint64 // WeightedIOTicks is the weighted number of milliseconds spent doing I/Os. // This can also be used to estimate average queue wait time for requests. WeightedIOTicks uint64 // DiscardIOs is the total number of discards completed successfully. DiscardIOs uint64 // DiscardMerges is the number of discards merged. DiscardMerges uint64 // DiscardSectors is the total number of sectors discarded successfully. DiscardSectors uint64 // DiscardTicks is the total number of milliseconds spent by all discards. DiscardTicks uint64 }
IOStats models the iostats data described in the kernel documentation https://www.kernel.org/doc/Documentation/iostats.txt, https://www.kernel.org/doc/Documentation/block/stat.txt, and https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats