MCPcopy
hub / github.com/NVIDIA/aistore / calcMaxMemoryUsage

Function calcMaxMemoryUsage

dsort/manager.go:814–824  ·  view source on GitHub ↗
(maxUsage cos.ParsedQuantity, mem *sys.MemStat)

Source from the content-addressed store, hash-verified

812}
813
814func calcMaxMemoryUsage(maxUsage cos.ParsedQuantity, mem *sys.MemStat) uint64 {
815 switch maxUsage.Type {
816 case cos.QuantityPercent:
817 return maxUsage.Value * (mem.Total / 100)
818 case cos.QuantityBytes:
819 return cos.MinU64(maxUsage.Value, mem.Total)
820 default:
821 cos.Assertf(false, "mem usage type (%s) is not recognized.. something went wrong", maxUsage.Type)
822 return 0
823 }
824}

Callers 4

determineDSorterTypeFunction · 0.85
newDSorterGeneralFunction · 0.85
createShardsLocallyMethod · 0.85
freeMemoryMethod · 0.85

Calls 2

MinU64Function · 0.92
AssertfFunction · 0.92

Tested by

no test coverage detected