usage

package
v0.0.0-...-3de72e3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CPUPct = "CPU_pct"
	MemPct = "MEM_pct"
	// MemVirt is the total amount of virtual memory used by the current process,
	// includes physically memory used by code, data and libraries, also pages
	// have been swapped out and pages have been mapped but not used yet.
	MemVirt = "MEM_VIRT_mbs"
	// MemRes is a subset of MemVirt, includes the non-swapping physical memory
	// the process is actively using only.
	MemRes = "MEM_RES_mbs"
)

These are the names of the proxy's resource usage stats.

Variables

This section is empty.

Functions

func Sample

func Sample(uSampler Sampler) map[string]int64

Sample returns the current resource usage data by performing a new measurement.

Types

type PsutilSampler

type PsutilSampler struct {
	Sampler
}

PsutilSampler is an instance that reports the usage of OS resource.

func New

func New() *PsutilSampler

New a PsutilSampler instance with current process's pid.

type Sampler

type Sampler interface {
	Percent(interval time.Duration) (float64, error)
	MemoryPercent() (float32, error)
	MemoryInfo() (*process.MemoryInfoStat, error)
}

Sampler is an interface that can provide the sampled system resource usage.

Jump to

Keyboard shortcuts

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