Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultCgroup = "/blockless" DefaultMountpoint = "/sys/fs/cgroup" DefaultJobObjectName = "blockless" // Default percentage of the CPU allowed. By default we run unlimited. DefaultCPUPercentage = 1.0 )
Variables ¶
View Source
var DefaultConfig = Config{ Cgroup: DefaultCgroup, JobName: DefaultJobObjectName, MemoryKB: -1, CPUPercentage: DefaultCPUPercentage, }
DefaultConfig describes the default process resource limits.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Cgroup string // On Linux, Cgroup to use for limits. JobName string // On Windows, job object name to use for limits. MemoryKB int64 // Maximum amount of memory allowed in kilobytes. CPUPercentage float64 // Percentage of the CPU time allowed. }
Config represents the resource limits to set.
type Limits ¶
type Limits struct {
// contains filtered or unexported fields
}
func (*Limits) LimitProcess ¶
LimitProcess will set the resource limits for the process with the given PID.
func (*Limits) ListProcesses ¶
ListProcesses will return the pids of the processes that were added to the resource limit group.
type Option ¶
type Option func(*Config)
Option can be used to set limits.
func WithCPUPercentage ¶
WithCPUPercentage sets the percentage of CPU time allowed.
func WithCgroup ¶
WithCgroup sets the path for the cgroup used for the jobs.
func WithJobObjectName ¶
WithJobObjectName sets the name for the job object to be used for the jobs.
func WithMemoryKB ¶
WithMemoryKB sets the max amount of memory allowed in kilobytes.
Click to show internal directories.
Click to hide internal directories.