def _write_stat_per_test(self, stat_file_name, time_result_dict): """Write stat of per-test results to csv file note: take the full dictionary of test and calculate overall stat """ full_list = [] # list containing 1st to 5kth data point current_num_threads = len(time_result_dict) test_category = self._get_output_filename(stat_file_name) for i in range(len(time_result_dict)): time_list = time_result_dict.get('thread-{}'.format(i)) full_list += time_list stat_dict = generate_stat_for_concurrent_thread( 'test-{}'.format(len(time_result_dict)), full_list, stat_file_name, len(full_list), 1 ) generate_bar_chart_stat( stat_dict, 'Concurrent Subscription Statistics - per test: ' '({0}-{1}-clients)' .format(test_category, current_num_threads), '{0}-per-test-{1}-clients.svg' .format(test_category, current_num_threads), 'test' )
def _write_stat_per_client(self, stat_file_name, time_result_dict, current_num_threads): """Write stat of per-client results to csv file note: take the full list of a client i; calculate stat on the list """ # parameters for generating bucketized line chart stat_dict = {} return_stat = {} current_num_threads = len(time_result_dict) test_category = self._get_output_filename(stat_file_name) for i in range(current_num_threads): time_list = time_result_dict.get('thread-{0}'.format(i)) thread_name = 'client-{0}'.format(i) # for each client i, compute and output its stat return_stat = generate_stat_for_concurrent_thread( thread_name, time_list, stat_file_name, len(time_list), 1) # for each chunk i, add stat into final return_dict stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))}) # create graph based on stats of all clients generate_bar_chart_stat( stat_dict, 'Concurrent Subscription Statistics - per client: ' '({0}-{1}-clients)'.format(test_category, current_num_threads), '{0}-per-client-{1}-clients.svg'.format(test_category, current_num_threads), 'client')
def write_stat_per_client(time_result_dict, current_num_threads, is_attach=True): stat_dict = {} return_stat = {} num_clients = len(time_result_dict) for i in range(current_num_threads): if is_attach: time_list = time_result_dict.get('thread-{}'.format(i))[2] else: time_list = time_result_dict.get('thread-{}'.format(i)) thread_name = 'client-{}'.format(i) # for each client i, compute and output its stat return_stat = generate_stat_for_concurrent_thread( thread_name, time_list, 'csv-test-per-client.csv', len(time_list), 1) # for each chunk i, add stat into final return_dict stat_dict.update({ i: return_stat.get(0, (0, 0, 0, 0)) }) # create graph based on stats of all clients generate_bar_chart_stat( stat_dict, 'Concurrent Subscription Stat - per client ' '({} clients)'.format(num_clients), 'stat-per-client-{}-clients.svg'.format(num_clients), 'client' )
def _write_stat_per_test(self, stat_file_name, time_result_dict): """Write stat of per-test results to csv file note: take the full dictionary of test and calculate overall stat """ full_list = [] # list containing 1st to 5kth data point current_num_threads = len(time_result_dict) test_category = self._get_output_filename(stat_file_name) for i in range(len(time_result_dict)): time_list = time_result_dict.get('thread-{}'.format(i)) full_list += time_list stat_dict = generate_stat_for_concurrent_thread( 'test-{}'.format(len(time_result_dict)), full_list, stat_file_name, len(full_list), 1) generate_bar_chart_stat( stat_dict, 'Concurrent Subscription Stat - per test ' '({0}-{1}-clients)' .format(test_category, current_num_threads), '{0}-per-test-{1}-clients.svg' .format(test_category, current_num_threads), 'test' )
def write_stat_per_test(time_result_dict, is_attach=True): full_list = [] # list containing 1st to 5kth data point num_clients = len(time_result_dict) for i in range(len(time_result_dict)): if is_attach: time_list = time_result_dict.get('thread-{}'.format(i))[2] else: time_list = time_result_dict.get('thread-{}'.format(i)) full_list += time_list stat_dict = generate_stat_for_concurrent_thread( 'test-{}'.format(len(time_result_dict)), full_list, 'csv-test-per-client.csv', len(full_list), 1) generate_bar_chart_stat( stat_dict, 'Concurrent Subscription Stat - per test ' '({} clients)'.format(num_clients), 'stat-per-test-{}-clients.svg'.format(num_clients), 'test')
def _write_stat_per_client( self, stat_file_name, time_result_dict, current_num_threads): """Write stat of per-client results to csv file note: take the full list of a client i; calculate stat on the list """ # parameters for generating bucketized line chart stat_dict = {} return_stat = {} current_num_threads = len(time_result_dict) test_category = self._get_output_filename(stat_file_name) for i in range(current_num_threads): time_list = time_result_dict.get('thread-{}'.format(i)) thread_name = 'client-{}'.format(i) # for each client i, compute and output its stat return_stat = generate_stat_for_concurrent_thread( thread_name, time_list, stat_file_name, len(time_list), 1 ) # for each chunk i, add stat into final return_dict stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))}) # create graph based on stats of all clients generate_bar_chart_stat( stat_dict, 'Concurrent Subscription Statistics - per client: ' '({0}-{1}-clients)' .format(test_category, current_num_threads), '{0}-per-client-{1}-clients.svg' .format(test_category, current_num_threads), 'client' )
def write_stat_per_client(time_result_dict, current_num_threads, is_attach=True): stat_dict = {} return_stat = {} num_clients = len(time_result_dict) for i in range(current_num_threads): if is_attach: time_list = time_result_dict.get('thread-{}'.format(i))[2] else: time_list = time_result_dict.get('thread-{}'.format(i)) thread_name = 'client-{}'.format(i) # for each client i, compute and output its stat return_stat = generate_stat_for_concurrent_thread( thread_name, time_list, 'csv-test-per-client.csv', len(time_list), 1) # for each chunk i, add stat into final return_dict stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))}) # create graph based on stats of all clients generate_bar_chart_stat( stat_dict, 'Concurrent Subscription Stat - per client ' '({} clients)'.format(num_clients), 'stat-per-client-{}-clients.svg'.format(num_clients), 'client')
0: (11.289999999999999, 13.803439999999998, 27.369999999999997, 1.9751443912787743) }) dict.update({1: (11.49, 13.2872, 19.109999999999999, 1.3601191712493432)}) dict.update({2: (11.17, 13.058319999999998, 17.5, 1.1831975226478457)}) dict.update({ 3: (10.969999999999999, 13.069439999999998, 18.049999999999997, 1.3083169670993342) }) dict.update( {4: (11.09, 13.000640000000001, 17.130000000000003, 1.1555270617341682)}) dict.update( {5: (10.66, 13.040319999999998, 16.600000000000001, 1.0826056981191261)}) dict.update( {6: (11.02, 13.107199999999999, 18.359999999999999, 1.3397036090120829)}) dict.update({7: (10.449999999999999, 13.0396, 17.75, 1.2550737986269969)}) dict.update({8: (11.280000000000001, 12.8904, 18.02, 1.0994197742445786)}) dict.update( {9: (11.07, 13.401359999999999, 17.399999999999999, 1.5245218759991608)}) bar_chart = pygal.Bar() bar_chart.title = 'Stat of Concurrent Tests - per client bucketized' bar_chart.x_labels = map(str, range(0, 10)) for key in range(len(dict)): bar_chart.add('bucket-{}'.format(key), dict.get(key)) bar_chart.render_to_file('example-bar-chart.svg') head = 'Stat of Concurrent Tests - per client bucketized' filename = 'example-bar-chart2.svg' generate_bar_chart_stat(dict, head, filename)
import pygal from robottelo.performance.graph import generate_bar_chart_stat dict={} dict.update({0:(11.289999999999999,13.803439999999998,27.369999999999997,1.9751443912787743)}) dict.update({1:(11.49,13.2872,19.109999999999999,1.3601191712493432)}) dict.update({2:(11.17,13.058319999999998,17.5,1.1831975226478457)}) dict.update({3:(10.969999999999999,13.069439999999998,18.049999999999997,1.3083169670993342)}) dict.update({4:(11.09,13.000640000000001,17.130000000000003,1.1555270617341682)}) dict.update({5:(10.66,13.040319999999998,16.600000000000001,1.0826056981191261)}) dict.update({6:(11.02,13.107199999999999,18.359999999999999,1.3397036090120829)}) dict.update({7:(10.449999999999999,13.0396,17.75,1.2550737986269969)}) dict.update({8:(11.280000000000001,12.8904,18.02,1.0994197742445786)}) dict.update({9:(11.07,13.401359999999999,17.399999999999999,1.5245218759991608)}) bar_chart = pygal.Bar() bar_chart.title = 'Stat of Concurrent Tests - per client bucketized' bar_chart.x_labels = map(str, range(0, 10)) for key in range(len(dict)): bar_chart.add('bucket-{}'.format(key), dict.get(key)) bar_chart.render_to_file('example-bar-chart.svg') head = 'Stat of Concurrent Tests - per client bucketized' filename = 'example-bar-chart2.svg' generate_bar_chart_stat(dict, head, filename)