Make memory allocated nullable and correctly calculated normalized TDP

per core
This commit is contained in:
Rendani Gangazhe
2023-06-02 10:08:17 -04:00
committed by Dannon Baker
parent 18d148b641
commit 7e02181d20
@@ -20,7 +20,7 @@ export interface CarbonEmissionsProps {
};
jobRuntime: number;
coresAllocated: number;
memoryAllocated: number;
memoryAllocated?: number;
}
const props = withDefaults(defineProps<CarbonEmissionsProps>(), {
@@ -38,7 +38,7 @@ const carbonEmissions = computed(() => {
const runtime = props.jobRuntime / (60 * 60); // Convert to hours
const memoryAllocated = props.memoryAllocated / 1024; // Convert to gibibyte
const tdpPerCore = cpu.tdp / cpu.coreCount;
const normalizedTdpPerCore = tdpPerCore * props.jobRuntime;
const normalizedTdpPerCore = tdpPerCore * props.coresAllocated;
// Power needed in Watt
const powerNeededCpu = powerUsageEffectiveness * normalizedTdpPerCore;