summaryrefslogtreecommitdiff
path: root/vendor/github.com/containerd/cgroups/cpu.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-02-02 19:43:19 +0000
committerGitHub <noreply@github.com>2018-02-02 19:43:19 +0000
commit3ea23f84818a816104ccdcf6b836ac4bb3a7c366 (patch)
tree7ccc25d859c97ca2cad5282d7e0f4eb9a445c2e3 /vendor/github.com/containerd/cgroups/cpu.go
parenta01f708df5d378af6ff4e804464b34f7c9be2b5d (diff)
parenta417e6e0cc46593eb10d2ce3d5102df39d44b8dd (diff)
downloadpodman-3ea23f84818a816104ccdcf6b836ac4bb3a7c366.tar.gz
podman-3ea23f84818a816104ccdcf6b836ac4bb3a7c366.tar.bz2
podman-3ea23f84818a816104ccdcf6b836ac4bb3a7c366.zip
Merge pull request #284 from mheon/update_vendors
Update containerd/cgroups to fix perf issue
Diffstat (limited to 'vendor/github.com/containerd/cgroups/cpu.go')
-rw-r--r--vendor/github.com/containerd/cgroups/cpu.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/vendor/github.com/containerd/cgroups/cpu.go b/vendor/github.com/containerd/cgroups/cpu.go
index 036bb8fd0..7df1b1cdf 100644
--- a/vendor/github.com/containerd/cgroups/cpu.go
+++ b/vendor/github.com/containerd/cgroups/cpu.go
@@ -84,20 +84,13 @@ func (c *cpuController) Update(path string, resources *specs.LinuxResources) err
return c.Create(path, resources)
}
-func (c *cpuController) Stat(path string, stats *Stats) error {
+func (c *cpuController) Stat(path string, stats *Metrics) error {
f, err := os.Open(filepath.Join(c.Path(path), "cpu.stat"))
if err != nil {
return err
}
defer f.Close()
// get or create the cpu field because cpuacct can also set values on this struct
- stats.cpuMu.Lock()
- cpu := stats.Cpu
- if cpu == nil {
- cpu = &CpuStat{}
- stats.Cpu = cpu
- }
- stats.cpuMu.Unlock()
sc := bufio.NewScanner(f)
for sc.Scan() {
if err := sc.Err(); err != nil {
@@ -109,11 +102,11 @@ func (c *cpuController) Stat(path string, stats *Stats) error {
}
switch key {
case "nr_periods":
- cpu.Throttling.Periods = v
+ stats.CPU.Throttling.Periods = v
case "nr_throttled":
- cpu.Throttling.ThrottledPeriods = v
+ stats.CPU.Throttling.ThrottledPeriods = v
case "throttled_time":
- cpu.Throttling.ThrottledTime = v
+ stats.CPU.Throttling.ThrottledTime = v
}
}
return nil