mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-25 02:45:12 +00:00
Update cadvisor and hcsshim versions
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
This commit is contained in:
45
vendor/github.com/google/cadvisor/utils/sysfs/sysfs.go
generated
vendored
45
vendor/github.com/google/cadvisor/utils/sysfs/sysfs.go
generated
vendored
@@ -21,6 +21,7 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -50,6 +51,8 @@ const (
|
||||
|
||||
coreIDFilePath = "/" + sysFsCPUTopology + "/core_id"
|
||||
packageIDFilePath = "/" + sysFsCPUTopology + "/physical_package_id"
|
||||
bookIDFilePath = "/" + sysFsCPUTopology + "/book_id"
|
||||
drawerIDFilePath = "/" + sysFsCPUTopology + "/drawer_id"
|
||||
|
||||
// memory size calculations
|
||||
|
||||
@@ -87,6 +90,10 @@ type SysFs interface {
|
||||
GetCoreID(coreIDFilePath string) (string, error)
|
||||
// Get physical package id for specified CPU
|
||||
GetCPUPhysicalPackageID(cpuPath string) (string, error)
|
||||
// Get book id for specified CPU
|
||||
GetBookID(cpuPath string) (string, error)
|
||||
// Get drawer id for specified CPU
|
||||
GetDrawerID(cpuPath string) (string, error)
|
||||
// Get total memory for specified NUMA node
|
||||
GetMemInfo(nodeDir string) (string, error)
|
||||
// Get hugepages from specified directory
|
||||
@@ -164,6 +171,24 @@ func (fs *realSysFs) GetCPUPhysicalPackageID(cpuPath string) (string, error) {
|
||||
return strings.TrimSpace(string(packageID)), err
|
||||
}
|
||||
|
||||
func (fs *realSysFs) GetBookID(cpuPath string) (string, error) {
|
||||
bookIDFilePath := fmt.Sprintf("%s%s", cpuPath, bookIDFilePath)
|
||||
bookID, err := os.ReadFile(bookIDFilePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimSpace(string(bookID)), nil
|
||||
}
|
||||
|
||||
func (fs *realSysFs) GetDrawerID(cpuPath string) (string, error) {
|
||||
drawerIDFilePath := fmt.Sprintf("%s%s", cpuPath, drawerIDFilePath)
|
||||
drawerID, err := os.ReadFile(drawerIDFilePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimSpace(string(drawerID)), nil
|
||||
}
|
||||
|
||||
func (fs *realSysFs) GetMemInfo(nodePath string) (string, error) {
|
||||
meminfoPath := fmt.Sprintf("%s/%s", nodePath, meminfoFile)
|
||||
meminfo, err := os.ReadFile(meminfoPath)
|
||||
@@ -365,22 +390,24 @@ func getCPUCount(cache string) (count int, err error) {
|
||||
|
||||
func (fs *realSysFs) GetCacheInfo(cpu int, name string) (CacheInfo, error) {
|
||||
cachePath := fmt.Sprintf("%s%d/cache/%s", cacheDir, cpu, name)
|
||||
out, err := os.ReadFile(path.Join(cachePath, "/id"))
|
||||
if err != nil {
|
||||
return CacheInfo{}, err
|
||||
}
|
||||
var id int
|
||||
n, err := fmt.Sscanf(string(out), "%d", &id)
|
||||
if err != nil || n != 1 {
|
||||
return CacheInfo{}, err
|
||||
if runtime.GOARCH != "s390x" {
|
||||
out, err := os.ReadFile(path.Join(cachePath, "/id"))
|
||||
if err != nil {
|
||||
return CacheInfo{}, err
|
||||
}
|
||||
n, err := fmt.Sscanf(string(out), "%d", &id)
|
||||
if err != nil || n != 1 {
|
||||
return CacheInfo{}, err
|
||||
}
|
||||
}
|
||||
|
||||
out, err = os.ReadFile(path.Join(cachePath, "/size"))
|
||||
out, err := os.ReadFile(path.Join(cachePath, "/size"))
|
||||
if err != nil {
|
||||
return CacheInfo{}, err
|
||||
}
|
||||
var size uint64
|
||||
n, err = fmt.Sscanf(string(out), "%dK", &size)
|
||||
n, err := fmt.Sscanf(string(out), "%dK", &size)
|
||||
if err != nil || n != 1 {
|
||||
return CacheInfo{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user