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
4 changed files with 23 additions and 4 deletions

View File

@@ -34,6 +34,10 @@ func setCPUFreqValue(cpu ID, setting string, value int) error {
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
func GetCPUFreqValue(cpu ID, setting string) (int, error) {
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)
}
// 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
func SetCPUsScalingMinFreq(cpus []ID, freq int) error {
for _, cpu := range cpus {
@@ -129,6 +144,10 @@ func writeFileInt(path string, value int) error {
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) {
data, err := os.ReadFile(path)
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/hashicorp/errwrap v1.1.0
## explicit
# github.com/intel/goresctrl v0.7.0
# github.com/intel/goresctrl v0.8.0
## explicit; go 1.20
github.com/intel/goresctrl/pkg/blockio
github.com/intel/goresctrl/pkg/kubernetes