Quellcode durchsuchen

Fix efficiency numbers by scaling RAM and storage after efficincy is computed

Niko Kovacevic vor 6 Jahren
Ursprung
Commit
05ca566300
1 geänderte Dateien mit 7 neuen und 4 gelöschten Zeilen
  1. 7 4
      costmodel/aggregations.go

+ 7 - 4
costmodel/aggregations.go

@@ -282,10 +282,8 @@ func AggregateCostData(costData map[string]*CostData, field string, subfields []
 
 		agg.CPUAllocationAverage = averageVectors(agg.CPUAllocationVectors)
 		agg.GPUAllocationAverage = averageVectors(agg.GPUAllocationVectors)
-		// convert RAM from bytes to GiB
-		agg.RAMAllocationAverage = averageVectors(agg.RAMAllocationVectors) / 1024 / 1024 / 1024
-		// convert storage from bytes to GiB
-		agg.PVAllocationAverage = averageVectors(agg.PVAllocationVectors) / 1024 / 1024 / 1024
+		agg.RAMAllocationAverage = averageVectors(agg.RAMAllocationVectors)
+		agg.PVAllocationAverage = averageVectors(agg.PVAllocationVectors)
 
 		if includeEfficiency {
 			// Default both RAM and CPU to 100% efficiency so that a 0-requested, 0-allocated, 0-used situation
@@ -324,6 +322,11 @@ func AggregateCostData(costData map[string]*CostData, field string, subfields []
 			}
 		}
 
+		// convert RAM from bytes to GiB
+		agg.RAMAllocationAverage = agg.RAMAllocationAverage / 1024 / 1024 / 1024
+		// convert storage from bytes to GiB
+		agg.PVAllocationAverage = agg.PVAllocationAverage / 1024 / 1024 / 1024
+
 		// remove time series data if it is not explicitly requested
 		if !includeTimeSeries {
 			agg.CPUCostVector = nil