gosigar – github.com/cloudfoundry/gosigar Index | Files | Directories

package sigar

import "github.com/cloudfoundry/gosigar"

Index

Constants

const (
	RunStateSleep   = 'S'
	RunStateRun     = 'R'
	RunStateStop    = 'T'
	RunStateZombie  = 'Z'
	RunStateIdle    = 'D'
	RunStateUnknown = '?'
)

Variables

var ErrNotImplemented = errors.New("gosigar: not implemented")

Functions

func FormatPercent

func FormatPercent(percent float64) string

func FormatSize

func FormatSize(size uint64) string

Go version of apr_strfsize

Types

type ConcreteSigar

type ConcreteSigar struct{}

func (*ConcreteSigar) CollectCpuStats

func (c *ConcreteSigar) CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{})

func (*ConcreteSigar) GetFileSystemUsage

func (c *ConcreteSigar) GetFileSystemUsage(path string) (FileSystemUsage, error)

func (*ConcreteSigar) GetLoadAverage

func (c *ConcreteSigar) GetLoadAverage() (LoadAverage, error)

func (*ConcreteSigar) GetMem

func (c *ConcreteSigar) GetMem() (Mem, error)

func (*ConcreteSigar) GetMemIgnoringCGroups

func (c *ConcreteSigar) GetMemIgnoringCGroups() (Mem, error)

func (*ConcreteSigar) GetSwap

func (c *ConcreteSigar) GetSwap() (Swap, error)

type Cpu

type Cpu struct {
	User    uint64
	Nice    uint64
	Sys     uint64
	Idle    uint64
	Wait    uint64
	Irq     uint64
	SoftIrq uint64
	Stolen  uint64
}

func (Cpu) Delta

func (cpu Cpu) Delta(other Cpu) Cpu

func (*Cpu) Total

func (cpu *Cpu) Total() uint64

type CpuList

type CpuList struct {
	List []Cpu
}

type FileSystem

type FileSystem struct {
	DirName     string
	DevName     string
	TypeName    string
	SysTypeName string
	Options     string
	Flags       uint32
}

type FileSystemList

type FileSystemList struct {
	List []FileSystem
}

type FileSystemUsage

type FileSystemUsage struct {
	Total     uint64
	Used      uint64
	Free      uint64
	Avail     uint64
	Files     uint64
	FreeFiles uint64
}

func (*FileSystemUsage) UsePercent

func (self *FileSystemUsage) UsePercent() float64

type LoadAverage

type LoadAverage struct {
	One, Five, Fifteen float64
}

type Mem

type Mem struct {
	Total      uint64
	Used       uint64
	Free       uint64
	ActualFree uint64
	ActualUsed uint64
}

type ProcArgs

type ProcArgs struct {
	List []string
}

type ProcCpu

type ProcCpu struct {
	ProcTime
	LastTime uint64
	Percent  float64
	// contains filtered or unexported fields
}

func (*ProcCpu) Get

func (self *ProcCpu) Get(pid int) error

type ProcExe

type ProcExe struct {
	Name string
	Cwd  string
	Root string
}

type ProcList

type ProcList struct {
	List []int
}

type ProcMem

type ProcMem struct {
	Size        uint64
	Resident    uint64
	Share       uint64
	MinorFaults uint64
	MajorFaults uint64
	PageFaults  uint64
}

type ProcState

type ProcState struct {
	Name      string
	State     RunState
	Ppid      int
	Tty       int
	Priority  int
	Nice      int
	Processor int
}

type ProcTime

type ProcTime struct {
	StartTime uint64
	User      uint64
	Sys       uint64
	Total     uint64
}

func (*ProcTime) FormatStartTime

func (self *ProcTime) FormatStartTime() string

func (*ProcTime) FormatTotal

func (self *ProcTime) FormatTotal() string

type RunState

type RunState byte

type Sigar

type Sigar interface {
	CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{})
	GetLoadAverage() (LoadAverage, error)
	GetMem() (Mem, error)
	GetMemIgnoringCGroups() (Mem, error)
	GetSwap() (Swap, error)
	GetFileSystemUsage(string) (FileSystemUsage, error)
}

type Swap

type Swap struct {
	Total uint64
	Used  uint64
	Free  uint64
}

type Uptime

type Uptime struct {
	Length float64
}

func (*Uptime) Format

func (self *Uptime) Format() string

Source Files

concrete_sigar.go sigar_format.go sigar_interface.go sigar_shared.go sigar_util.go

Directories

PathSynopsis
examples
fakes
fixtures
fixtures/memory
fixtures/stress
sys
sys/windowsPackage windows contains various Windows system call.
Version
v1.3.92 (latest)
Published
May 7, 2025
Platform
js/wasm
Imports
7 packages
Last checked
3 days ago

Tools for package owners.