Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultUpdateInterval = 10 * time.Second
)
Limiter defaults.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Limiter ¶
type Limiter struct { // Frequency of updates of the in-core vector. // Updates are performed lazily so this is the maximum frequency. UpdateInterval time.Duration // OS mincore() function. Mincore func(data []byte) ([]byte, error) // contains filtered or unexported fields }
Limiter represents a token bucket rate limiter based on
func NewLimiter ¶
NewLimiter returns a new instance of Limiter associated with an mmap. The underlying limiter can be shared to limit faults across the entire process.
func (*Limiter) IsInCore ¶
IsInCore returns true if the address is resident in memory or if the address is outside the range of the data the limiter is tracking.
func (*Limiter) Update ¶
Update updates the vector of in-core pages. Automatically updated when calling Wait().
func (*Limiter) WaitPointer ¶
WaitPointer checks if ptr would cause a page fault and, if so, rate limits its access. Once a page access is limited, it's updated to be considered memory resident.
Click to show internal directories.
Click to hide internal directories.