def report(self, stream):
if not self.enabled:<EOL><INDENT>return<EOL><DEDENT>if self.multiprocessing_enabled:<EOL><INDENT>for i in range(_results_queue.qsize()):<EOL><INDENT>try:<EOL><INDENT>k, v, s = _results_queue.get(False)<EOL>self._timed_tests[k] = {<EOL>'<STR_LIT:time>': v,<EOL>'<STR_LIT:status>': s,<EOL>}<EOL><DEDENT>except Queue.Empty:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>d = sorted(self._timed_tests.items(), key=lambda item: item[<NUM_LIT:1>]['<STR_LIT:time>'], reverse=True)<EOL>if self.json_file:<EOL><INDENT>dict_type = OrderedDict if self.timer_top_n else dict<EOL>with open(self.json_file, '<STR_LIT:w>') as f:<EOL><INDENT>json.dump({'<STR_LIT>': dict_type((k, v) for k, v in d)}, f)<EOL><DEDENT><DEDENT>total_time = sum([vv['<STR_LIT:time>'] for kk, vv in d])<EOL>for i, (test, time_and_status) in enumerate(d):<EOL><INDENT>time_taken = time_and_status['<STR_LIT:time>']<EOL>status = time_and_status['<STR_LIT:status>']<EOL>if i < self.timer_top_n or self.timer_top_n == -<NUM_LIT:1>:<EOL><INDENT>color = self._get_result_color(time_taken)<EOL>percent = <NUM_LIT:0> if total_time == <NUM_LIT:0> else time_taken / total_time * <NUM_LIT:100><EOL>line = self._format_report_line(<EOL>test=test,<EOL>time_taken=time_taken,<EOL>color=color,<EOL>status=status,<EOL>percent=percent,<EOL>)<EOL>_filter = self._COLOR_TO_FILTER.get(color)<EOL>if self.timer_filter is None or _filter is None or _filter in self.timer_filter:<EOL><INDENT>stream.writeln(line)<EOL><DEDENT><DEDENT><DEDENT>
Report the test times.