Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fsouza committed Feb 2, 2018
2 parents 7199630 + b6edff4 commit eb67e9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion container.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"strings"
"time"

"github.com/docker/go-units"
units "github.com/docker/go-units"
"golang.org/x/net/context"
)

Expand Down Expand Up @@ -1052,6 +1052,7 @@ type CPUStats struct {
UsageInKernelmode uint64 `json:"usage_in_kernelmode,omitempty" yaml:"usage_in_kernelmode,omitempty" toml:"usage_in_kernelmode,omitempty"`
} `json:"cpu_usage,omitempty" yaml:"cpu_usage,omitempty" toml:"cpu_usage,omitempty"`
SystemCPUUsage uint64 `json:"system_cpu_usage,omitempty" yaml:"system_cpu_usage,omitempty" toml:"system_cpu_usage,omitempty"`
OnlineCPUs uint64 `json:"online_cpus,omitempty" yaml:"online_cpus,omitempty" toml:"online_cpus,omitempty"`
ThrottlingData struct {
Periods uint64 `json:"periods,omitempty"`
ThrottledPeriods uint64 `json:"throttled_periods,omitempty"`
Expand Down
12 changes: 8 additions & 4 deletions container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2473,7 +2473,8 @@ func TestStats(t *testing.T) {
"total_usage" : 36488948,
"usage_in_kernelmode" : 20000000
},
"system_cpu_usage" : 20091722000000000
"system_cpu_usage" : 20091722000000000,
"online_cpus": 4
},
"precpu_stats" : {
"cpu_usage" : {
Expand All @@ -2487,7 +2488,8 @@ func TestStats(t *testing.T) {
"total_usage" : 36488948,
"usage_in_kernelmode" : 20000000
},
"system_cpu_usage" : 20091722000000000
"system_cpu_usage" : 20091722000000000,
"online_cpus": 4
}
}`
// 1 second later, cache is 100
Expand Down Expand Up @@ -2591,7 +2593,8 @@ func TestStats(t *testing.T) {
"total_usage" : 36488948,
"usage_in_kernelmode" : 20000000
},
"system_cpu_usage" : 20091722000000000
"system_cpu_usage" : 20091722000000000,
"online_cpus": 4
},
"precpu_stats" : {
"cpu_usage" : {
Expand All @@ -2605,7 +2608,8 @@ func TestStats(t *testing.T) {
"total_usage" : 36488948,
"usage_in_kernelmode" : 20000000
},
"system_cpu_usage" : 20091722000000000
"system_cpu_usage" : 20091722000000000,
"online_cpus": 4
}
}`
var expected1 Stats
Expand Down

0 comments on commit eb67e9e

Please sign in to comment.