More debug logs to figure out stats
This commit is contained in:
@@ -268,6 +268,8 @@ github.com/shuffle/shuffle-shared v0.4.17 h1:56ll366bdmIJu/7GFqNC2XTjjl0SGBf430P
|
|||||||
github.com/shuffle/shuffle-shared v0.4.17/go.mod h1:jQrYySmvp/0De5ftrAaY6xwwr7TMfqBmBxQ2AX9yrjQ=
|
github.com/shuffle/shuffle-shared v0.4.17/go.mod h1:jQrYySmvp/0De5ftrAaY6xwwr7TMfqBmBxQ2AX9yrjQ=
|
||||||
github.com/shuffle/shuffle-shared v0.4.57 h1:o+mMPRY4ourkE3R0qdi80jg6RlCtvAJ/VVrPk4y75Hk=
|
github.com/shuffle/shuffle-shared v0.4.57 h1:o+mMPRY4ourkE3R0qdi80jg6RlCtvAJ/VVrPk4y75Hk=
|
||||||
github.com/shuffle/shuffle-shared v0.4.57/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI=
|
github.com/shuffle/shuffle-shared v0.4.57/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI=
|
||||||
|
github.com/shuffle/shuffle-shared v0.4.59 h1:5Sv8aorgQJFZr3cCKltfycdXzp9v5zlF2l3GZXjrTEo=
|
||||||
|
github.com/shuffle/shuffle-shared v0.4.59/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI=
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Starts jobs in bulk, so this could be increased
|
// Starts jobs in bulk, so this could be increased
|
||||||
var sleepTime = 3
|
var sleepTime = 2
|
||||||
|
|
||||||
// Making it work on low-end machines even during busy times :)
|
// Making it work on low-end machines even during busy times :)
|
||||||
// May cause some things to run slowly
|
// May cause some things to run slowly
|
||||||
@@ -972,8 +972,12 @@ func parseResourceUsage(body io.Reader) (float64, float64, error) {
|
|||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//log.Printf("CPU : %d", stats.CPUStats.CPUUsage.TotalUsage)
|
log.Printf("[DEBUG] CPU : %d", stats.CPUStats.CPUUsage.TotalUsage)
|
||||||
//log.Printf("CPU2: %d", stats.PreCPUStats.CPUUsage.TotalUsage)
|
log.Printf("[DEBUG] CPU2: %d", stats.PreCPUStats.CPUUsage.TotalUsage)
|
||||||
|
|
||||||
|
if stats.CPUStats.CPUUsage.TotalUsage == 0 || stats.PreCPUStats.CPUUsage.TotalUsage == 0 {
|
||||||
|
log.Printf("[DEBUG] BODY: %#v", stats)
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate time difference between current and previous stats in nanoseconds
|
// Calculate time difference between current and previous stats in nanoseconds
|
||||||
timeDelta := float64(stats.Read.Sub(stats.PreRead).Nanoseconds())
|
timeDelta := float64(stats.Read.Sub(stats.PreRead).Nanoseconds())
|
||||||
@@ -1082,9 +1086,9 @@ func getOrborusStats() shuffle.OrborusStats {
|
|||||||
|
|
||||||
// Collect results from the channel
|
// Collect results from the channel
|
||||||
for result := range resultCh {
|
for result := range resultCh {
|
||||||
//fmt.Printf("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)
|
||||||
totalCPU += result.cpuUsage
|
totalCPU += float64(result.cpuUsage)
|
||||||
memUsage += result.memoryUsage
|
memUsage += float64(result.memoryUsage)
|
||||||
}
|
}
|
||||||
|
|
||||||
newStats.CPUPercent = totalCPU
|
newStats.CPUPercent = totalCPU
|
||||||
|
|||||||
Reference in New Issue
Block a user