Merge pull request #467 from rjnagal/docker

Make cpu load stats hierarchical for scheddebug.
This commit is contained in:
Victor Marmol 2015-01-26 16:02:24 -08:00
commit 01e59ec3b4

View File

@ -17,6 +17,7 @@ package scheddebug
import (
"fmt"
"io/ioutil"
"path"
"regexp"
"strconv"
"strings"
@ -110,9 +111,15 @@ func (self *SchedReader) refresh() {
// collapse all autogroups to root.
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)
// 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)
self.dataLock.Lock()