Documentation ¶
Overview ¶
Package cpuset represents a collection of CPUs in a 'set' data structure.
It can be used to represent core IDs, hyper thread siblings, CPU nodes, or processor IDs.
The only special thing about this package is that methods are provided to convert back and forth from Linux 'list' syntax. See http://man7.org/linux/man-pages/man7/cpuset.7.html#FORMATS for details.
Future work can migrate this to use a 'set' library, and relax the dubious 'immutable' property.
Index ¶
- type CPUSet
- func (s CPUSet) Clone() CPUSet
- func (s CPUSet) Contains(cpu int) bool
- func (s CPUSet) Difference(s2 CPUSet) CPUSet
- func (s CPUSet) Equals(s2 CPUSet) bool
- func (s CPUSet) Intersection(s2 CPUSet) CPUSet
- func (s CPUSet) IsEmpty() bool
- func (s CPUSet) IsSubsetOf(s2 CPUSet) bool
- func (s CPUSet) List() []int
- func (s CPUSet) Size() int
- func (s CPUSet) String() string
- func (s CPUSet) Union(s2 ...CPUSet) CPUSet
- func (s CPUSet) UnsortedList() []int
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 thread-safe, immutable set-like data structure for CPU IDs.
func Parse ¶
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) Difference ¶
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 ¶
Equals returns true if the supplied set contains exactly the same elements as this set (s IsSubsetOf s2 and s2 IsSubsetOf s).
func (CPUSet) Intersection ¶
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) IsSubsetOf ¶
IsSubsetOf returns true if the supplied set contains all the elements
func (CPUSet) List ¶ added in v1.27.0
List returns a slice of integers that contains all elements from this set. The list is sorted.
func (CPUSet) 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) Union ¶
Union 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.
func (CPUSet) UnsortedList ¶ added in v1.27.0
UnsortedList returns a slice of integers that contains all elements from this set.