diff options
author | drebs <drebs@leap.se> | 2017-04-25 17:57:25 +0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2017-04-27 10:02:20 +0200 |
commit | c08083e9dfd38f93eb67d234e85b47efa211045c (patch) | |
tree | 7c2a9f1316c6622bb2882c796f0adb0caee59938 /testing/tests/conftest.py | |
parent | 48dd87ab8ad077e5913c0cddd5bfb9badd9dcc35 (diff) |
[test] measure cpu percentage during benchmark
Diffstat (limited to 'testing/tests/conftest.py')
-rw-r--r-- | testing/tests/conftest.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/testing/tests/conftest.py b/testing/tests/conftest.py index 2459307a..bece7609 100644 --- a/testing/tests/conftest.py +++ b/testing/tests/conftest.py @@ -235,3 +235,12 @@ if 'pytest_benchmark' in sys.modules: """ hostname = os.environ.get('HOST_HOSTNAME', socket.gethostname()) machine_info['host'] = hostname + + def pytest_benchmark_update_json(config, benchmarks, output_json): + json_benchmarks = output_json['benchmarks'] + for benchmark in benchmarks: + # find the json output that corresponds to this benchmark + name = benchmark['name'] + output = filter(lambda d: d['name'] == name, json_benchmarks).pop() + # update output stats with previously saved values + output['stats']['cpu_percent'] = benchmark.stats.cpu_percent |