Lava: Save the processed benchmark results in a single file
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 9 Dec 2016 20:35:26 +0000 (15:35 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Sat, 10 Dec 2016 23:56:42 +0000 (18:56 -0500)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
scripts/lttng-baremetal-tests/parse-results.py

index ee058f31d4c360fee828b82996a1964ecc5f1b93..25fcd0d6c8bfeb49f318bc6d2b88e61975def907 100755 (executable)
@@ -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()
This page took 0.023534 seconds and 4 git commands to generate.