iostat

package
v0.0.0-...-51b3ee1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2016 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DevStatReader

type DevStatReader struct {
	// contains filtered or unexported fields
}

DevStatReader reads statistics for IO devices.

func NewDevStatReader

func NewDevStatReader(path string) *DevStatReader

NewDevStatReader creates DevStatReader that reads from the specified path. It expects well defined format and may cause panics if it is not present.

func (*DevStatReader) ReadStats

func (r *DevStatReader) ReadStats() ([]DeviceStat, error)

ReadDeviceStats reads statistics for all available disks. It does so by reading from /proc/diskstats.

type DeviceStat

type DeviceStat struct {
	// Major device number.
	Major int
	// Minor device number.
	Minor int
	// Device name.
	Name string

	// Total number of reads completed successfully.
	Reads uint64
	// Reads and writes which are adjacent to each other may be merged for
	// efficiency.  Thus two 4K reads may become one 8K read before it is
	// ultimately handed to the disk, and so it will be counted (and queued)
	// as only one I/O.  This field lets you know how often this was done.
	ReadsMerged uint64
	// Total number of sectors read successfully.
	ReadsSectors uint64
	// Total number of milliseconds spent by all reads.
	ReadsTimeMs uint64
	// Total number of writes completed successfully.
	Writes uint64
	// See ReadsMerged.
	WritesMerged uint64
	// Total number of sectors written successfully.
	WritesSectors uint64
	// Total number of milliseconds spent by all writes.
	WritesTimeMs uint64

	// Number of I/Os currently in progress.
	InFlight uint64
	// Number of milliseconds spent doing I/Os.
	IOTimeMs uint64
	// Weighted number of milliseconds spent doing I/Os.
	// This field is incremented at each I/O start, I/O completion, I/O
	// merge, or read of these stats by the number of I/Os in progress
	// (field 9) times the number of milliseconds spent doing I/O since the
	// last update of this field.  This can provide an easy measure of both
	// I/O completion time and the backlog that may be accumulating.
	WeightedIOTimeMS uint64
}

DeviceStat represents statistics about IO device.

func ReadDeviceStats

func ReadDeviceStats() ([]DeviceStat, error)

ReadDeviceStats is shorthand for DefaultDevStatReader.ReadDeviceStats.

type DeviceStatCollector

type DeviceStatCollector struct {
	// contains filtered or unexported fields
}

func NewDeviceStatCollector

func NewDeviceStatCollector(r DeviceStatReader, except *regexp.Regexp) (*DeviceStatCollector, error)

func (*DeviceStatCollector) Collect

func (c *DeviceStatCollector) Collect() ([]metric.Event, error)

type DeviceStatReader

type DeviceStatReader interface {
	ReadStats() ([]DeviceStat, error)
}

DeviceStatReader should read statistics for all available IO devices.

var DefaultDevStatReader DeviceStatReader = NewDevStatReader("/proc/diskstats")

DefaultDevStatReader is the default implementation of DeviceStatReader. It reads IO device statistics from /proc/diskstats

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL