Rapl node capping daemon #21
1
go.sum
|
@ -1,5 +1,6 @@
|
|||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
![]() Good point, fixed. Good point, fixed.
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
import (
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
"fmt"
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
"io/ioutil"
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
"os"
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
"strconv"
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
"testing"
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
"github.com/stretchr/testify/assert"
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
)
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
|
||||
// TODO(rdelvalle): Add more thourough testing. Generate mock files
|
||||
// that mimic the powercap subsystem and create test to operate on it.
|
||||
func TestCap(t *testing.T) {
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
func TestCapNode(t *testing.T) {
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
|
||||
err := capNode("/sys/devices/virtual/powercap/intel-rapl", 95)
|
||||
|
||||
|
@ -12,3 +20,23 @@ func TestCap(t *testing.T) {
|
|||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
func TestMaxPower(t *testing.T) {
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
const maxWattage uint64 = 1500000
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
tmpfile, err := ioutil.TempFile("", maxPowerFileShortWindow)
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
assert.NoError(t, err)
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
defer os.Remove(tmpfile.Name())
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
fmt.Println(tmpfile.Name())
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
_, err = tmpfile.Write([]byte(strconv.FormatUint(maxWattage, 10)))
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
assert.NoError(t, err)
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
maxWatts, err := maxPower(tmpfile.Name())
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
assert.NoError(t, err)
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
assert.Equal(t, maxWattage, maxWatts)
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
err = tmpfile.Close()
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
assert.NoError(t, err)
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
}
|
||||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
||||
|
|
|||
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
![]() I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default. I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
![]() Good point, fixed. Good point, fixed.
|
I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.