mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-27 07:39:05 +01:00
Cleanup
This commit is contained in:
parent
5fa53a7ab8
commit
b3922b3255
@ -57,7 +57,7 @@ func fileToInt(path string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initSocketHwthreadCoreList() {
|
func initSocketHwthreadCoreList() {
|
||||||
file, err := os.Open(string(PROCFS_CPUINFO))
|
file, err := os.Open(PROCFS_CPUINFO)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
return
|
return
|
||||||
@ -136,8 +136,8 @@ func CoreList() []int {
|
|||||||
// Get list of NUMA node IDs
|
// Get list of NUMA node IDs
|
||||||
func NumaNodeList() []int {
|
func NumaNodeList() []int {
|
||||||
numaList := make([]int, 0)
|
numaList := make([]int, 0)
|
||||||
globPath := filepath.Join(string(SYSFS_NUMABASE), "node*")
|
globPath := filepath.Join(SYSFS_NUMABASE, "node*")
|
||||||
regexPath := filepath.Join(string(SYSFS_NUMABASE), "node(\\d+)")
|
regexPath := filepath.Join(SYSFS_NUMABASE, "node(\\d+)")
|
||||||
regex := regexp.MustCompile(regexPath)
|
regex := regexp.MustCompile(regexPath)
|
||||||
files, err := filepath.Glob(globPath)
|
files, err := filepath.Glob(globPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -173,7 +173,7 @@ func DieList() []int {
|
|||||||
dieList := make([]int, 0)
|
dieList := make([]int, 0)
|
||||||
for _, c := range cpuList {
|
for _, c := range cpuList {
|
||||||
diePath := filepath.Join(
|
diePath := filepath.Join(
|
||||||
string(SYSFS_CPUBASE),
|
SYSFS_CPUBASE,
|
||||||
fmt.Sprintf("cpu%d", c),
|
fmt.Sprintf("cpu%d", c),
|
||||||
"topology/die_id")
|
"topology/die_id")
|
||||||
dieID := fileToInt(diePath)
|
dieID := fileToInt(diePath)
|
||||||
@ -268,14 +268,17 @@ func initCpuData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range HwthreadList() {
|
for _, c := range HwthreadList() {
|
||||||
cache.CpuData = append(cache.CpuData,
|
cache.CpuData =
|
||||||
HwthreadEntry{
|
append(
|
||||||
CpuID: c,
|
cache.CpuData,
|
||||||
Socket: -1,
|
HwthreadEntry{
|
||||||
NumaDomain: -1,
|
CpuID: c,
|
||||||
Die: -1,
|
Socket: -1,
|
||||||
Core: -1,
|
NumaDomain: -1,
|
||||||
})
|
Die: -1,
|
||||||
|
Core: -1,
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
for i := range cache.CpuData {
|
for i := range cache.CpuData {
|
||||||
cEntry := &cache.CpuData[i]
|
cEntry := &cache.CpuData[i]
|
||||||
@ -325,12 +328,12 @@ type CpuInformation struct {
|
|||||||
// CpuInformation reports basic information about the CPU
|
// CpuInformation reports basic information about the CPU
|
||||||
func CpuInfo() CpuInformation {
|
func CpuInfo() CpuInformation {
|
||||||
|
|
||||||
|
cpuData := CpuData()
|
||||||
smtList := make([]int, 0)
|
smtList := make([]int, 0)
|
||||||
numaList := make([]int, 0)
|
numaList := make([]int, 0)
|
||||||
dieList := make([]int, 0)
|
dieList := make([]int, 0)
|
||||||
socketList := make([]int, 0)
|
socketList := make([]int, 0)
|
||||||
coreList := make([]int, 0)
|
coreList := make([]int, 0)
|
||||||
cpuData := CpuData()
|
|
||||||
for i := range cpuData {
|
for i := range cpuData {
|
||||||
d := &cpuData[i]
|
d := &cpuData[i]
|
||||||
if ok := slices.Contains(smtList, d.SMT); !ok {
|
if ok := slices.Contains(smtList, d.SMT); !ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user