mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
Merge branch 'master' into dependabot/go_modules/github.com/opencontainers/runc-1.0.3
This commit is contained in:
commit
1f91033beb
@ -76,7 +76,10 @@ func (c *Docker) Stop() {
|
||||
}
|
||||
|
||||
func (c *Docker) ReadCPU(stats *api.Stats) {
|
||||
ncpus := uint8(len(stats.CPUStats.CPUUsage.PercpuUsage))
|
||||
ncpus := uint8(stats.CPUStats.OnlineCPUs)
|
||||
if ncpus == 0 {
|
||||
ncpus = uint8(len(stats.CPUStats.CPUUsage.PercpuUsage))
|
||||
}
|
||||
total := float64(stats.CPUStats.CPUUsage.TotalUsage)
|
||||
system := float64(stats.CPUStats.SystemCPUUsage)
|
||||
|
||||
|
@ -31,10 +31,14 @@ type Container struct {
|
||||
|
||||
func New(id string, collector collector.Collector, manager manager.Manager) *Container {
|
||||
widgets := compact.NewCompactRow()
|
||||
shortID := id
|
||||
if len(shortID) > 12 {
|
||||
shortID = shortID[0:12]
|
||||
}
|
||||
return &Container{
|
||||
Metrics: models.NewMetrics(),
|
||||
Id: id,
|
||||
Meta: models.NewMeta("id", id[:12]),
|
||||
Meta: models.NewMeta("id", shortID),
|
||||
Widgets: widgets,
|
||||
updater: widgets,
|
||||
collector: collector,
|
||||
|
Loading…
Reference in New Issue
Block a user