Skip to content

Commit

Permalink
Fix memory metric integer handling on 32-bit archs
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Volz <[email protected]>
  • Loading branch information
juliusv committed Sep 8, 2023
1 parent a9bdb14 commit 468666b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ func init() {
prometheus.MustRegister(memoryUsage)
}

func runMemorySim(total int, usedBase int, cachedBase int, buffersBase int, maxDeviation float64) {
func runMemorySim(total uint64, usedBase uint64, cachedBase uint64, buffersBase uint64, maxDeviation float64) {
var used, cached, buffers = usedBase, cachedBase, buffersBase

randomStep := func(current, base int) int {
current += int((rand.Float64() - 0.5) * 60 * 1024 * 1024)
maxDev := int(float64(base) * maxDeviation)
randomStep := func(current, base uint64) uint64 {
current += uint64((rand.Float64() - 0.5) * 60 * 1024 * 1024)
maxDev := uint64(float64(base) * maxDeviation)
if current < base-maxDev || current > base+maxDev {
current = base
}
Expand Down

0 comments on commit 468666b

Please sign in to comment.