cpuallocator

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocFlag

type AllocFlag uint

AllocFlag represents CPU allocation preferences.

const (
	// AllocIdlePackages requests allocation of full idle packages.
	AllocIdlePackages AllocFlag = 1 << iota
	// AllocIdleClusters requests allocation of full idle CPU clusters.
	AllocIdleClusters
	// AllocCacheGroups requests allocation and splitting of idle and used cache groups
	AllocCacheGroups
	// AllocIdleCores requests allocation of full idle cores (all threads in core).
	AllocIdleCores

	// AllocDefault is the default allocation preferences.
	AllocDefault = AllocIdlePackages | AllocIdleClusters | AllocCacheGroups | AllocIdleCores
)

type CPUAllocator

type CPUAllocator interface {
	AllocateCpus(from *cpuset.CPUSet, cnt int, options ...Option) (cpuset.CPUSet, error)
	ReleaseCpus(from *cpuset.CPUSet, cnt int, options ...Option) (cpuset.CPUSet, error)
	GetCPUPriorities() map[CPUPriority]cpuset.CPUSet
}

CPUAllocator is an interface for a generic CPU allocator

func NewCPUAllocator

func NewCPUAllocator(sys sysfs.System) CPUAllocator

NewCPUAllocator return a new cpuAllocator instance

type CPUPriority

type CPUPriority int
const (
	PriorityHigh CPUPriority = iota
	PriorityNormal
	PriorityLow
	NumCPUPriorities
	PriorityNone = NumCPUPriorities
)

func (CPUPriority) Option added in v0.8.0

func (p CPUPriority) Option() Option

func (CPUPriority) String

func (p CPUPriority) String() string

type IDFilter

type IDFilter func(idset.ID) bool

IDFilter helps filtering Ids.

type IDSorter

type IDSorter func(int, int) bool

IDSorter helps sorting Ids.

type Option added in v0.8.0

type Option func(*allocatorHelper) error

Option is an option for a CPU allocation or release.

func WithAllocFlags added in v0.8.0

func WithAllocFlags(flags AllocFlag) Option

WithAllocFlags sets the allocation flags for the allocation.

func WithPriority added in v0.8.0

func WithPriority(p CPUPriority) Option

WithPriority sets the preferred CPU priority for the allocation.

Jump to

Keyboard shortcuts

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