stats

package
v0.0.0-...-421c679 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CGroupsSampler

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

CGroupsSampler represents Linux cgroups sampler

func NewCGroupsSampler

func NewCGroupsSampler(path string) (*CGroupsSampler, error)

NewCGroupsSampler creates a stats sampler from existing control group

func (*CGroupsSampler) Query

func (s *CGroupsSampler) Query() (*ProcMetrics, error)

Query gets a process metrics from control cgroup

type PSUtilSampler

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

PSUtilSampler represents ps util sampler

func NewPSUtilSampler

func NewPSUtilSampler(proc Process) (*PSUtilSampler, error)

NewPSUtilSampler creates a new ps util sampler

func (*PSUtilSampler) Query

func (s *PSUtilSampler) Query() (*ProcMetrics, error)

Query gets a process metrics

type ProcMetrics

type ProcMetrics struct {
	Mem uint64
	CPU float64
}

ProcMetrics represents stats sample from daemon

type Process

type Process interface {
	// PID returns daemon process id
	PID() (int, error)

	// ProcNames returns the list of process names contributing to mem/cpu usage during overhead benchmark
	ProcNames() []string
}

Process represents an interfaces of a daemon to be sampled

type Sampler

type Sampler interface {
	// Query gets a process metrics (cpu and memory usage) or error
	Query() (*ProcMetrics, error)
}

Sampler represents an interface of a sampler

func NewSampler

func NewSampler(proc Process, cgroupPath string) (Sampler, error)

NewSampler creates a CGroups stats sampler on Linux for a given 'cgroupPath' and fallbacks to psutils implementation on other operating systems

Jump to

Keyboard shortcuts

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