mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
Merge pull request #223 from stokito/trim
file.go: remove duplicated trim
This commit is contained in:
commit
9aaba5dfca
@ -66,7 +66,7 @@ func Read() error {
|
||||
for _, s := range strings.Split(colStr, ",") {
|
||||
s = strings.TrimSpace(s)
|
||||
if s != "" {
|
||||
colNames = append(colNames, strings.TrimSpace(s))
|
||||
colNames = append(colNames, s)
|
||||
}
|
||||
}
|
||||
SetColumns(colNames)
|
||||
|
@ -86,9 +86,9 @@ func (c *Docker) ReadCPU(stats *api.Stats) {
|
||||
syscpudiff := system - c.lastSysCpu
|
||||
|
||||
if c.scaleCpu {
|
||||
c.CPUUtil = round((cpudiff / syscpudiff * 100))
|
||||
c.CPUUtil = percent(cpudiff, syscpudiff)
|
||||
} else {
|
||||
c.CPUUtil = round((cpudiff / syscpudiff * 100) * ncpus)
|
||||
c.CPUUtil = percent(ncpus*cpudiff, syscpudiff)
|
||||
}
|
||||
c.lastCpu = total
|
||||
c.lastSysCpu = system
|
||||
|
@ -96,9 +96,9 @@ func (c *Runc) ReadCPU(stats *cgroups.Stats) {
|
||||
syscpudiff := system - c.lastSysCpu
|
||||
|
||||
if c.scaleCpu {
|
||||
c.CPUUtil = round((cpudiff / syscpudiff * 100))
|
||||
c.CPUUtil = percent(cpudiff, syscpudiff)
|
||||
} else {
|
||||
c.CPUUtil = round((cpudiff / syscpudiff * 100) * ncpus)
|
||||
c.CPUUtil = percent(ncpus*cpudiff, syscpudiff)
|
||||
}
|
||||
c.lastCpu = total
|
||||
c.lastSysCpu = system
|
||||
|
Loading…
Reference in New Issue
Block a user