properly store humanized RAM

This commit is contained in:
Erikas 2024-07-12 10:50:09 +03:00
parent fb2642aad2
commit bd42e6738d

View File

@ -107,10 +107,12 @@ func readMangoHudFile(scanner *bufio.Scanner) (*BenchmarkData, error) {
case 3: case 3:
kilobytes := new(big.Int) kilobytes := new(big.Int)
_, ok := kilobytes.SetString(strings.TrimSpace(v), 10) _, ok := kilobytes.SetString(strings.TrimSpace(v), 10)
if !ok { if ok {
// Contains number that represents kilobytes
bytes := new(big.Int).Mul(kilobytes, big.NewInt(1024)) bytes := new(big.Int).Mul(kilobytes, big.NewInt(1024))
benchmarkData.SpecRAM = humanize.Bytes(bytes.Uint64()) benchmarkData.SpecRAM = humanize.Bytes(bytes.Uint64())
} else { } else {
// Contains humanized (or invalid) value, so no conversion needed
benchmarkData.SpecRAM = truncateString(strings.TrimSpace(v)) benchmarkData.SpecRAM = truncateString(strings.TrimSpace(v))
} }
case 4: case 4: