Browse code

Reset data of stats in docker cli when container stopped

When use `docker stats` to minitor a running container and then stop it,
there are some fields need to be reset to zero. Otherwise it will keep
displaying the data it received last time.

Signed-off-by: Hu Keping <hukeping@huawei.com>

Hu Keping authored on 2015/09/18 16:24:13
Showing 1 changed files
... ...
@@ -99,6 +99,11 @@ func (s *containerStats) Collect(cli *DockerCli, streamStats bool) {
99 99
 			s.CPUPercentage = 0
100 100
 			s.Memory = 0
101 101
 			s.MemoryPercentage = 0
102
+			s.MemoryLimit = 0
103
+			s.NetworkRx = 0
104
+			s.NetworkTx = 0
105
+			s.BlockRead = 0
106
+			s.BlockWrite = 0
102 107
 			s.mu.Unlock()
103 108
 		case err := <-u:
104 109
 			if err != nil {