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 is a mutable builder for CPUSet. Functions that mutate instances of this type are not thread-safe.

func NewBuilder

func NewBuilder() Builder

NewBuilder returns a mutable CPUSet builder.

func (Builder) Add

func (b Builder) Add(elems ...int)

Add adds the supplied elements to the result. Calling Add after calling Result has no effect.

func (Builder) Result

func (b Builder) Result() CPUSet

Result returns the result CPUSet containing all elements that were previously added to this builder. Subsequent calls to Add have no effect.

type CPUSet

type CPUSet struct {
	// contains filtered or unexported fields

}

CPUSet is a thread-safe, immutable set-like data structure for CPU IDs.

func MustParse

func MustParse(s string) CPUSet

MustParse CPUSet constructs a new CPU set from a Linux CPU list formatted string. Unlike Parse, it does not return an error but rather panics if the input cannot be used to construct a CPU set.

func NewCPUSet

func NewCPUSet(cpus ...int) CPUSet

NewCPUSet returns a new CPUSet containing the supplied elements.

func Parse

func Parse(s string) (CPUSet, error)

Parse CPUSet constructs a new CPU set from a Linux CPU list formatted string.

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

func (CPUSet) Clone

func (s CPUSet) Clone() CPUSet

Clone returns a copy of this CPU set.

func (CPUSet) Contains

func (s CPUSet) Contains(cpu int) bool

Contains returns true if the supplied element is present in this set.

func (CPUSet) Difference

func (s CPUSet) Difference(s2 CPUSet) CPUSet

Difference returns a new CPU set that contains all of the elements that are present in this set and not the supplied set, without mutating either source set.

func (CPUSet) Equals

func (s CPUSet) Equals(s2 CPUSet) bool

Equals returns true if the supplied set contains exactly the same elements as this set (s IsSubsetOf s2 and s2 IsSubsetOf s).

func (CPUSet) Filter

func (s CPUSet) Filter(predicate func(int) bool) CPUSet

Filter returns a new CPU set that contains all of the elements from this set that match the supplied predicate, without mutating the source set.

func (CPUSet) FilterNot

func (s CPUSet) FilterNot(predicate func(int) bool) CPUSet

FilterNot returns a new CPU set that contains all of the elements from this set that do not match the supplied predicate, without mutating the source set.

func (CPUSet) Intersection

func (s CPUSet) Intersection(s2 CPUSet) CPUSet

Intersection returns a new CPU set that contains all of the elements that are present in both this set and the supplied set, without mutating either source set.

func (CPUSet) IsEmpty

func (s CPUSet) IsEmpty() bool

IsEmpty returns true if there are zero elements in this set.

func (CPUSet) IsSubsetOf

func (s CPUSet) IsSubsetOf(s2 CPUSet) bool

IsSubsetOf returns true if the supplied set contains all the elements

func (CPUSet) Size

func (s CPUSet) Size() int

Size returns the number of elements in this set.

func (CPUSet) String

func (s CPUSet) String() string

String returns a new string representation of the elements in this CPU set in canonical linux CPU list format.

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

func (CPUSet) ToSlice

func (s CPUSet) ToSlice() []int

ToSlice returns a slice of integers that contains all elements from this set.

func (CPUSet) ToSliceNoSort

func (s CPUSet) ToSliceNoSort() []int

ToSliceNoSort returns a slice of integers that contains all elements from this set.

func (CPUSet) Union

func (s CPUSet) Union(s2 CPUSet) CPUSet

Union returns a new CPU set that contains all of the elements from this set and all of the elements from the supplied set, without mutating either source set.

func (CPUSet) UnionAll

func (s CPUSet) UnionAll(s2 []CPUSet) CPUSet

UnionAll returns a new CPU set that contains all of the elements from this set and all of the elements from the supplied sets, without mutating either source set.

Source Files