2323
2424from __future__ import print_function
2525
26- import sys
2726
2827from src .opentsdb import bdwatchdog
2928from src .common .config import Config , OpenTSDBConfig , eprint
3029from src .latex .latex_output import latex_print , print_latex_stress
3130
32- from src .barplotting .barplots import plot_tests_resource_usage , plot_tests_times
33- from src .lineplotting .lineplots import plot_document
31+ from src .lineplotting .lineplots import plot_test
3432
3533from src .common .utils import generate_duration , translate_metric , format_metric , flush_table , \
36- print_basic_doc_info , generate_resources_timeseries , get_plots
34+ print_basic_doc_info , generate_resources_timeseries , get_plots_metrics
3735
3836
3937class TestReporter :
@@ -55,19 +53,22 @@ def generate_test_resource_plot(self, tests):
5553 return
5654
5755 start , end = test ["start_time" ], test ["end_time" ]
58- plots = get_plots ()
56+ plots = get_plots_metrics ()
5957
6058 if self .cfg .GENERATE_NODES_PLOTS :
6159 for node in self .cfg .NODES_LIST :
6260 test_plots = plots ["node" ][report_type ]
63- structure = (node , "node" )
64- plot_document (test , structure , test_plots , start , end , self .cfg .REPORTED_RESOURCES )
61+ plot_test (test , node , "node" , test_plots , start , end , self .cfg .REPORTED_RESOURCES )
6562
6663 if self .cfg .GENERATE_APP_PLOTS :
6764 for app in self .cfg .APPS_LIST + ["ALL" ]:
6865 app_plots = plots ["app" ][report_type ]
69- structure = (app , "app" )
70- plot_document (test , structure , app_plots , start , end , self .cfg .REPORTED_RESOURCES )
66+ plot_test (test , app , "app" , app_plots , start , end , self .cfg .REPORTED_RESOURCES )
67+
68+ if self .cfg .GENERATE_USER_PLOTS :
69+ for user in self .cfg .USERS_LIST + ["ALL" ]:
70+ user_plots = plots ["user" ][report_type ]
71+ plot_test (test , user , "user" , user_plots , start , end , self .cfg .REPORTED_RESOURCES )
7172
7273 # PRINT TEST RESOURCE USAGES
7374 def print_test_resources (self , test , structures_list ):
@@ -111,59 +112,6 @@ def flush_rows_with_aggregations(self, rows, headers, table_caption=None):
111112 final_rows += list (rows [row ].values ())
112113 flush_table (final_rows , headers , table_caption )
113114
114- # PRINT TEST RESOURCE OVERHEAD
115- def print_tests_resource_overhead_report (self , tests , num_base_experiments = 3 , print_with_stepping = True ):
116- table_caption = "TESTs resource overhead"
117- max_columns = self .cfg .MAX_COLUMNS ["print_tests_resource_overhead_report" ]
118- resource_tuples = self .cfg .METRICS_FOR_OVERHEAD_REPORT
119-
120- overheads , base_values , headers , num_columns , remaining_data = dict (), dict (), ["resource" ], 0 , False
121-
122- for test in tests [:num_base_experiments ]:
123- headers .append (test ["test_name" ])
124- for resource_tuple in resource_tuples :
125- resource , usage_metric = resource_tuple
126- if resource not in overheads :
127- overheads [resource ] = [resource ]
128- base_values [resource ] = 0
129-
130- if test ["resource_aggregates" ] != "n/a" :
131- overheads [resource ].append ("---" )
132- base_values [resource ] += test ["resource_aggregates" ]["ALL" ][usage_metric ]["SUM" ]
133- else :
134- overheads [resource ].append ("n/a" )
135- for resource in base_values :
136- base_values [resource ] = base_values [resource ] / num_base_experiments
137-
138- num_columns += num_base_experiments
139-
140- for test in tests [num_base_experiments :]:
141- headers .append (test ["test_name" ])
142- for resource_tuple in resource_tuples :
143- resource , usage_metric = resource_tuple
144-
145- if resource not in overheads :
146- overheads [resource ] = [resource ]
147-
148- if test ["resource_aggregates" ] != "n/a" :
149- overhead = test ["resource_aggregates" ]["ALL" ][usage_metric ]["SUM" ] / base_values [resource ]
150- resource_overhead = str (int ((overhead - 1 ) * 100 )) + "%"
151- else :
152- resource_overhead = "n/a"
153-
154- overheads [resource ].append (resource_overhead )
155-
156- num_columns += 1
157- remaining_data = True
158- if num_columns >= max_columns :
159- flush_table (overheads .values (), headers , table_caption )
160- table_caption = None
161- overheads , headers , num_columns , remaining_data = dict (), ["resource" ], 0 , False
162- if remaining_data :
163- flush_table (overheads .values (), headers , table_caption )
164-
165- plot_tests_resource_usage (tests )
166-
167115 # PRINT TEST RESOURCE UTILIZATION
168116 def print_tests_resource_utilization (self , tests ):
169117 max_columns = self .cfg .MAX_COLUMNS ["print_tests_resource_utilization_report" ]
@@ -296,7 +244,8 @@ def print_tests_resource_usage(self, tests):
296244 if remaining_data :
297245 self .flush_rows_with_aggregations (rows , headers , table_caption )
298246
299- def print_test_report (self , tests , print_node_info ):
247+ def print_test_report (self , tests ):
248+ print_node_info = self .cfg .PRINT_NODE_INFO
300249 # PRINT BASIC INFO ABOUT THE TEST
301250 for test in tests :
302251 print_basic_doc_info (test )
@@ -340,58 +289,3 @@ def print_tests_times(self, tests):
340289
341290 if remaining_data :
342291 flush_table ([durations_seconds , durations_minutes ], headers , table_caption )
343-
344- def print_summarized_tests_info (self , tests , num_base_experiments , print_with_stepping = True ):
345- max_columns = self .cfg .MAX_COLUMNS ["print_summarized_tests_info" ]
346- table_caption = "TESTs durations and time benchmarking (over the first {0} experiments)" .format (
347- num_base_experiments )
348-
349- headers , overheads , durations_seconds , durations_minutes , num_columns , remaining_data = \
350- ["time" ], ["overhead" ], ["seconds" ], ["minutes" ], 0 , False
351- basetime = 0
352-
353- if num_base_experiments == 0 :
354- basetime = 1
355- else :
356- for test in tests [:num_base_experiments ]:
357- headers .append (test ["test_name" ])
358- basetime += test ["duration" ]
359- overheads .append ("---" )
360- durations_seconds .append (test ["duration" ])
361- durations_minutes .append ("{:.2f}" .format ((test ["duration" ]) / 60 ))
362-
363- num_columns += 1
364- remaining_data = True
365- if num_columns >= max_columns :
366- flush_table ([durations_seconds , durations_minutes , overheads ], headers , table_caption )
367- table_caption = None
368- headers , overheads , durations_seconds , durations_minutes , num_columns , remaining_data = \
369- ["time" ], ["overhead" ], ["seconds" ], ["minutes" ], 0 , False
370-
371- basetime = basetime / num_base_experiments
372-
373- for test in tests [num_base_experiments :]:
374- headers .append (test ["test_name" ])
375- seconds , minutes , overhead = "n/a" , "n/a" , "n/a"
376- if test ["duration" ] != "n/a" :
377- seconds = test ["duration" ]
378- minutes = "{:.2f}" .format ((test ["duration" ]) / 60 )
379- overhead = test ["duration" ] / basetime
380- overhead = str (int ((overhead - 1 ) * 100 )) + "%"
381-
382- durations_seconds .append (seconds )
383- durations_minutes .append (minutes )
384- overheads .append (overhead )
385-
386- num_columns += 1
387- remaining_data = True
388- if num_columns >= max_columns :
389- flush_table ([durations_seconds , durations_minutes , overheads ], headers , table_caption )
390- table_caption = None
391- headers , overheads , durations_seconds , durations_minutes , num_columns , remaining_data = \
392- ["time" ], ["overhead" ], ["seconds" ], ["minutes" ], 0 , False
393-
394- if remaining_data :
395- flush_table ([durations_seconds , durations_minutes , overheads ], headers , table_caption )
396-
397- plot_tests_times (tests )
0 commit comments