Powercap policy and PCP config from commandline.
Added command line arguments corresponding to powercapping policy and pcp config file path.
This commit is contained in:
parent
b8f2248810
commit
c9d4e66236
4 changed files with 22 additions and 17 deletions
|
@ -17,8 +17,8 @@ import (
|
|||
func Start(quit chan struct{}, logging *bool, logMType chan elekLogDef.LogMessageType,
|
||||
logMsg chan string, pcpConfigFile string, s scheduler.Scheduler) {
|
||||
baseSchedRef := s.(*schedulers.BaseScheduler)
|
||||
const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c "
|
||||
cmd := exec.Command("sh", "-c", pcpCommand, pcpConfigFile)
|
||||
var pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c " + pcpConfigFile
|
||||
cmd := exec.Command("sh", "-c", pcpCommand)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
|
||||
pipe, err := cmd.StdoutPipe()
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThreshold, loThreshold float64,
|
||||
logMType chan elekLogDef.LogMessageType, logMsg chan string, pcpConfigFile string) {
|
||||
|
||||
const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c "
|
||||
var pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c " + pcpConfigFile
|
||||
cmd := exec.Command("sh", "-c", pcpCommand, pcpConfigFile)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ func getNextCapValue(curCapValue float64, precision int) float64 {
|
|||
func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiThreshold, loThreshold float64,
|
||||
logMType chan elekLogDef.LogMessageType, logMsg chan string, pcpConfigFile string) {
|
||||
|
||||
const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c "
|
||||
var pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c " + pcpConfigFile
|
||||
cmd := exec.Command("sh", "-c", pcpCommand, pcpConfigFile)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
|
||||
|
|
19
scheduler.go
19
scheduler.go
|
@ -166,20 +166,25 @@ func main() {
|
|||
log.Printf("Unable to create scheduler driver: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Power Capping policy (if required).
|
||||
var noPowercap, extrema, progExtrema bool
|
||||
// REQUIRED PARAMETERS.
|
||||
// PCP logging, Power capping and High and Low thresholds.
|
||||
schedOptions = append(schedOptions, schedulers.WithRecordPCP(&recordPCP))
|
||||
schedOptions = append(schedOptions, schedulers.WithPCPLog(pcpLog))
|
||||
var noPowercap bool
|
||||
var extrema bool
|
||||
var progExtrema bool
|
||||
var powercapValues map[string]struct{} = map[string]struct{}{
|
||||
"": {},
|
||||
"extrema": {},
|
||||
"progExtrema": {},
|
||||
"prog-extrema": {},
|
||||
}
|
||||
|
||||
if _, ok := powercapValues[*powerCapPolicy]; !ok {
|
||||
logger.WriteLog(elekLogDef.ERROR, "Incorrect power capping policy specified.")
|
||||
logger.WriteLog(elekLogDef.ERROR, "Incorrect power-capping algorithm specified.")
|
||||
os.Exit(1)
|
||||
} else {
|
||||
// Indicating which power capping policy to use, if any.
|
||||
// Indicating which power capping algorithm to use, if any.
|
||||
// The pcp-logging with/without power capping will be run after the
|
||||
// scheduler has been configured.
|
||||
if *powerCapPolicy == "" {
|
||||
noPowercap = true
|
||||
} else {
|
||||
|
|
Reference in a new issue