Small fix
This commit is contained in:
@@ -28,7 +28,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"sync"
|
"sync"
|
||||||
//"math/rand"
|
"math"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
@@ -1087,9 +1087,16 @@ func getOrborusStats() shuffle.OrborusStats {
|
|||||||
memUsage := float64(0.0)
|
memUsage := float64(0.0)
|
||||||
for result := range resultCh {
|
for result := range resultCh {
|
||||||
fmt.Printf("[DEBUG] Container %s CPU utilization: %.2f%%, Memory utilization: %.2f%%\n", result.containerID, result.cpuUsage, result.memoryUsage)
|
fmt.Printf("[DEBUG] Container %s CPU utilization: %.2f%%, Memory utilization: %.2f%%\n", result.containerID, result.cpuUsage, result.memoryUsage)
|
||||||
|
|
||||||
|
// check if it's NaN or Inf
|
||||||
|
if !math.IsNaN(result.cpuUsage) {
|
||||||
totalCPU += float64(result.cpuUsage)
|
totalCPU += float64(result.cpuUsage)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !math.IsNaN(result.memoryUsage) {
|
||||||
memUsage += float64(result.memoryUsage)
|
memUsage += float64(result.memoryUsage)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
newStats.CPUPercent = totalCPU
|
newStats.CPUPercent = totalCPU
|
||||||
newStats.MemoryPercent = memUsage
|
newStats.MemoryPercent = memUsage
|
||||||
|
|||||||
Reference in New Issue
Block a user