Merge pull request #10754 from containerd/dependabot/go_modules/github.com/intel/goresctrl-0.8.0

build(deps): bump github.com/intel/goresctrl from 0.7.0 to 0.8.0
This commit is contained in:
Derek McGowan 2024-10-02 13:53:44 +00:00 committed by GitHub
commit 06dfa0c2f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 4 deletions

2
go.mod
View File

@ -39,7 +39,7 @@ require (
github.com/google/go-cmp v0.6.0 github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1
github.com/intel/goresctrl v0.7.0 github.com/intel/goresctrl v0.8.0
github.com/klauspost/compress v1.17.10 github.com/klauspost/compress v1.17.10
github.com/mdlayher/vsock v1.2.1 github.com/mdlayher/vsock v1.2.1
github.com/moby/locker v1.0.1 github.com/moby/locker v1.0.1

4
go.sum
View File

@ -921,8 +921,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/intel/goresctrl v0.7.0 h1:x6RclP6LiJc24t9mf47BRbjf06B8oVisZMBv31x3rKc= github.com/intel/goresctrl v0.8.0 h1:N3shVbS3kA1Hk2AmcbHv8805Hjbv+zqsCIZCGktxx50=
github.com/intel/goresctrl v0.7.0/go.mod h1:T3ZZnuHSNouwELB5wvOoUJaB7l/4Rm23rJy/wuWJlr0= github.com/intel/goresctrl v0.8.0/go.mod h1:T3ZZnuHSNouwELB5wvOoUJaB7l/4Rm23rJy/wuWJlr0=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=

View File

@ -34,6 +34,10 @@ func setCPUFreqValue(cpu ID, setting string, value int) error {
return writeFileInt(cpuFreqPath(cpu, setting), value) return writeFileInt(cpuFreqPath(cpu, setting), value)
} }
func SetCPUScalingGovernor(cpu ID, governor string) error {
return writeFileStr(cpuFreqPath(cpu, "scaling_governor"), governor)
}
// GetCPUFreqValue returns information of the currently used CPU frequency // GetCPUFreqValue returns information of the currently used CPU frequency
func GetCPUFreqValue(cpu ID, setting string) (int, error) { func GetCPUFreqValue(cpu ID, setting string) (int, error) {
raw, err := os.ReadFile(cpuFreqPath(cpu, setting)) raw, err := os.ReadFile(cpuFreqPath(cpu, setting))
@ -63,6 +67,17 @@ func SetCPUScalingMaxFreq(cpu ID, freq int) error {
return setCPUFreqValue(cpu, "scaling_max_freq", freq) return setCPUFreqValue(cpu, "scaling_max_freq", freq)
} }
// SetScalingGovernorForCPUs sets the scaling_governor of a given set of CPUs
func SetScalingGovernorForCPUs(cpus []ID, governor string) error {
for _, cpu := range cpus {
if err := SetCPUScalingGovernor(cpu, governor); err != nil {
return err
}
}
return nil
}
// SetCPUsScalingMinFreq sets the scaling_min_freq value of a given set of CPUs // SetCPUsScalingMinFreq sets the scaling_min_freq value of a given set of CPUs
func SetCPUsScalingMinFreq(cpus []ID, freq int) error { func SetCPUsScalingMinFreq(cpus []ID, freq int) error {
for _, cpu := range cpus { for _, cpu := range cpus {
@ -129,6 +144,10 @@ func writeFileInt(path string, value int) error {
return os.WriteFile(path, []byte(strconv.Itoa(value)), 0644) return os.WriteFile(path, []byte(strconv.Itoa(value)), 0644)
} }
func writeFileStr(path string, value string) error {
return os.WriteFile(path, []byte(value), 0644)
}
func readFileInt(path string) (int, error) { func readFileInt(path string) (int, error) {
data, err := os.ReadFile(path) data, err := os.ReadFile(path)
if err != nil { if err != nil {

2
vendor/modules.txt vendored
View File

@ -317,7 +317,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2/runtime
github.com/grpc-ecosystem/grpc-gateway/v2/utilities github.com/grpc-ecosystem/grpc-gateway/v2/utilities
# github.com/hashicorp/errwrap v1.1.0 # github.com/hashicorp/errwrap v1.1.0
## explicit ## explicit
# github.com/intel/goresctrl v0.7.0 # github.com/intel/goresctrl v0.8.0
## explicit; go 1.20 ## explicit; go 1.20
github.com/intel/goresctrl/pkg/blockio github.com/intel/goresctrl/pkg/blockio
github.com/intel/goresctrl/pkg/kubernetes github.com/intel/goresctrl/pkg/kubernetes