Commit 9c104866 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Use a dict to store per number of users use cases for readability sake.

parent 75b04e70
...@@ -112,7 +112,9 @@ def computeStatisticFromFilenameList(argument_namespace, filename_list): ...@@ -112,7 +112,9 @@ def computeStatisticFromFilenameList(argument_namespace, filename_list):
# #
# TODO: Assuming that there was at least one test result # TODO: Assuming that there was at least one test result
# before # before
use_case_suite_dict[suite_name] = [[], []] use_case_suite_dict[suite_name] = {'duration_stats': [],
'count_stats': []}
row_use_case_mapping_dict[index] = suite_name row_use_case_mapping_dict[index] = suite_name
else: else:
if argument_namespace.do_merge_label: if argument_namespace.do_merge_label:
...@@ -137,21 +139,31 @@ def computeStatisticFromFilenameList(argument_namespace, filename_list): ...@@ -137,21 +139,31 @@ def computeStatisticFromFilenameList(argument_namespace, filename_list):
use_case_suite = row_use_case_mapping_dict.get(idx, None) use_case_suite = row_use_case_mapping_dict.get(idx, None)
if use_case_suite: if use_case_suite:
current_count = int(row)
current_duration = int(row_iter.next()[1]) / 60.0
# For stats by iteration, used later on to generate cases per
# minutes plot for a given number of users
by_iteration_dict = use_case_suite_dict[use_case_suite]
count_stat_list = by_iteration_dict['count_stats']
duration_stat_list = by_iteration_dict['duration_stats']
try: try:
stat_use_case = use_case_suite_dict[use_case_suite][0][row_index] stat_count = count_stat_list[row_index]
stat_time_elapsed = use_case_suite_dict[use_case_suite][1][row_index] stat_duration = duration_stat_list[row_index]
except IndexError: except IndexError:
stat_use_case = BenchmarkResultStatistic(use_case_suite, stat_count = BenchmarkResultStatistic(use_case_suite,
'Use cases count') 'Use cases count')
stat_time_elapsed = BenchmarkResultStatistic(use_case_suite, count_stat_list.append(stat_count)
'Time elapsed')
use_case_suite_dict[use_case_suite][0].append(stat_use_case) stat_duration = BenchmarkResultStatistic(use_case_suite,
use_case_suite_dict[use_case_suite][1].append(stat_time_elapsed) 'Time elapsed')
stat_use_case.add(int(row)) duration_stat_list.append(stat_duration)
stat_time_elapsed.add(int(row_iter.next()[1]) / 60.0)
stat_count.add(current_count)
stat_duration.add(current_duration)
else: else:
index = merged_label_dict.get(label_list[idx], idx) index = merged_label_dict.get(label_list[idx], idx)
stat_list[index].add(float(row)) stat_list[index].add(float(row))
...@@ -417,13 +429,13 @@ def generateReport(): ...@@ -417,13 +429,13 @@ def generateReport():
stat_list[slice_start_idx:slice_start_idx + stat_list[slice_start_idx:slice_start_idx +
DIAGRAM_PER_PAGE]) DIAGRAM_PER_PAGE])
for suite_name, (use_case_count_list, time_elapsed_list) in \ for suite_name, use_case_dict in use_case_dict.viewitems():
use_case_dict.viewitems(): drawUseCasePerNumberOfUserPlot(
title = "Scalability for %s with %d users" % (suite_name, nb_users) pdf,
drawUseCasePerNumberOfUserPlot(pdf, title, "Scalability for %s with %d users" % (suite_name, nb_users),
use_case_count_list, use_case_dict['count_stats'],
time_elapsed_list, use_case_dict['duration_stats'],
is_single_plot=(nb_users == 1)) is_single_plot=(nb_users == 1))
report_dict['stats'] = stat_list report_dict['stats'] = stat_list
report_dict['use_cases'] = use_case_dict report_dict['use_cases'] = use_case_dict
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment