Documentation
¶
Overview ¶
Package procload reports how much of the memory and CPU this process may use it is using now, as a percentage of what the container allows it.
It exists for the managed-script run worker, which admits a new run only while the replica has headroom (#1843). It knows nothing about scripts: it reads the process's own counters and the limits the container set, and says when it cannot know one, so its caller never refuses work on a number it made up.
Memory is the Go runtime's mapped memory less what it has returned to the operating system (runtime/metrics), against the smallest of the cgroup's memory limit and GOMEMLIMIT. CPU is the process's user and system time over a short window (getrusage), against the cgroup's CPU quota or, without one, GOMAXPROCS. The runtime's own /cpu/classes metrics are not used: they are only brought up to date at garbage collection, so between collections they describe a load that has already changed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MemoryLimit ¶ added in v1.135.1
func MemoryLimit() int64
MemoryLimit is the smallest memory limit in force on this process: the container's cgroup limit or GOMEMLIMIT, in bytes. Zero means none is set. It is what a limit stated as a share of the container's memory is a share of (#1861).
Types ¶
type Sample ¶
Sample is one reading. A percentage whose Known flag is false could not be measured on this platform or under this configuration, and is zero.
type Sampler ¶
type Sampler struct {
// contains filtered or unexported fields
}
Sampler reads the process's load. Safe for concurrent use.