Debian Codegraph @

tests/conftest.py

raw symbols ◀ ▶
Source reconstructed at patch state 1 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 try:
2 import cpuinfo
3 except:
4 cpuinfo = None
5
6 def pytest_benchmark_update_json(config, benchmarks, output_json):
7 """Calculate compression/decompression speed and add as extra_info"""
8 for benchmark in output_json["benchmarks"]:
9 if "data_size" in benchmark["extra_info"]:
10 rate = benchmark["extra_info"].get("data_size", 0.0) / benchmark["stats"]["mean"]
11 benchmark["extra_info"]["rate"] = rate
12
13
14 def pytest_benchmark_update_machine_info(config, machine_info):
15 if cpuinfo is not None:
16 cpu_info = cpuinfo.get_cpu_info()
17 brand = cpu_info.get("brand_raw", None)
18 if brand is None:
19 brand = "{} core(s) {} CPU ".format(cpu_info.get("count", "unknown"), cpu_info.get("arch", "unknown"))
20 machine_info["cpu"]["brand"] = brand
21 machine_info["cpu"]["hz_actual_friendly"] = cpu_info.get("hz_actual_friendly", "unknown")
22 else:
23 machine_info["cpu"]["brand"] = "unknown"
24 machine_info["cpu"]["hz_actual_friendly"] = "unknown"