You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/agent/hypervisor/metrics_helpers.go

16 lines
341 B
Go

package hypervisor
type memoryUsageStats struct {
AvailableKiB *uint64
UnusedKiB *uint64
}
func estimateMemoryUsedKiB(stats memoryUsageStats) *uint64 {
if stats.AvailableKiB == nil || stats.UnusedKiB == nil ||
*stats.UnusedKiB > *stats.AvailableKiB {
return nil
}
used := *stats.AvailableKiB - *stats.UnusedKiB
return &used
}