| ... | ... |
@@ -14,7 +14,10 @@ import ( |
| 14 | 14 |
"github.com/dotcloud/docker/pkg/system" |
| 15 | 15 |
) |
| 16 | 16 |
|
| 17 |
-var cpuCount = float64(runtime.NumCPU()) |
|
| 17 |
+var ( |
|
| 18 |
+ cpuCount = float64(runtime.NumCPU()) |
|
| 19 |
+ clockTicks = float64(system.GetClockTicks()) |
|
| 20 |
+) |
|
| 18 | 21 |
|
| 19 | 22 |
type cpuacctGroup struct {
|
| 20 | 23 |
} |
| ... | ... |
@@ -58,7 +61,7 @@ func (s *cpuacctGroup) Stats(d *data) (map[string]float64, error) {
|
| 58 | 58 |
deltaSystem = lastSystem - startSystem |
| 59 | 59 |
) |
| 60 | 60 |
if deltaSystem > 0.0 {
|
| 61 |
- percentage = ((deltaProc / deltaSystem) * 100.0) * cpuCount |
|
| 61 |
+ percentage = ((deltaProc / deltaSystem) * clockTicks) * cpuCount |
|
| 62 | 62 |
} |
| 63 | 63 |
// NOTE: a percentage over 100% is valid for POSIX because that means the |
| 64 | 64 |
// processes is using multiple cores |