Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultLimit is 80% DefaultLimit float64 = 80.0 // DefaultInterval is 333 ms DefaultInterval time.Duration = time.Millisecond * 333 // DefaultMeasurements is 3 DefaultMeasurements int = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct { // MaxCPUUsage specifies the maximum CPU usage; wait will block if the // average CPU usage during the previous measurements exceeds this value. MaxCPUUsage float64 // MeasureInterval specifies how often the CPU usage should be measured. MeasureInterval time.Duration // Measurements specifies how many measurements should be retained for the // average CPU usage calculation. Measurements int // CurrentProcessOnly specifies that only the CPU usage of the current process // should be measured; otherwise, the full CPU usage is measured. CurrentProcessOnly bool // contains filtered or unexported fields }
Limiter limits the CPU usage
func (*Limiter) Start ¶
Start starts the CPU limiter. If there are undefined variables Start() will set them to the default values.
Click to show internal directories.
Click to hide internal directories.