misc fixes

This commit is contained in:
Erikas 2024-07-12 16:53:20 +03:00
parent 4a4dec11c7
commit 6e2fb20327
3 changed files with 7 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import (
"encoding/gob" "encoding/gob"
"errors" "errors"
"fmt" "fmt"
"math"
"math/big" "math/big"
"mime/multipart" "mime/multipart"
"os" "os"
@ -197,6 +198,7 @@ func readMangoHudFile(scanner *bufio.Scanner) (*BenchmarkData, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to parse GPU mem clock value '%s': %v", record[7], err) return nil, fmt.Errorf("failed to parse GPU mem clock value '%s': %v", record[7], err)
} }
val = math.Round(val*2*100000) / 100000 // multiply by 2 (so it represents actual core clocks) and round to 5 decimal places
benchmarkData.DataGPUMemClock = append(benchmarkData.DataGPUMemClock, val) benchmarkData.DataGPUMemClock = append(benchmarkData.DataGPUMemClock, val)
val, err = strconv.ParseFloat(record[8], 64) val, err = strconv.ParseFloat(record[8], 64)
@ -263,7 +265,7 @@ func readAfterburnerFile(scanner *bufio.Scanner) (*BenchmarkData, error) {
return nil, errors.New("failed to read file (err ab2)") return nil, errors.New("failed to read file (err ab2)")
} }
benchmarkData.SpecOS = "Windows" // Hardcode benchmarkData.SpecOS = "Windows" // Hardcode
benchmarkData.SpecCPU = truncateString(strings.TrimSpace(record[2])) benchmarkData.SpecGPU = truncateString(strings.TrimSpace(record[2]))
// 3rd line contain headers for benchmark data. We need to pay attention to their order // 3rd line contain headers for benchmark data. We need to pay attention to their order
if !scanner.Scan() { if !scanner.Scan() {
@ -380,6 +382,7 @@ func readAfterburnerFile(scanner *bufio.Scanner) (*BenchmarkData, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to parse Memory usage value '%s': %v", record[8], err) return nil, fmt.Errorf("failed to parse Memory usage value '%s': %v", record[8], err)
} }
val = math.Round(val/1024*100000) / 100000 // divide by 1024 and round to 5 decimal places
benchmarkData.DataGPUVRAMUsed = append(benchmarkData.DataGPUVRAMUsed, val) benchmarkData.DataGPUVRAMUsed = append(benchmarkData.DataGPUVRAMUsed, val)
} }
@ -396,6 +399,7 @@ func readAfterburnerFile(scanner *bufio.Scanner) (*BenchmarkData, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to parse RAM usage value '%s': %v", record[10], err) return nil, fmt.Errorf("failed to parse RAM usage value '%s': %v", record[10], err)
} }
val = math.Round(val/1024*100000) / 100000 // divide by 1024 and round to 5 decimal places
benchmarkData.DataRAMUsed = append(benchmarkData.DataRAMUsed, val) benchmarkData.DataRAMUsed = append(benchmarkData.DataRAMUsed, val)
} }

View File

@ -242,7 +242,7 @@ createChart('cpuTempChart', 'CPU Temperature', '', '°C', cpuTempDataArrays);
createChart('gpuTempChart', 'GPU Temperature', '', '°C', gpuTempDataArrays); createChart('gpuTempChart', 'GPU Temperature', '', '°C', gpuTempDataArrays);
createChart('gpuCoreClockChart', 'GPU Core Clock', '', 'MHz', gpuCoreClockDataArrays); createChart('gpuCoreClockChart', 'GPU Core Clock', '', 'MHz', gpuCoreClockDataArrays);
createChart('gpuMemClockChart', 'GPU Memory Clock', '', 'MHz', gpuMemClockDataArrays); createChart('gpuMemClockChart', 'GPU Memory Clock', '', 'MHz', gpuMemClockDataArrays);
createChart('gpuVRAMUsedChart', 'GPU VRAM Usage', '', '%', gpuVRAMUsedDataArrays, 100); createChart('gpuVRAMUsedChart', 'GPU VRAM Usage', '', 'GB', gpuVRAMUsedDataArrays);
createChart('gpuPowerChart', 'GPU Power', '', 'W', gpuPowerDataArrays); createChart('gpuPowerChart', 'GPU Power', '', 'W', gpuPowerDataArrays);
createChart('ramUsedChart', 'RAM Usage', '', 'GB', ramUsedDataArrays); createChart('ramUsedChart', 'RAM Usage', '', 'GB', ramUsedDataArrays);
createChart('swapUsedChart', 'SWAP Usage', '', 'GB', swapUsedDataArrays); createChart('swapUsedChart', 'SWAP Usage', '', 'GB', swapUsedDataArrays);

View File

@ -46,8 +46,8 @@
<tr> <tr>
<th scope="col">Label</th> <th scope="col">Label</th>
<th scope="col">OS</th> <th scope="col">OS</th>
<th scope="col">CPU</th>
<th scope="col">GPU</th> <th scope="col">GPU</th>
<th scope="col">CPU</th>
<th scope="col">RAM</th> <th scope="col">RAM</th>
<th scope="col">OS specific</th> <th scope="col">OS specific</th>
</tr> </tr>