Documentation
¶
Overview ¶
Package sysstat reads the machine conch's server runs on: its CPU and each core, memory and where it goes, load, disk, and every process with its CPU and memory — for system.stats, the window beside the resource monitor. It reads only when asked, and keeps an hour of history while somebody keeps asking.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Pick ¶
func Pick(all []proto.SystemProcess, n, most int) []proto.SystemProcess
Pick is what a window lists of every process: the n busiest and the n largest, and every one conch started, at most max, the busiest first.
Types ¶
type Proc ¶
type Proc struct {
PID, PPID int
Name string
User string
RSS uint64 // bytes
CPU float64
Threads int
Started time.Time
}
Proc is one process at one moment. CPU is the processor time it has used so far, in seconds: only the difference between two readings says how busy it is.
type Sampler ¶
type Sampler struct {
// contains filtered or unexported fields
}
Sampler answers system.stats. Its zero value is not usable: New.
func (*Sampler) Stats ¶
func (s *Sampler) Stats(ctx context.Context, p proto.SystemStatsParams, tag func([]proto.SystemProcess)) proto.SystemStats
Stats is the machine now. tag names the processes conch started — it is given every process, and its parents, before any is picked to list.
type Source ¶
type Source struct {
Host func() proto.SystemHost
Ticks func() (CPUTicks, bool)
Memory func(ctx context.Context) (*proto.SystemMemory, bool)
Load func() []float64
Disk func() *proto.SystemDisk
Procs func(ctx context.Context) ([]Proc, error)
Commands func(ctx context.Context, pids []int) map[int]string
}
Source is where the readings come from: the machine's own (Local), or a test's. A reader left nil is something the machine does not say.