iostat

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KiB = 1024
	MiB = KiB * 1024
	GiB = MiB * 1024
)
View Source
const (
	IOSTAT_DIRECTORY = "/dev/shm"
)

Variables

View Source
var ErrInvalidParam = errors.New("iostat: invalid params")

Functions

func OpenStat

func OpenStat(path string, readonly int, size int64) (*os.File, error)

func PurgeStatFile

func PurgeStatFile(ctx context.Context, dirname string, suffix string, purgeFunc func(path string) error) (
	deleted []string, err error,
)

Types

type IOViewer

type IOViewer interface {
	ReadStat() *StatData
	WriteStat() *StatData
	Update()
	Close()
}

type Iostat

type Iostat interface {
	Get(out *Stat)
	Begin(size uint64)
	End(latency uint64)
}

type Stat

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

func (*Stat) CopyReadStat

func (stat *Stat) CopyReadStat(out *Stat)

func (*Stat) CopyWriteStat

func (stat *Stat) CopyWriteStat(out *Stat)

func (*Stat) ReadBegin

func (stat *Stat) ReadBegin(size uint64)

func (*Stat) ReadEnd

func (stat *Stat) ReadEnd(latency uint64)

func (*Stat) WriteBegin

func (stat *Stat) WriteBegin(size uint64)

func (*Stat) WriteEnd

func (stat *Stat) WriteEnd(latency uint64)

type StatData

type StatData struct {
	Iops  uint64
	Bps   uint64
	Avgrq uint64 // bytes
	Avgqu int64  // count. io depth
	Await int64  // nanoseconds
}

type StatItem

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

type StatIterator

type StatIterator struct {
	Stat     *Stat                 // share memory
	LastStat atomic.Value          // :Stat , last stat
	IoStat   [maxType]atomic.Value // :StatData
	// contains filtered or unexported fields
}

func (*StatIterator) Update

func (iter *StatIterator) Update()

type StatMgr

type StatMgr struct {
	Stat   *Stat
	Data   []byte
	Path   string
	DryRun bool
}

func StatInit

func StatInit(path string, rdonly int, dryRun bool) (*StatMgr, error)

func StatInitWithShareMemory

func StatInitWithShareMemory(path string, rdonly int) (*StatMgr, error)

func (*StatMgr) ReadBegin

func (sm *StatMgr) ReadBegin(size uint64)

func (*StatMgr) ReadEnd

func (sm *StatMgr) ReadEnd(t time.Time)

func (*StatMgr) Reader

func (sm *StatMgr) Reader(underlying io.Reader) io.Reader

func (*StatMgr) ReaderAt

func (sm *StatMgr) ReaderAt(underlying io.ReaderAt) io.ReaderAt

func (*StatMgr) ReaderCloser

func (sm *StatMgr) ReaderCloser(underlying io.ReadCloser) io.ReadCloser

func (*StatMgr) WriteBegin

func (sm *StatMgr) WriteBegin(size uint64)

func (*StatMgr) WriteCloser

func (sm *StatMgr) WriteCloser(underlying io.WriteCloser) io.WriteCloser

func (*StatMgr) WriteEnd

func (sm *StatMgr) WriteEnd(t time.Time)

func (*StatMgr) Writer

func (sm *StatMgr) Writer(underlying io.Writer) io.Writer

func (*StatMgr) WriterAt

func (sm *StatMgr) WriterAt(underlying io.WriterAt) io.WriterAt

type StatMgrAPI

type StatMgrAPI interface {
	ReadBegin(size uint64)
	ReadEnd(t time.Time)
	WriteBegin(size uint64)
	WriteEnd(t time.Time)
	Writer(underlying io.Writer) io.Writer
	WriterAt(underlying io.WriterAt) io.WriterAt
	Reader(underlying io.Reader) io.Reader
	ReaderAt(underlying io.ReaderAt) io.ReaderAt
}

type Viewer

type Viewer struct {
	StatIterator
	// contains filtered or unexported fields
}

func NewIOViewer

func NewIOViewer(stat *Stat, intervalMs int64) (iov *Viewer)

func (*Viewer) Close

func (iov *Viewer) Close()

func (*Viewer) ReadStat

func (iov *Viewer) ReadStat() *StatData

func (*Viewer) WriteStat

func (iov *Viewer) WriteStat() *StatData

Jump to

Keyboard shortcuts

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