parameters: (
          json_diff_report,
          include_aggregates_only=False,
          utest=False,
          utest_alpha=0.05,
          use_color=True)
return_statement: return output_strs
docstring: Calculate and report the difference between each test of two benchmarks
      runs specified as 'json1' and 'json2'.
docstring_summary: Calculate and report the difference between each test of two benchmarks
      runs specified as 'json1' and 'json2'.
docstring_tokens: Calculate and report the difference between each test of two benchmarks runs specified as json1 and json2 .
function: def print_difference_report(
          json_diff_report,
          include_aggregates_only=False,
          utest=False,
          utest_alpha=0.05,
          use_color=True):
      """
      Calculate and report the difference between each test of two benchmarks
      runs specified as 'json1' and 'json2'.
      """
      assert utest is True or utest is False
  
      def get_color(res):
          if res > 0.05:
              return BC_FAIL
          elif res > -0.07:
              return BC_WHITE
          else:
              return BC_CYAN
  
      first_col_width = find_longest_name(json_diff_report)
      first_col_width = max(
          first_col_width,
          len('Benchmark'))
      first_col_width += len(UTEST_COL_NAME)
      first_line = "{:<{}s}Time             CPU      Time Old      Time New       CPU Old       CPU New".format(
          'Benchmark', 12 + first_col_width)
      output_strs = [first_line, '-' * len(first_line)]
  
      fmt_str = "{}{:<{}s}{endc}{}{:+16.4f}{endc}{}{:+16.4f}{endc}{:14.0f}{:14.0f}{endc}{:14.0f}{:14.0f}"
      for benchmark in json_diff_report:
          # *If* we were asked to only include aggregates,
          # and if it is non-aggregate, then don't print it.
          if not include_aggregates_only or not 'run_type' in benchmark or benchmark['run_type'] == 'aggregate':
              for measurement in benchmark['measurements']:
                  output_strs += [color_format(use_color,
                                               fmt_str,
                                               BC_HEADER,
                                               benchmark['name'],
                                               first_col_width,
                                               get_color(measurement['time']),
                                               measurement['time'],
                                               get_color(measurement['cpu']),
                                               measurement['cpu'],
                                               measurement['real_time'],
                                               measurement['real_time_other'],
                                               measurement['cpu_time'],
                                               measurement['cpu_time_other'],
                                               endc=BC_ENDC)]
  
          # After processing the measurements, if requested and
          # if applicable (e.g. u-test exists for given benchmark),
          # print the U test.
          if utest and benchmark['utest']:
              output_strs += print_utest(benchmark['name'],
                                         benchmark['utest'],
                                         utest_alpha=utest_alpha,
                                         first_col_width=first_col_width,
                                         use_color=use_color)
  
      return output_strs
function_tokens: def print_difference_report ( json_diff_report , include_aggregates_only = False , utest = False , utest_alpha = 0.05 , use_color = True ) : assert utest is True or utest is False def get_color ( res ) : if res > 0.05 : return BC_FAIL elif res > - 0.07 : return BC_WHITE else : return BC_CYAN first_col_width = find_longest_name ( json_diff_report ) first_col_width = max ( first_col_width , len ( 'Benchmark' ) ) first_col_width += len ( UTEST_COL_NAME ) first_line = "{:<{}s}Time             CPU      Time Old      Time New       CPU Old       CPU New" . format ( 'Benchmark' , 12 + first_col_width ) output_strs = [ first_line , '-' * len ( first_line ) ] fmt_str = "{}{:<{}s}{endc}{}{:+16.4f}{endc}{}{:+16.4f}{endc}{:14.0f}{:14.0f}{endc}{:14.0f}{:14.0f}" for benchmark in json_diff_report : # *If* we were asked to only include aggregates, # and if it is non-aggregate, then don't print it. if not include_aggregates_only or not 'run_type' in benchmark or benchmark [ 'run_type' ] == 'aggregate' : for measurement in benchmark [ 'measurements' ] : output_strs += [ color_format ( use_color , fmt_str , BC_HEADER , benchmark [ 'name' ] , first_col_width , get_color ( measurement [ 'time' ] ) , measurement [ 'time' ] , get_color ( measurement [ 'cpu' ] ) , measurement [ 'cpu' ] , measurement [ 'real_time' ] , measurement [ 'real_time_other' ] , measurement [ 'cpu_time' ] , measurement [ 'cpu_time_other' ] , endc = BC_ENDC ) ] # After processing the measurements, if requested and # if applicable (e.g. u-test exists for given benchmark), # print the U test. if utest and benchmark [ 'utest' ] : output_strs += print_utest ( benchmark [ 'name' ] , benchmark [ 'utest' ] , utest_alpha = utest_alpha , first_col_width = first_col_width , use_color = use_color ) return output_strs