From acf9332a508affe6de05364e3ae9d8749186e567 Mon Sep 17 00:00:00 2001 From: Akash Kothawale Date: Mon, 5 Feb 2018 16:01:48 -0500 Subject: [PATCH] Comments: Explain what Variance is used for. --- pcp/pcp.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pcp/pcp.go b/pcp/pcp.go index 2d8f51f..9d1aac2 100644 --- a/pcp/pcp.go +++ b/pcp/pcp.go @@ -62,7 +62,9 @@ func Start(quit chan struct{}, logging *bool, logMType chan elecLogDef.LogMessag for i := 0; i < 8; i++ { host := fmt.Sprintf("stratos-00%d.cs.binghamton.edu", i+1) if slaveID, ok := baseSchedRef.HostNameToSlaveID[host]; ok { + baseSchedRef.TasksRunningMutex.Lock() tasksRunning := len(baseSchedRef.Running[slaveID]) + baseSchedRef.TasksRunningMutex.Unlock() if tasksRunning > 0 { cpuTaskShares[i] = cpuUtils[i] / float64(tasksRunning) memTaskShares[i] = memUtils[i] / float64(tasksRunning) @@ -70,6 +72,12 @@ func Start(quit chan struct{}, logging *bool, logMType chan elecLogDef.LogMessag } } + // Variance in resource utilization shows how the current workload has been distributed. + // However, if the number of tasks running are not equally distributed, utilization variance figures become + // less relevant as they do not express the distribution of CPU intensive tasks. + // We thus also calculate `task share variance`, which basically signifies how the workload is distributed + // across each node per share. + cpuVariance, _ := stats.Variance(cpuUtils) cpuTaskSharesVariance, _ := stats.Variance(cpuTaskShares) memVariance, _ := stats.Variance(memUtils)