cpuset

package
v0.0.0-...-7fe54d0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder will allow building of cpuset fields such as cpuset.cpus and cpuset.mems

Example:

cset := cpuset.Builder{}.
	AddCPU(0).
	AddMemRange(0).
	Build()

fcClient, err := fcclient.New(containerdTTRPCAddress)
if err != nil {
	return err
}

defer fcClient.Close()

vmID := "cpuset-builder-example"
createVMRequest := &proto.CreateVMRequest{
	VMID: vmID,
	JailerConfig: proto.JailerConfig{
		CPUs: cset.CPUs(),
		Mems: cset.Mems(),
	},
}

_, err = fcClient.CreateVM(ctx, createVMRequest)
if err != nil {
	return errors.Wrap(err, "failed to create VM")
}

func (Builder) AddCPU

func (b Builder) AddCPU(cpu int) Builder

AddCPU will add the physical CPU number that the process is allowed to run on.

func (Builder) AddCPURange

func (b Builder) AddCPURange(min, max int) Builder

AddCPURange adds a range of physical CPU numbers that the process is allowed to run on

func (Builder) AddMem

func (b Builder) AddMem(mem int) Builder

AddMem adds a memory node which limits where the cpus can allocate memory

func (Builder) AddMemRange

func (b Builder) AddMemRange(min, max int) Builder

AddMemRange adds a range of memory nodes to be used.

func (Builder) Build

func (b Builder) Build() CPUSet

Build constructs a new CPUSet

type CPUSet

type CPUSet struct {
	// contains filtered or unexported fields
}

CPUSet represents the linux CPUSet which is a series of configurable values that allow processes to run on a specific CPUs and those CPUs are then bound to the memory nodes specified.

More information can be found here: http://man7.org/linux/man-pages/man7/cpuset.7.html

func (CPUSet) CPUs

func (c CPUSet) CPUs() string

CPUs returns the cpuset.cpus string

func (CPUSet) Mems

func (c CPUSet) Mems() string

Mems returns the cpuset.mems string

Jump to

Keyboard shortcuts

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