Merge pull request #223 from stokito/trim

file.go: remove duplicated trim
This commit is contained in:
bradley 2020-11-13 15:40:01 -05:00 committed by GitHub
commit 9aaba5dfca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -66,7 +66,7 @@ func Read() error {
for _, s := range strings.Split(colStr, ",") { for _, s := range strings.Split(colStr, ",") {
s = strings.TrimSpace(s) s = strings.TrimSpace(s)
if s != "" { if s != "" {
colNames = append(colNames, strings.TrimSpace(s)) colNames = append(colNames, s)
} }
} }
SetColumns(colNames) SetColumns(colNames)

View File

@ -86,9 +86,9 @@ func (c *Docker) ReadCPU(stats *api.Stats) {
syscpudiff := system - c.lastSysCpu syscpudiff := system - c.lastSysCpu
if c.scaleCpu { if c.scaleCpu {
c.CPUUtil = round((cpudiff / syscpudiff * 100)) c.CPUUtil = percent(cpudiff, syscpudiff)
} else { } else {
c.CPUUtil = round((cpudiff / syscpudiff * 100) * ncpus) c.CPUUtil = percent(ncpus*cpudiff, syscpudiff)
} }
c.lastCpu = total c.lastCpu = total
c.lastSysCpu = system c.lastSysCpu = system

View File

@ -96,9 +96,9 @@ func (c *Runc) ReadCPU(stats *cgroups.Stats) {
syscpudiff := system - c.lastSysCpu syscpudiff := system - c.lastSysCpu
if c.scaleCpu { if c.scaleCpu {
c.CPUUtil = round((cpudiff / syscpudiff * 100)) c.CPUUtil = percent(cpudiff, syscpudiff)
} else { } else {
c.CPUUtil = round((cpudiff / syscpudiff * 100) * ncpus) c.CPUUtil = percent(ncpus*cpudiff, syscpudiff)
} }
c.lastCpu = total c.lastCpu = total
c.lastSysCpu = system c.lastSysCpu = system