fix(benchmarks): replace properties field of the machine information to specs

This commit is contained in:
Umut
2021-10-08 17:27:32 +03:00
parent 92ca061da9
commit a7f00ec111

View File

@@ -13,22 +13,22 @@ def main():
"""Extract some info about the host machine."""
dotenv.load_dotenv()
properties = []
specs = []
cpu_value = cpuinfo.get_cpu_info()["brand_raw"].replace("(R)", "®").replace("(TM)", "")
properties.append(["CPU", cpu_value])
specs.append(["CPU", cpu_value])
vcpu_value = os.getenv("VCPU")
if vcpu_value is not None:
properties.append(["vCPU", vcpu_value])
specs.append(["vCPU", vcpu_value])
ram_value = f"{psutil.virtual_memory().total / (1024 ** 3):.2f} GB"
properties.append(["RAM", ram_value])
specs.append(["RAM", ram_value])
os_value = os.getenv("OS_NAME")
if os_value is None:
os_value = f"{platform.system()} {platform.release()}"
properties.append(["OS", os_value])
specs.append(["OS", os_value])
name = os.getenv("MACHINE_NAME")
if name is None:
@@ -47,7 +47,7 @@ def main():
os.makedirs(".benchmarks", exist_ok=True)
machine = {"id": id_, "name": name, "properties": properties}
machine = {"id": id_, "name": name, "specs": specs}
with open(".benchmarks/machine.json", "w", encoding="utf-8") as f:
json.dump(machine, f, indent=2, ensure_ascii=False)