mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 10:19:27 +08:00
23 lines
484 B
Go
23 lines
484 B
Go
package agent
|
|
|
|
import "math"
|
|
|
|
// delete container stats from map using mutex
|
|
func (a *Agent) deleteContainerStatsSync(id string) {
|
|
a.containerStatsMutex.Lock()
|
|
defer a.containerStatsMutex.Unlock()
|
|
delete(a.containerStatsMap, id)
|
|
}
|
|
|
|
func bytesToMegabytes(b float64) float64 {
|
|
return twoDecimals(b / 1048576)
|
|
}
|
|
|
|
func bytesToGigabytes(b uint64) float64 {
|
|
return twoDecimals(float64(b) / 1073741824)
|
|
}
|
|
|
|
func twoDecimals(value float64) float64 {
|
|
return math.Round(value*100) / 100
|
|
}
|