Skip to content

Commit

Permalink
test: fix cpuinfo retrieval
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr committed Feb 18, 2021
1 parent 18db8c0 commit 0e9af73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def pytest_benchmark_update_json(config, benchmarks, output_json):

def pytest_benchmark_update_machine_info(config, machine_info):
cpu_info = cpuinfo.get_cpu_info()
machine_info['cpu']['vendor_id_raw'] = cpu_info['vendor_id_raw']
machine_info['cpu']['hardware_raw'] = cpu_info['hardware_raw']
machine_info['cpu']['brand_raw'] = cpu_info['brand_raw']
machine_info['cpu']['hz_actual_friendly'] = cpu_info['hz_actual_friendly']
brand = cpu_info.get('brand_raw', None)
if brand is None:
brand = '{} core(s) {} CPU '.format(cpu_info.get('count', 'unknown'), cpu_info.get('arch', 'unknown'))
machine_info['cpu']['brand'] = brand
machine_info['cpu']['hz_actual_friendly'] = cpu_info.get('hz_actual_friendly', 'unknown')
2 changes: 1 addition & 1 deletion utils/bench_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def generate_metainfo(root: dict) -> str:
machine_info = root['machine_info']
commit_info = root['commit_info']
result = 'Machine: {} {} on {}({})\n'.format(machine_info['system'], machine_info['release'],
machine_info['cpu']['brand_raw'],
machine_info['cpu']['brand'],
machine_info['cpu']['hz_actual_friendly'])
result += 'Python: {} {} [{} {}]\n'.format(machine_info["python_implementation"],
machine_info["python_version"],
Expand Down

0 comments on commit 0e9af73

Please sign in to comment.