From 3d9f92a9c09b5aea7d403db7d5f0ed71f0ed6970 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Sat, 4 Jan 2020 17:42:59 -0800 Subject: [PATCH] Change some data types around to avoid too much conversion. --- rapl-daemon/util.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rapl-daemon/util.go b/rapl-daemon/util.go index 19e5e44..4e432a8 100644 --- a/rapl-daemon/util.go +++ b/rapl-daemon/util.go @@ -47,7 +47,7 @@ func capNode(base string, percentage int) error { } // 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) 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 -func capZone(zone string, value uint) error { - err := ioutil.WriteFile(zone, []byte(string(value)), 0644) +func capZone(zone string, value uint64) error { + err := ioutil.WriteFile(zone, []byte(strconv.FormatUint(value, 10)), 0644) if err != nil { return err }