From 9294e9a425243f181e82ab11502f52c77ef3ef6b Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Fri, 9 Dec 2016 15:35:26 -0500 Subject: [PATCH] Lava: Save the processed benchmark results in a single file Signed-off-by: Francis Deslauriers --- scripts/lttng-baremetal-tests/parse-results.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/lttng-baremetal-tests/parse-results.py b/scripts/lttng-baremetal-tests/parse-results.py index ee058f3..25fcd0d 100755 --- a/scripts/lttng-baremetal-tests/parse-results.py +++ b/scripts/lttng-baremetal-tests/parse-results.py @@ -1,8 +1,10 @@ #! /usr/bin/python3 from subprocess import call -import sys +from collections import defaultdict +import csv import numpy as np import pandas as pd +import sys def test_case(df): df['nsecperiter']=(df['duration']*1000)/(df['nbiter']) @@ -18,7 +20,6 @@ def test_case(df): tmp = tmp.merge(mem_mean) tmp = tmp.merge(mem_stdev) - for i, row in tmp.iterrows(): testcase_name='_'.join([row['tracer'],str(row['nbthreads'])+'thr', 'pereventmean']) yield( {"name": testcase_name, "result": "pass", "units": "nsec/event", @@ -40,6 +41,7 @@ def test_case(df): def main(): results_file=sys.argv[1] df = pd.read_csv(results_file) + results=defaultdict() data = test_case(df) for res in data: call( @@ -49,5 +51,15 @@ def main(): '--measurement', res['measurement'], '--units', res['units']]) + # Save the results to write to the CSV file + if 'pereventmean' in res['name']: + results[res['name']]=res['measurement'] + + # Write the dictionnary to a csv file where each key is a column + with open('processed_results.csv', 'w') as output_csv: + dict_csv_write=csv.DictWriter(output_csv, results.keys()) + dict_csv_write.writeheader() + dict_csv_write.writerow(results) + if __name__ == '__main__': main() -- 2.34.1