Commit cfc17e5a authored by Arnaud Fontaine's avatar Arnaud Fontaine

Clean up generation of concurrent users plot.

parent 9c104866
...@@ -78,7 +78,9 @@ import collections ...@@ -78,7 +78,9 @@ import collections
from .result import BenchmarkResultStatistic from .result import BenchmarkResultStatistic
def computeStatisticFromFilenameList(argument_namespace, filename_list): def computeStatisticFromFilenameList(argument_namespace, filename_list,
range_user_report_dict,
is_range_user=False):
reader_list = [] reader_list = []
ignore_result_set = set() ignore_result_set = set()
stat_list = [] stat_list = []
...@@ -124,7 +126,15 @@ def computeStatisticFromFilenameList(argument_namespace, filename_list): ...@@ -124,7 +126,15 @@ def computeStatisticFromFilenameList(argument_namespace, filename_list):
merged_label_dict[label] = label_merged_index merged_label_dict[label] = label_merged_index
label_merged_index += 1 label_merged_index += 1
stat_list.append(BenchmarkResultStatistic(suite_name, result_name)) stat = BenchmarkResultStatistic(suite_name, result_name)
stat_list.append(stat)
if is_range_user:
report_dict = range_user_report_dict.setdefault(
suite_name,
{'results': collections.OrderedDict()})
report_dict['results'].setdefault(stat.full_label, []).append(stat)
if row_list != label_list: if row_list != label_list:
raise AssertionError, "ERROR: Result labels: %s != %s" % \ raise AssertionError, "ERROR: Result labels: %s != %s" % \
...@@ -416,9 +426,13 @@ def generateReport(): ...@@ -416,9 +426,13 @@ def generateReport():
pdf = PdfPages(argument_namespace.output_filename) pdf = PdfPages(argument_namespace.output_filename)
for nb_users, report_dict in per_nb_users_report_dict.items(): is_range_user = len(per_nb_users_report_dict) > 1
range_user_report_dict = {}
for nb_users, report_dict in sorted(per_nb_users_report_dict.items()):
stat_list, use_case_dict = computeStatisticFromFilenameList( stat_list, use_case_dict = computeStatisticFromFilenameList(
argument_namespace, report_dict['filename']) argument_namespace, report_dict['filename'], range_user_report_dict,
is_range_user)
title = "Ran suites with %d users" % len(report_dict['filename']) title = "Ran suites with %d users" % len(report_dict['filename'])
for slice_start_idx in range(0, len(stat_list), DIAGRAM_PER_PAGE): for slice_start_idx in range(0, len(stat_list), DIAGRAM_PER_PAGE):
...@@ -437,24 +451,20 @@ def generateReport(): ...@@ -437,24 +451,20 @@ def generateReport():
use_case_dict['duration_stats'], use_case_dict['duration_stats'],
is_single_plot=(nb_users == 1)) is_single_plot=(nb_users == 1))
report_dict['stats'] = stat_list if is_range_user:
report_dict['use_cases'] = use_case_dict nb_users_list = per_nb_users_report_dict.keys()
title_fmt = "%%s from %d to %d users (step: %d)" % \
if len(per_nb_users_report_dict) != 1: (nb_users_list[0],
for i in range(len(report_dict['stats'])): nb_users_list[-1],
stat_list = [] nb_users_list[1] - nb_users_list[0])
nb_users_list = per_nb_users_report_dict.keys()
for report_dict in per_nb_users_report_dict.values(): for suite_name, report_dict in range_user_report_dict.iteritems():
stat_list.append(report_dict['stats'][i]) for label, stat_list in report_dict['results'].iteritems():
drawConcurrentUsersPlot(
drawConcurrentUsersPlot( pdf,
pdf, title_fmt % label,
"%s from %d to %d users (step: %d)" % (stat_list[0].full_label, nb_users_list,
nb_users_list[0], stat_list)
nb_users_list[-1],
nb_users_list[1] - nb_users_list[0]),
nb_users_list,
stat_list)
pdf.close() pdf.close()
......
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