Make cpu load stats hierarchical for scheddebug.

This commit is contained in:
Rohit Jnagal 2015-01-26 23:48:39 +00:00
parent a3928d6930
commit c26ca15cc7

View File

@ -17,6 +17,7 @@ package scheddebug
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"path"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
@ -110,9 +111,15 @@ func (self *SchedReader) refresh() {
// collapse all autogroups to root. // collapse all autogroups to root.
cgroup = "/" cgroup = "/"
} }
// TODO(rjnagal): Walk up the path and add load to all parent containers. That will make
// it different from netlink approach which is non-hierarchical.
load[cgroup] += int(numRunning) load[cgroup] += int(numRunning)
// Walk up the path and add load to all parent containers.
for cgroup != "/" {
cgroup = path.Dir(cgroup)
if cgroup == "." {
cgroup = "/"
}
load[cgroup] += int(numRunning)
}
} }
glog.V(2).Infof("New loads : %+v", load) glog.V(2).Infof("New loads : %+v", load)
self.dataLock.Lock() self.dataLock.Lock()