ccTopology

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SYSFS_CPUBASE = `/sys/devices/system/cpu`

Variables

This section is empty.

Functions

func CoreList

func CoreList() []int

CoreList gets the list of CPU core IDs in the order of listing in /proc/cpuinfo

func CpuList

func CpuList() []int

Get list of hardware thread IDs in the order of listing in /proc/cpuinfo Deprecated! Use HwthreadList()

func DieList

func DieList() []int

DieList gets the list of CPU die IDs

func GetCoreHwthreads

func GetCoreHwthreads(core int) []int

GetCoreHwthreads get all hardware thread IDs associated with a CPU core

func GetDieHwthreads

func GetDieHwthreads(die int) []int

GetDieHwthreads gets all hardware thread IDs associated with a CPU die

func GetHwthreadCore

func GetHwthreadCore(cpuID int) int

GetHwthreadCore gets the CPU core ID for a given hardware thread ID In case hardware thread ID is not found -1 is returned

func GetHwthreadDie

func GetHwthreadDie(cpuID int) int

GetHwthreadDie gets the CPU die ID for a given hardware thread ID In case hardware thread ID is not found -1 is returned

func GetHwthreadNumaDomain

func GetHwthreadNumaDomain(cpuID int) int

GetHwthreadNumaDomain gets the NUMA domain ID for a given hardware thread ID In case hardware thread ID is not found -1 is returned

func GetHwthreadSocket

func GetHwthreadSocket(cpuID int) int

GetHwthreadSocket gets the CPU socket ID for a given hardware thread ID In case hardware thread ID is not found -1 is returned

func GetNumaDomainHwthreads

func GetNumaDomainHwthreads(numaDomain int) []int

GetNumaDomainHwthreads gets the all hardware thread IDs associated with a NUMA domain

func GetSocketHwthreads

func GetSocketHwthreads(socket int) []int

GetSocketHwthreads gets all hardware thread IDs associated with a CPU socket

func GetTypeList

func GetTypeList(topology_type string) []int

GetTypeList gets the list of specified type using the naming format inside ClusterCockpit

func HwthreadList

func HwthreadList() []int

HwthreadList gets the list of hardware thread IDs in the order of listing in /proc/cpuinfo

func NumaNodeList

func NumaNodeList() []int

Get list of NUMA node IDs

func SocketList

func SocketList() []int

SocketList gets the list of CPU socket IDs

Types

type CpuInformation

type CpuInformation struct {
	NumHWthreads   int `json:"num_hwthreads"`
	SMTWidth       int `json:"smt_width"`
	NumSockets     int `json:"num_sockets"`
	NumDies        int `json:"num_dies"`
	NumCores       int `json:"num_cores"`
	NumNumaDomains int `json:"num_numa_domains"`
}

Structure holding basic information about a CPU

func CpuInfo

func CpuInfo() CpuInformation

CpuInformation reports basic information about the CPU

type HwthreadEntry

type HwthreadEntry struct {
	// for each CPUx:
	CpuID        int   `json:"cpu_id"`        // CPU / hardware thread ID
	SMT          int   `json:"smt_id"`        // Simultaneous Multithreading ID
	CoreCPUsList []int `json:"core_cpu_list"` // CPUs within the same core
	Core         int   `json:"core_id"`       // Socket local core ID
	Socket       int   `json:"socket_id"`     // Sockets (physical) ID
	Die          int   `json:"die_id"`        // Die ID
	NumaDomain   int   `json:"numa_id"`       // NUMA Domain
}

Structure holding all information about a hardware thread See https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-devices-system-cpu

func CpuData

func CpuData() []HwthreadEntry

CpuData returns CPU data for each hardware thread

Jump to

Keyboard shortcuts

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