Change some data types around to avoid too much conversion.
This commit is contained in:
parent
78f533fe21
commit
3d9f92a9c0
1 changed files with 3 additions and 3 deletions
|
@ -47,7 +47,7 @@ func capNode(base string, percentage int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We use floats to mitigate the possibility of an integer overflows.
|
// We use floats to mitigate the possibility of an integer overflows.
|
||||||
powercap := uint(math.Ceil(float64(maxPower) * (float64(percentage) / 100)))
|
powercap := uint64(math.Ceil(float64(maxPower) * (float64(percentage) / 100)))
|
||||||
|
|
||||||
err = capZone(filepath.Join(base, file.Name(), powerLimitFileShortWindow), powercap)
|
err = capZone(filepath.Join(base, file.Name(), powerLimitFileShortWindow), powercap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -79,8 +79,8 @@ func maxPower(zone string) (uint64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// capZone caps a power zone to a specific amount of watts specified by value
|
// capZone caps a power zone to a specific amount of watts specified by value
|
||||||
func capZone(zone string, value uint) error {
|
func capZone(zone string, value uint64) error {
|
||||||
err := ioutil.WriteFile(zone, []byte(string(value)), 0644)
|
err := ioutil.WriteFile(zone, []byte(strconv.FormatUint(value, 10)), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue