cpuset

package
v1.1.17 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUSet

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

CPUSet is a set like object that provides methods helpful when working with cpus with systems such as the Linux cpuset cgroup subsystem. A CPUSet is immutable and can be safely accessed concurrently.

func New

func New(cpus ...uint16) CPUSet

New initializes a new CPUSet with 0 or more containing cpus

func Parse

func Parse(s string) (CPUSet, error)

Parse parses the Linux cpuset format into a CPUSet

Ref: http://man7.org/linux/man-pages/man7/cpuset.7.html#FORMATS

func (CPUSet) ContainsAny

func (s CPUSet) ContainsAny(other CPUSet) bool

ContainsAny returns true if any cpus in other CPUSet are present

func (CPUSet) Difference

func (c CPUSet) Difference(other CPUSet) CPUSet

Difference returns a new set that is the difference of this CPUSet and the supplied other. [0,1,2,3].Difference([2,3,4]) = [0,1]

func (CPUSet) Equals

func (s CPUSet) Equals(other CPUSet) bool

Equals tests the equality of the elements in the CPUSet

func (CPUSet) IsSubsetOf

func (s CPUSet) IsSubsetOf(other CPUSet) bool

IsSubsetOf returns true if all cpus of the this CPUSet are present in the other CPUSet.

func (CPUSet) IsSupersetOf

func (s CPUSet) IsSupersetOf(other CPUSet) bool

func (CPUSet) Size

func (c CPUSet) Size() int

Size returns to the number of cpus contained in the CPUSet

func (CPUSet) String

func (c CPUSet) String() string

String returns the cpuset as a comma delimited set of core values and ranged

func (CPUSet) ToSlice

func (c CPUSet) ToSlice() []uint16

ToSlice returns a sorted slice of uint16 CPU IDs contained in the CPUSet.

func (CPUSet) Union

func (c CPUSet) Union(other CPUSet) CPUSet

Union returns a new set that is the union of this CPUSet and the supplied other. Ex. [0,1,2,3].Union([2,3,4,5]) = [0,1,2,3,4,5]

Jump to

Keyboard shortcuts

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