@staticmethod<EOL><INDENT>def summarize(group, fs=None, include_source=True):<DEDENT>
_line_break = '<STR_LIT>'.format('<STR_LIT>')<EOL>tests = sorted(ComparisonBenchmark.groups[group], key=lambda t: getattr(t, '<STR_LIT>'))<EOL>log = StringIO.StringIO()<EOL>log.write('<STR_LIT>')<EOL>log.write('<STR_LIT:\t>' + tests[<NUM_LIT:0>].stmt)<EOL>log.write('<STR_LIT>')<EOL>fmt = "<STR_LIT>"<EOL>log.write(fmt.format('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'))<EOL>log.write(_line_break)<EOL>log.write('<STR_LIT:\n>')<EOL>for i, t in enumerate(tests):<EOL><INDENT>func_name = "<STR_LIT>".format(t.classname, t.callable.__name__) if t.classname else t.callable.__name__<EOL>if i == len(tests)-<NUM_LIT:1>:<EOL><INDENT>time_percent = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>time_percent = "<STR_LIT>".format(t.time_average_seconds / tests[-<NUM_LIT:1>].time_average_seconds * <NUM_LIT:100>)<EOL><DEDENT>log.write(fmt.format(i+<NUM_LIT:1>,<EOL>func_name,<EOL>convert_time_units(t.time_average_seconds),<EOL>time_percent,<EOL>t.timeit_repeat,<EOL>t.timeit_number))<EOL><DEDENT>log.write(_line_break)<EOL>if include_source:<EOL><INDENT>log.write('<STR_LIT>')<EOL>log.write(_line_break)<EOL>for test in tests:<EOL><INDENT>log.write(test.log.getvalue())<EOL>log.write(_line_break)<EOL><DEDENT><DEDENT>if isinstance(fs, str):<EOL><INDENT>with open(fs, '<STR_LIT:w>') as f:<EOL><INDENT>f.write(log.getvalue())<EOL><DEDENT><DEDENT>elif fs is None:<EOL><INDENT>print(log.getvalue())<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>fs.write(log.getvalue())<EOL><DEDENT>except AttributeError as e:<EOL><INDENT>print(e)<EOL><DEDENT><DEDENT>
Tabulate and write the results of ComparisonBenchmarks to a file or standard out.
:param str group: name of the comparison group.
:param fs: file-like object (Optional)