2 from subprocess
import call
3 from collections
import defaultdict
11 # usecPecIter = Duration/(average number of iteration per thread)
12 df
['usecperiter'] = (df
['nbthreads'] * df
['duration']) / df
['nbiter']
14 periter_mean
= pd
.DataFrame({'periter_mean' :
15 df
.groupby(['nbthreads', 'tracer', 'testcase','sleeptime'])['usecperiter'].mean()}).reset_index()
17 periter_stdev
= pd
.DataFrame({'periter_stdev' :
18 df
.groupby(['nbthreads', 'tracer', 'testcase','sleeptime'])['usecperiter'].std()}).reset_index()
20 nbiter_mean
= pd
.DataFrame({'nbiter_mean' :
21 df
.groupby(['nbthreads', 'tracer', 'testcase','sleeptime'])['nbiter'].mean()}).reset_index()
23 nbiter_stdev
= pd
.DataFrame({'nbiter_stdev' :
24 df
.groupby(['nbthreads', 'tracer', 'testcase','sleeptime'])['nbiter'].std()}).reset_index()
26 duration_mean
= pd
.DataFrame({'duration_mean' :
27 df
.groupby(['nbthreads', 'tracer', 'testcase','sleeptime'])['duration'].mean()}).reset_index()
29 duration_stdev
= pd
.DataFrame({'duration_stdev' :
30 df
.groupby(['nbthreads', 'tracer', 'testcase','sleeptime'])['duration'].std()}).reset_index()
32 tmp
= periter_mean
.merge(periter_stdev
)
34 tmp
= tmp
.merge(nbiter_mean
)
35 tmp
= tmp
.merge(nbiter_stdev
)
37 tmp
= tmp
.merge(duration_mean
)
38 tmp
= tmp
.merge(duration_stdev
)
40 # if there is any NaN or None value in the DF we raise an exeception
41 if tmp
.isnull().values
.any():
42 raise Exception('NaN value found in dataframe')
44 for i
, row
in tmp
.iterrows():
45 testcase_name
='_'.join([row
['tracer'],str(row
['nbthreads'])+'thr', 'peritermean'])
46 yield( {"name": testcase_name
, "result": "pass", "units": "usec/iter",
47 "measurement": str(row
['periter_mean'])})
49 testcase_name
='_'.join([row
['tracer'],str(row
['nbthreads'])+'thr', 'periterstdev'])
50 yield( {"name": testcase_name
, "result": "pass", "units": "usec/iter",
51 "measurement": str(row
['periter_stdev'])})
53 testcase_name
='_'.join([row
['tracer'],str(row
['nbthreads'])+'thr', 'nbitermean'])
54 yield( {"name": testcase_name
, "result": "pass", "units": "iterations",
55 "measurement": str(row
['nbiter_mean'])})
57 testcase_name
='_'.join([row
['tracer'],str(row
['nbthreads'])+'thr', 'nbiterstdev'])
58 yield( {"name": testcase_name
, "result": "pass", "units": "iterations",
59 "measurement": str(row
['nbiter_stdev'])})
61 testcase_name
='_'.join([row
['tracer'],str(row
['nbthreads'])+'thr', 'durationmean'])
62 yield( {"name": testcase_name
, "result": "pass", "units": "usec",
63 "measurement": str(row
['duration_mean'])})
65 testcase_name
='_'.join([row
['tracer'],str(row
['nbthreads'])+'thr', 'durationstdev'])
66 yield( {"name": testcase_name
, "result": "pass", "units": "usec",
67 "measurement": str(row
['duration_stdev'])})
70 results_file
=sys
.argv
[1]
71 df
= pd
.read_csv(results_file
)
78 '--result', res
['result'],
79 '--measurement', res
['measurement'],
80 '--units', res
['units']])
82 # Save the results to write to the CSV file
83 results
[res
['name']]=res
['measurement']
85 # Write the dictionnary to a csv file where each key is a column
86 with
open('processed_results.csv', 'w') as output_csv
:
87 dict_csv_write
=csv
.DictWriter(output_csv
, results
.keys())
88 dict_csv_write
.writeheader()
89 dict_csv_write
.writerow(results
)
91 if __name__
== '__main__':
This page took 0.031494 seconds and 4 git commands to generate.