xls-report.py: Added an option to show per-pixel times
This commit is contained in:
parent
5b2dc26f2c
commit
ea3239a00e
@ -104,6 +104,7 @@ bad_speedup_style = xlwt.easyxf('font: color red', num_format_str='#0.00')
|
||||
no_speedup_style = no_time_style
|
||||
error_speedup_style = xlwt.easyxf('pattern: pattern solid, fore_color orange')
|
||||
header_style = xlwt.easyxf('font: bold true; alignment: horizontal centre, vertical top, wrap True')
|
||||
subheader_style = xlwt.easyxf('alignment: horizontal centre, vertical top')
|
||||
|
||||
class Collector(object):
|
||||
def __init__(self, config_match_func, include_unmatched):
|
||||
@ -193,6 +194,8 @@ def main():
|
||||
arg_parser.add_argument('-c', '--config', metavar='CONF', help='global configuration file')
|
||||
arg_parser.add_argument('--include-unmatched', action='store_true',
|
||||
help='include results from XML files that were not recognized by configuration matchers')
|
||||
arg_parser.add_argument('--show-times-per-pixel', action='store_true',
|
||||
help='for tests that have an image size parameter, show per-pixel time, as well as total time')
|
||||
|
||||
args = arg_parser.parse_args()
|
||||
|
||||
@ -246,21 +249,53 @@ def main():
|
||||
sheet.row(2).height = 800
|
||||
sheet.panes_frozen = True
|
||||
sheet.remove_splits = True
|
||||
sheet.horz_split_pos = 3
|
||||
sheet.horz_split_first_visible = 3
|
||||
|
||||
sheet_comparisons = sheet_conf.get('comparisons', [])
|
||||
|
||||
for i, w in enumerate([2500, 10000, 2500, 2000, 7500]
|
||||
+ (len(config_names) + 1 + len(sheet_comparisons)) * [4000]):
|
||||
sheet.col(i).width = w
|
||||
row = 2
|
||||
|
||||
for i, caption in enumerate(['Module', 'Test', 'Image\nsize', 'Data\ntype', 'Other parameters']
|
||||
+ config_names + [None]
|
||||
+ [comp['to'] + '\nvs\n' + comp['from'] for comp in sheet_comparisons]):
|
||||
sheet.row(2).write(i, caption, header_style)
|
||||
col = 0
|
||||
|
||||
row = 3
|
||||
for (w, caption) in [
|
||||
(2500, 'Module'),
|
||||
(10000, 'Test'),
|
||||
(2500, 'Image\nsize'),
|
||||
(2000, 'Data\ntype'),
|
||||
(7500, 'Other parameters')]:
|
||||
sheet.col(col).width = w
|
||||
if args.show_times_per_pixel:
|
||||
sheet.write_merge(row, row + 1, col, col, caption, header_style)
|
||||
else:
|
||||
sheet.write(row, col, caption, header_style)
|
||||
col += 1
|
||||
|
||||
for config_name in config_names:
|
||||
if args.show_times_per_pixel:
|
||||
sheet.col(col).width = 3000
|
||||
sheet.col(col + 1).width = 3000
|
||||
sheet.write_merge(row, row, col, col + 1, config_name, header_style)
|
||||
sheet.write(row + 1, col, 'total, ms', subheader_style)
|
||||
sheet.write(row + 1, col + 1, 'per pixel, ns', subheader_style)
|
||||
col += 2
|
||||
else:
|
||||
sheet.col(col).width = 4000
|
||||
sheet.write(row, col, config_name, header_style)
|
||||
col += 1
|
||||
|
||||
col += 1 # blank column between configurations and comparisons
|
||||
|
||||
for comp in sheet_comparisons:
|
||||
sheet.col(col).width = 4000
|
||||
caption = comp['to'] + '\nvs\n' + comp['from']
|
||||
if args.show_times_per_pixel:
|
||||
sheet.write_merge(row, row + 1, col, col, caption, header_style)
|
||||
else:
|
||||
sheet.write(row, col, caption, header_style)
|
||||
|
||||
row += 2 if args.show_times_per_pixel else 1
|
||||
|
||||
sheet.horz_split_pos = row
|
||||
sheet.horz_split_first_visible = row
|
||||
|
||||
module_colors = sheet_conf.get('module_colors', {})
|
||||
module_styles = {module: xlwt.easyxf('pattern: pattern solid, fore_color {}'.format(color))
|
||||
@ -284,16 +319,36 @@ def main():
|
||||
del param_list[param_list.index(data_type)]
|
||||
|
||||
sheet.row(row).write(4, ' | '.join(param_list))
|
||||
for i, c in enumerate(config_names):
|
||||
if c in configs:
|
||||
sheet.write(row, 5 + i, configs[c], time_style)
|
||||
else:
|
||||
sheet.write(row, 5 + i, None, no_time_style)
|
||||
|
||||
for i, comp in enumerate(sheet_comparisons):
|
||||
col = 5
|
||||
|
||||
for c in config_names:
|
||||
if c in configs:
|
||||
sheet.write(row, col, configs[c], time_style)
|
||||
else:
|
||||
sheet.write(row, col, None, no_time_style)
|
||||
col += 1
|
||||
if args.show_times_per_pixel:
|
||||
sheet.write(row, col,
|
||||
xlwt.Formula(
|
||||
'''
|
||||
{0} * 1000000 / (
|
||||
VALUE(MID({1}; 1; SEARCH("x"; {1}) - 1))
|
||||
* VALUE(MID({1}; SEARCH("x"; {1}) + 1; LEN({1})))
|
||||
)
|
||||
'''.replace('\n', '').replace(' ', '').format(
|
||||
xlwt.Utils.rowcol_to_cell(row, col - 1),
|
||||
xlwt.Utils.rowcol_to_cell(row, 2)
|
||||
)
|
||||
),
|
||||
time_style)
|
||||
col += 1
|
||||
|
||||
col += 1 # blank column
|
||||
|
||||
for comp in sheet_comparisons:
|
||||
cmp_from = configs.get(comp["from"])
|
||||
cmp_to = configs.get(comp["to"])
|
||||
col = 5 + len(config_names) + 1 + i
|
||||
|
||||
if isinstance(cmp_from, numbers.Number) and isinstance(cmp_to, numbers.Number):
|
||||
try:
|
||||
@ -306,6 +361,8 @@ def main():
|
||||
else:
|
||||
sheet.write(row, col, None, no_speedup_style)
|
||||
|
||||
col += 1
|
||||
|
||||
row += 1
|
||||
if row % 1000 == 0: sheet.flush_row_data()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user