refactored name of CapThreshold to LowerCapLimit. Added comment to mention that floating point operations can lead to precision loss.
This commit is contained in:
parent
87bd8d7cf0
commit
41206dd82e
2 changed files with 6 additions and 5 deletions
|
@ -45,4 +45,4 @@ var Tolerance = 0.70
|
||||||
var ConsiderationWindowSize = 20
|
var ConsiderationWindowSize = 20
|
||||||
|
|
||||||
// Threshold below which a host should be capped
|
// Threshold below which a host should be capped
|
||||||
var CapThreshold = 12.5
|
var LowerCapLimit = 12.5
|
||||||
|
|
|
@ -175,7 +175,7 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, pref
|
||||||
// If already capped then the host must be present in orderCappedVictims
|
// If already capped then the host must be present in orderCappedVictims
|
||||||
capValue := orderCappedVictims[alreadyCappedHosts[i]]
|
capValue := orderCappedVictims[alreadyCappedHosts[i]]
|
||||||
// If capValue is greater than the threshold then cap, else continue
|
// If capValue is greater than the threshold then cap, else continue
|
||||||
if capValue > constants.CapThreshold {
|
if capValue > constants.LowerCapLimit {
|
||||||
newCapValue := getNextCapValue(capValue, 2)
|
newCapValue := getNextCapValue(capValue, 2)
|
||||||
if err := rapl.Cap(alreadyCappedHosts[i], "rapl", newCapValue); err != nil {
|
if err := rapl.Cap(alreadyCappedHosts[i], "rapl", newCapValue); err != nil {
|
||||||
log.Printf("Error capping host[%s]", alreadyCappedHosts[i])
|
log.Printf("Error capping host[%s]", alreadyCappedHosts[i])
|
||||||
|
@ -183,7 +183,7 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, pref
|
||||||
// Successful cap
|
// Successful cap
|
||||||
log.Printf("Capped host[%s] at %f", alreadyCappedHosts[i], newCapValue)
|
log.Printf("Capped host[%s] at %f", alreadyCappedHosts[i], newCapValue)
|
||||||
// Checking whether this victim can be capped further
|
// Checking whether this victim can be capped further
|
||||||
if newCapValue <= constants.CapThreshold {
|
if newCapValue <= constants.LowerCapLimit {
|
||||||
// Deleting victim from cappedVictims
|
// Deleting victim from cappedVictims
|
||||||
delete(cappedVictims, alreadyCappedHosts[i])
|
delete(cappedVictims, alreadyCappedHosts[i])
|
||||||
// Updating the cap value in orderCappedVictims
|
// Updating the cap value in orderCappedVictims
|
||||||
|
@ -216,7 +216,8 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, pref
|
||||||
orderCappedToSort := utilities.GetPairList(orderCappedVictims)
|
orderCappedToSort := utilities.GetPairList(orderCappedVictims)
|
||||||
sort.Sort(orderCappedToSort) // Sorted hosts in non-decreasing order of capped states
|
sort.Sort(orderCappedToSort) // Sorted hosts in non-decreasing order of capped states
|
||||||
hostToUncap := orderCappedToSort[0].Key
|
hostToUncap := orderCappedToSort[0].Key
|
||||||
// Uncapping the host
|
// Uncapping the host.
|
||||||
|
// This is a floating point operation and might suffer from precision loss.
|
||||||
newUncapValue := orderCappedVictims[hostToUncap] * 2.0
|
newUncapValue := orderCappedVictims[hostToUncap] * 2.0
|
||||||
if err := rapl.Cap(hostToUncap, "rapl", newUncapValue); err != nil {
|
if err := rapl.Cap(hostToUncap, "rapl", newUncapValue); err != nil {
|
||||||
log.Printf("Error uncapping host[%s]", hostToUncap)
|
log.Printf("Error uncapping host[%s]", hostToUncap)
|
||||||
|
@ -236,7 +237,7 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, pref
|
||||||
delete(orderCappedVictims, hostToUncap)
|
delete(orderCappedVictims, hostToUncap)
|
||||||
// Removing entry from cappedVictims as this host is no longer capped
|
// Removing entry from cappedVictims as this host is no longer capped
|
||||||
delete(cappedVictims, hostToUncap)
|
delete(cappedVictims, hostToUncap)
|
||||||
} else if newUncapValue > constants.CapThreshold { // this check is unnecessary and can be converted to 'else'
|
} else if newUncapValue > constants.LowerCapLimit { // this check is unnecessary and can be converted to 'else'
|
||||||
// Updating the cap value
|
// Updating the cap value
|
||||||
orderCappedVictims[hostToUncap] = newUncapValue
|
orderCappedVictims[hostToUncap] = newUncapValue
|
||||||
cappedVictims[hostToUncap] = newUncapValue
|
cappedVictims[hostToUncap] = newUncapValue
|
||||||
|
|
Reference in a new issue