@@ -110,17 +110,22 @@ def generate_legend(conn: sqlalchemy.Engine, run_id: int) -> list[str]:
110110 return legends ["postfix" ].values .tolist ()
111111
112112
113- def generate_summary (data : pd .DataFrame ):
113+ def generate_summary (data : pd .DataFrame , report_csv : bool ):
114114 """prints summary section"""
115115 print ("Summary of current implementation" )
116116 print ("=================================" )
117- print (data .to_string ())
117+
118+ if report_csv :
119+ print (data .to_csv (index = False ))
120+ else :
121+ print (data .to_string ())
118122
119123
120124def generate_impl_summary_report (
121125 conn : sqlalchemy .Engine ,
122126 run_id : int ,
123127 implementations : list [str ],
128+ report_csv : bool ,
124129):
125130 """generate implementation summary report with status of each benchmark"""
126131 columns = [
@@ -160,13 +165,14 @@ def generate_impl_summary_report(
160165 con = conn .connect (),
161166 )
162167
163- generate_summary (df )
168+ generate_summary (df , report_csv )
164169
165170
166171def generate_performance_report (
167172 conn : sqlalchemy .Engine ,
168173 run_id : int ,
169174 implementations : list [str ],
175+ report_csv : bool ,
170176):
171177 """generate performance report with median times for each benchmark"""
172178 columns = [
@@ -223,14 +229,15 @@ def generate_performance_report(
223229
224230 df .at [index , impl ] = time
225231
226- generate_summary (df )
232+ generate_summary (df , report_csv )
227233
228234
229235def generate_comparison_report (
230236 conn : sqlalchemy .Engine ,
231237 run_id : int ,
232238 implementations : list [str ],
233239 comparison_pairs : list [tuple [str , str ]],
240+ report_csv : bool ,
234241):
235242 """generate comparison report with median times for each benchmark"""
236243 if len (comparison_pairs ) == 0 :
@@ -284,7 +291,7 @@ def generate_comparison_report(
284291 for impl in implementations :
285292 df = df .drop (impl , axis = 1 )
286293
287- generate_summary (df )
294+ generate_summary (df , report_csv )
288295
289296
290297def get_failures_from_results (
@@ -333,26 +340,32 @@ def get_unexpected_failures(
333340def print_report (
334341 conn : sqlalchemy .Engine ,
335342 run_id : int ,
343+ csv : bool ,
336344 comparison_pairs : list [tuple [str , str ]] = [],
337345):
338346 generate_header (conn , run_id )
339347 implementations = generate_legend (conn , run_id )
340348
341349 generate_impl_summary_report (
342- conn , run_id = run_id , implementations = implementations
350+ conn ,
351+ run_id = run_id ,
352+ implementations = implementations ,
353+ report_csv = csv ,
343354 )
344355
345356 generate_performance_report (
346357 conn ,
347358 run_id = run_id ,
348359 implementations = implementations ,
360+ report_csv = csv ,
349361 )
350362
351363 generate_comparison_report (
352364 conn ,
353365 run_id = run_id ,
354366 implementations = implementations ,
355367 comparison_pairs = comparison_pairs ,
368+ report_csv = csv ,
356369 )
357370
358371 unexpected_failures = get_unexpected_failures (conn , run_id = run_id )
0 commit comments