Multiple fixes to 'docker stats' output:

* Add space between values in docker stats output for easier parsing

  Old output could not be parsed easily because there were columns
  that did not have any separator. Also values that are together
  without any space is difficult to read even for humans.

* Update unit.HumanSize comment to match what the does actually does

Signed-off-by: Otto Kekäläinen <otto@seravo.fi>
This commit is contained in:
Otto Kekäläinen 2015-07-29 14:12:57 +03:00
parent c19a00d4cb
commit b619220ce1
6 changed files with 15 additions and 16 deletions

View file

@ -28,4 +28,3 @@ Run **docker stats** with multiple containers.
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O
redis1 0.07% 796 KB / 64 MB 1.21% 788 B / 648 B redis1 0.07% 796 KB / 64 MB 1.21% 788 B / 648 B
redis2 0.07% 2.746 MB / 64 MB 4.29% 1.266 KB / 648 B redis2 0.07% 2.746 MB / 64 MB 4.29% 1.266 KB / 648 B

View file

@ -49,7 +49,7 @@ func CustomSize(format string, size float64, base float64, _map []string) string
} }
// HumanSize returns a human-readable approximation of a size // HumanSize returns a human-readable approximation of a size
// using SI standard (eg. "44kB", "17MB"). // capped at 4 valid numbers (eg. "2.746 MB", "796 KB").
func HumanSize(size float64) string { func HumanSize(size float64) string {
return CustomSize("%.4g %s", size, 1000.0, decimapAbbrs) return CustomSize("%.4g %s", size, 1000.0, decimapAbbrs)
} }