cpu_resource

package
v0.0.0-...-598a827 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUFree

func CPUFree() (cores uint, mem uint64)

CPUFree is used to retrieve information about the currently available CPU resources

func SetCPULimits

func SetCPULimits(maxCores uint, maxMem uint64) (err kv.Error)

SetCPULimits is used to set the soft limits for the CPU that is premitted to be allocated to callers

Types

type CPUAllocated

type CPUAllocated struct {
	Cores uint
	Mem   uint64
}

CPUAllocated is used to track an individual allocation of CPU resources that will be returned at a later time

func AllocCPU

func AllocCPU(maxCores uint, maxMem uint64, live bool) (alloc *CPUAllocated, err kv.Error)

AllocCPU is used by callers to attempt to allocate a CPU resource from the system, CPU affinity is not implemented and so this is soft accounting

live can be used to test the capacity is sufficient for the request without making the request itself

func (*CPUAllocated) Release

func (cpuAlloc *CPUAllocated) Release()

Release is used to return a soft allocation to the system accounting

Jump to

Keyboard shortcuts

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