func GetMilliNumCores()

in internal/system/resources.go [50:82]


func GetMilliNumCores() (int, error) {
	allLogicalCoresCount := 0

	nodesDirs, err := getNodesPaths()
	if err != nil {
		return 0, err
	}
	if len(nodesDirs) == 0 {
		zap.L().Error("Nodes topology is not available, providing CPU topology")
		cpuCount, err := getCPUCount()
		if err != nil {
			return 0, err
		}
		return cpuCount * 1000, nil
	}

	for _, dir := range nodesDirs {
		cpuDirs, err := getCPUsPaths(dir)
		if len(cpuDirs) == 0 {
			zap.L().Error("Found node without any CPU", zap.String("dir", dir), zap.Error(err))
		} else {
			cores, err := getCoresInfo(cpuDirs)
			if err != nil {
				return 0, err
			}
			for _, core := range cores {
				allLogicalCoresCount += len(core.Threads)
			}
		}

	}
	return allLogicalCoresCount * 1000, err
}