Documentation ¶
Index ¶
- type Thread
- type ThreadSet
- func Discover() (ThreadSet, error)
- func GetSiblingThreadsOfThread(reservedThread Thread) ThreadSet
- func GetSiblingThreadsOfThreadSet(threads ThreadSet) (results ThreadSet)
- func NewThreadSet() ThreadSet
- func NewThreadSetFromIntSet(threads isolation.IntSet) (threadSet ThreadSet, err error)
- func ReadTopology(lscpuOutput []byte) (ThreadSet, error)
- func SharedCacheThreads() ThreadSet
- func (s ThreadSet) AvailableCores() isolation.IntSet
- func (s ThreadSet) AvailableSockets() isolation.IntSet
- func (s ThreadSet) AvailableThreads() isolation.IntSet
- func (s ThreadSet) Contains(t Thread) bool
- func (s ThreadSet) Cores(n int) (ThreadSet, error)
- func (s ThreadSet) Difference(ts ThreadSet) ThreadSet
- func (s ThreadSet) Filter(by func(Thread) bool) ThreadSet
- func (s ThreadSet) FromCores(coreIDs ...int) (ThreadSet, error)
- func (s ThreadSet) FromSockets(socketIDs ...int) (ThreadSet, error)
- func (s ThreadSet) FromThreads(threadIDs ...int) (ThreadSet, error)
- func (s ThreadSet) Partition(by func(Thread) bool) (ThreadSet, ThreadSet)
- func (s ThreadSet) Remove(t Thread) ThreadSet
- func (s ThreadSet) RemoveThreadSet(ts ThreadSet) (result ThreadSet)
- func (s ThreadSet) Sockets(n int) (ThreadSet, error)
- func (s ThreadSet) Threads(n int) (ThreadSet, error)
- func (s ThreadSet) ToCPUSetNotation() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Thread ¶
Thread represents a hyperthread, typically presented by the operating system as a logical CPU.
func NewThreadFromID ¶
NewThreadFromID returns new Thread from ThreadID
type ThreadSet ¶
type ThreadSet []Thread
ThreadSet represents a subset of the available hyperthreads on a system.
func GetSiblingThreadsOfThread ¶
GetSiblingThreadsOfThread returns sibling HyperThread for supplied Thread.
func GetSiblingThreadsOfThreadSet ¶
GetSiblingThreadsOfThreadSet returns sibling HyperThreads for supplied ThreadSet.
func NewThreadSet ¶
func NewThreadSet() ThreadSet
NewThreadSet returns a newly allocated thread set.
func NewThreadSetFromIntSet ¶
NewThreadSetFromIntSet returns newly allocated thread set from IntSet with Thread IDs.
func ReadTopology ¶
ReadTopology attempts to create a ThreadSet that corresponds to the supplied output from `lscpu -p`.
func SharedCacheThreads ¶
func SharedCacheThreads() ThreadSet
SharedCacheThreads returns threads from one socket that share a last-level cache. To avoid placing workloads on both hyperthreads for any physical core, only one thread from each is included in the result.
func (ThreadSet) AvailableCores ¶
AvailableCores returns the set of core ids for threads in this thread set.
func (ThreadSet) AvailableSockets ¶
AvailableSockets returns the set of socket ids for threads in this thread set.
func (ThreadSet) AvailableThreads ¶
AvailableThreads returns the set of thread ids for threads in this thread set.
func (ThreadSet) Cores ¶
Cores returns a newly allocated thread set containing all threads from `n` distinct cores. If there are fewer than `n` available, returns an error.
func (ThreadSet) Difference ¶
Difference returns a newly allocated thread set containing all threads from this set except those contained in the supplied set.
func (ThreadSet) Filter ¶
Filter returns a newly allocated thread set containing all elements from this set that match the supplied predicate.
func (ThreadSet) FromCores ¶
FromCores returns a newly allocated thread set containing all threads from the supplied cores. If any of the supplied cores are invalid, returns an error.
func (ThreadSet) FromSockets ¶
FromSockets returns a newly allocated thread set containing all threads from the supplied sockets. If any of the supplied sockets are invalid, returns an error.
func (ThreadSet) FromThreads ¶
FromThreads returns a newly allocated thread set containing all threads with the supplied IDs. If any of the supplied thread IDs are invalid, returns an error.
func (ThreadSet) Partition ¶
Partition returns two newly allocated thread sets: the first contains threads from this set that match the supplied predicate and the second contains threads that do not.
func (ThreadSet) Remove ¶
Remove returns a newly allocated thread set containing all threads from this set except the supplied thread.
func (ThreadSet) RemoveThreadSet ¶
RemoveThreadSet Remove returns a newly allocated thread set containing all threads from this set except the supplied threads.
func (ThreadSet) Sockets ¶
Sockets returns a newly allocated thread set containing all threads from `n` distinct sockets. If there are fewer than `n` available, returns an error.
func (ThreadSet) Threads ¶
Threads returns a newly allocated thread set containing `n` distinct threads from this thread set. If there are fewer than `n` available, returns an error.
func (ThreadSet) ToCPUSetNotation ¶
ToCPUSetNotation returns thread IDs in cpuset notation. Example return: 0,1,2,3,4 (...)