in analysis/GreenSKU-Framework/src/carbon_model.py [0:0]
def _set_sellable_cores(self) -> None:
"""Set the number of sellable cores in the server."""
self.vCores = self.capacities['cpu'] * self.data['cpu']['threads']
vCore_with_overhead = self.vCores
core_overhead = 0.0
# if overhead is specified as a percentage (if some cores dedicated to non-VM tasks)
if 'overhead' in self.config['cpu']:
core_overhead = self.config['cpu']['overhead']
# if percentage then take the percentage of the vCores
if isinstance(core_overhead, str):
core_overhead = float(core_overhead.strip('%')) / 100.0
vCore_with_overhead *= 1 - core_overhead
if self.print_out:
print(f"core overhead: {core_overhead}")
print(f"vCores: {vCore_with_overhead}")
print(f"vCores with overhead: {vCore_with_overhead}")
# otherwise treat as a number of cores as overhead
else:
vCore_with_overhead -= core_overhead
if 'oversubscription' not in self.config:
self.sellable_cores = self.vCores * (1 - core_overhead)
return
x = 0.0
y = 0.0
if self.config['oversubscription']['only_oversubscribable']:
x = 1.0
else:
x = self.config['oversubscription']['cpu_oversubscription']['oversubscribable']
y = self.config['oversubscription']['cpu_oversubscription']['rate']
sCores_per_vCore = (1 - x) + x / (1 - y)
self.sellable_cores = self.vCores * (1 - core_overhead) * sCores_per_vCore