Skip to content

Commit eb67e9e

Browse files
committed
Merge branch 'online_cpus' of https://github.com/sebito91/go-dockerclient
2 parents 7199630 + b6edff4 commit eb67e9e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

container.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"strings"
1616
"time"
1717

18-
"github.com/docker/go-units"
18+
units "github.com/docker/go-units"
1919
"golang.org/x/net/context"
2020
)
2121

@@ -1052,6 +1052,7 @@ type CPUStats struct {
10521052
UsageInKernelmode uint64 `json:"usage_in_kernelmode,omitempty" yaml:"usage_in_kernelmode,omitempty" toml:"usage_in_kernelmode,omitempty"`
10531053
} `json:"cpu_usage,omitempty" yaml:"cpu_usage,omitempty" toml:"cpu_usage,omitempty"`
10541054
SystemCPUUsage uint64 `json:"system_cpu_usage,omitempty" yaml:"system_cpu_usage,omitempty" toml:"system_cpu_usage,omitempty"`
1055+
OnlineCPUs uint64 `json:"online_cpus,omitempty" yaml:"online_cpus,omitempty" toml:"online_cpus,omitempty"`
10551056
ThrottlingData struct {
10561057
Periods uint64 `json:"periods,omitempty"`
10571058
ThrottledPeriods uint64 `json:"throttled_periods,omitempty"`

container_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,7 +2473,8 @@ func TestStats(t *testing.T) {
24732473
"total_usage" : 36488948,
24742474
"usage_in_kernelmode" : 20000000
24752475
},
2476-
"system_cpu_usage" : 20091722000000000
2476+
"system_cpu_usage" : 20091722000000000,
2477+
"online_cpus": 4
24772478
},
24782479
"precpu_stats" : {
24792480
"cpu_usage" : {
@@ -2487,7 +2488,8 @@ func TestStats(t *testing.T) {
24872488
"total_usage" : 36488948,
24882489
"usage_in_kernelmode" : 20000000
24892490
},
2490-
"system_cpu_usage" : 20091722000000000
2491+
"system_cpu_usage" : 20091722000000000,
2492+
"online_cpus": 4
24912493
}
24922494
}`
24932495
// 1 second later, cache is 100
@@ -2591,7 +2593,8 @@ func TestStats(t *testing.T) {
25912593
"total_usage" : 36488948,
25922594
"usage_in_kernelmode" : 20000000
25932595
},
2594-
"system_cpu_usage" : 20091722000000000
2596+
"system_cpu_usage" : 20091722000000000,
2597+
"online_cpus": 4
25952598
},
25962599
"precpu_stats" : {
25972600
"cpu_usage" : {
@@ -2605,7 +2608,8 @@ func TestStats(t *testing.T) {
26052608
"total_usage" : 36488948,
26062609
"usage_in_kernelmode" : 20000000
26072610
},
2608-
"system_cpu_usage" : 20091722000000000
2611+
"system_cpu_usage" : 20091722000000000,
2612+
"online_cpus": 4
26092613
}
26102614
}`
26112615
var expected1 Stats

0 commit comments

Comments
 (0)