tools/perf/process_perf_results.py
def process_perf_results(output_json,
                         configuration_name,
                         build_properties,
                         task_output_dir,
                         smoke_test_mode,
                         output_results_dir,
                         lightweight=False,
                         skip_perf=False):
  """Process perf results.

  Consists of merging the json-test-format output, uploading the perf test
  output (chartjson and histogram), and store the benchmark logs in logdog.

  Each directory in the task_output_dir represents one benchmark
  that was run. Within this directory, there is a subdirectory with the name
  of the benchmark that was run. In that subdirectory, there is a
  perftest-output.json file containing the performance results in histogram
  or dashboard json format and an output.json file containing the json test
  results for the benchmark.

  Returns:
    (return_code, upload_results_map):
      return_code is 0 if the whole operation is successful, non zero otherwise.
      benchmark_upload_result_map: the dictionary that describe which benchmarks
        were successfully uploaded.
  """
  handle_perf = not lightweight or not skip_perf
  handle_non_perf = not lightweight or skip_perf
  logging.info('lightweight mode: %r; handle_perf: %r; handle_non_perf: %r' %
               (lightweight, handle_perf, handle_non_perf))

  begin_time = time.time()
  return_code = 0
  benchmark_upload_result_map = {}

  benchmark_directory_map, benchmarks_shard_map_file = _scan_output_dir(
      task_output_dir)

  test_results_list = []
  extra_links = {}

  if handle_non_perf:
    # First, upload benchmarks shard map to logdog and add a page
    # entry for it in extra_links.
    if benchmarks_shard_map_file:
      _handle_benchmarks_shard_map(benchmarks_shard_map_file, extra_links)

    # Second, upload all the benchmark logs to logdog and add a page entry for
    # those links in extra_links.
    _handle_perf_logs(benchmark_directory_map, extra_links)

  # Then try to obtain the list of json test results to merge
  # and determine the status of each benchmark.
  benchmark_enabled_map = _handle_perf_json_test_results(
      benchmark_directory_map, test_results_list)

  build_properties_map = json.loads(build_properties)
  if not configuration_name:
    # we are deprecating perf-id crbug.com/817823
    configuration_name = build_properties_map['buildername']

  # The calibration project is paused and the experiments of adding device id,
  # which currently broken, is removed for now.
  # _update_perf_results_for_calibration(benchmarks_shard_map_file,
  #                                      benchmark_enabled_map,
  #                                      benchmark_directory_map,
  #                                      configuration_name)
  if not smoke_test_mode and handle_perf:
    try:
      return_code, benchmark_upload_result_map = _handle_perf_results(
          benchmark_enabled_map, benchmark_directory_map, configuration_name,
          build_properties_map, extra_links, output_results_dir)
    except Exception:
      logging.exception('Error handling perf results jsons')
      return_code = 1

  if handle_non_perf:
    # Finally, merge all test results json, add the extra links and write out to
    # output location
    try:
      _merge_json_output(
          output_json, test_results_list, extra_links,
          configuration_name in cross_device_test_config.TARGET_DEVICES)
    except Exception:
      logging.exception('Error handling test results jsons.')

  end_time = time.time()
  print_duration('Total process_perf_results', begin_time, end_time)
  return return_code, benchmark_upload_result_map
Process perf results.

  Consists of merging the json-test-format output, uploading the perf test
  output (chartjson and histogram), and store the benchmark logs in logdog.

  Each directory in the task_output_dir represents one benchmark
  that was run. Within this directory, there is a subdirectory with the name
  of the benchmark that was run. In that subdirectory, there is a
  perftest-output.json file containing the performance results in histogram
  or dashboard json format and an output.json file containing the json test
  results for the benchmark.

  Returns:
    (return_code, upload_results_map):
      return_code is 0 if the whole operation is successful, non zero otherwise.
      benchmark_upload_result_map: the dictionary that describe which benchmarks
        were successfully uploaded.
  
Process perf results.
Consists of merging the json-test-format output, uploading the perf test
output (chartjson and histogram), and store the benchmark logs in logdog.

Each directory in the task_output_dir represents one benchmark
that was run. Within this directory, there is a subdirectory with the name
of the benchmark that was run. In that subdirectory, there is a
perftest-output.json file containing the performance results in histogram
or dashboard json format and an output.json file containing the json test
results for the benchmark.
Process perf results . Consists of merging the json - test - format output uploading the perf test output ( chartjson and histogram ) and store the benchmark logs in logdog . Each directory in the task_output_dir represents one benchmark that was run . Within this directory there is a subdirectory with the name of the benchmark that was run . In that subdirectory there is a perftest - output . json file containing the performance results in histogram or dashboard json format and an output . json file containing the json test results for the benchmark .
def process_perf_results(output_json,
                         configuration_name,
                         build_properties,
                         task_output_dir,
                         smoke_test_mode,
                         output_results_dir,
                         lightweight=False,
                         skip_perf=False):
  handle_perf = not lightweight or not skip_perf
  handle_non_perf = not lightweight or skip_perf
  logging.info('lightweight mode: %r; handle_perf: %r; handle_non_perf: %r' %
               (lightweight, handle_perf, handle_non_perf))
  begin_time = time.time()
  return_code = 0
  benchmark_upload_result_map = {}
  benchmark_directory_map, benchmarks_shard_map_file = _scan_output_dir(
      task_output_dir)
  test_results_list = []
  extra_links = {}
  if handle_non_perf:
    if benchmarks_shard_map_file:
      _handle_benchmarks_shard_map(benchmarks_shard_map_file, extra_links)
    _handle_perf_logs(benchmark_directory_map, extra_links)
  benchmark_enabled_map = _handle_perf_json_test_results(
      benchmark_directory_map, test_results_list)
  build_properties_map = json.loads(build_properties)
  if not configuration_name:
    configuration_name = build_properties_map['buildername']
  if not smoke_test_mode and handle_perf:
    try:
      return_code, benchmark_upload_result_map = _handle_perf_results(
          benchmark_enabled_map, benchmark_directory_map, configuration_name,
          build_properties_map, extra_links, output_results_dir)
    except Exception:
      logging.exception('Error handling perf results jsons')
      return_code = 1
  if handle_non_perf:
    try:
      _merge_json_output(
          output_json, test_results_list, extra_links,
          configuration_name in cross_device_test_config.TARGET_DEVICES)
    except Exception:
      logging.exception('Error handling test results jsons.')
  end_time = time.time()
  print_duration('Total process_perf_results', begin_time, end_time)
  return return_code, benchmark_upload_result_map
def process_perf_results ( output_json , configuration_name , build_properties , task_output_dir , smoke_test_mode , output_results_dir , lightweight = False , skip_perf = False ) : handle_perf = not lightweight or not skip_perf handle_non_perf = not lightweight or skip_perf logging . info ( 'lightweight mode: %r; handle_perf: %r; handle_non_perf: %r' % ( lightweight , handle_perf , handle_non_perf ) ) begin_time = time . time ( ) return_code = 0 benchmark_upload_result_map = { } benchmark_directory_map , benchmarks_shard_map_file = _scan_output_dir ( task_output_dir ) test_results_list = [ ] extra_links = { } if handle_non_perf : if benchmarks_shard_map_file : _handle_benchmarks_shard_map ( benchmarks_shard_map_file , extra_links ) _handle_perf_logs ( benchmark_directory_map , extra_links ) benchmark_enabled_map = _handle_perf_json_test_results ( benchmark_directory_map , test_results_list ) build_properties_map = json . loads ( build_properties ) if not configuration_name : configuration_name = build_properties_map [ 'buildername' ] if not smoke_test_mode and handle_perf : try : return_code , benchmark_upload_result_map = _handle_perf_results ( benchmark_enabled_map , benchmark_directory_map , configuration_name , build_properties_map , extra_links , output_results_dir ) except Exception : logging . exception ( 'Error handling perf results jsons' ) return_code = 1 if handle_non_perf : try : _merge_json_output ( output_json , test_results_list , extra_links , configuration_name in cross_device_test_config . TARGET_DEVICES ) except Exception : logging . exception ( 'Error handling test results jsons.' ) end_time = time . time ( ) print_duration ( 'Total process_perf_results' , begin_time , end_time ) return return_code , benchmark_upload_result_map
Process perf results.
Process perf results .
"""Process perf results.

  Consists of merging the json-test-format output, uploading the perf test
  output (chartjson and histogram), and store the benchmark logs in logdog.

  Each directory in the task_output_dir represents one benchmark
  that was run. Within this directory, there is a subdirectory with the name
  of the benchmark that was run. In that subdirectory, there is a
  perftest-output.json file containing the performance results in histogram
  or dashboard json format and an output.json file containing the json test
  results for the benchmark.

  Returns:
    (return_code, upload_results_map):
      return_code is 0 if the whole operation is successful, non zero otherwise.
      benchmark_upload_result_map: the dictionary that describe which benchmarks
        were successfully uploaded.
  """ # First, upload benchmarks shard map to logdog and add a page # entry for it in extra_links. # Second, upload all the benchmark logs to logdog and add a page entry for # those links in extra_links. # Then try to obtain the list of json test results to merge # and determine the status of each benchmark. # we are deprecating perf-id crbug.com/817823 # The calibration project is paused and the experiments of adding device id, # which currently broken, is removed for now. # _update_perf_results_for_calibration(benchmarks_shard_map_file, #                                      benchmark_enabled_map, #                                      benchmark_directory_map, #                                      configuration_name) # Finally, merge all test results json, add the extra links and write out to # output location
(return_code, upload_results_map):
return_code is 0 if the whole operation is successful, non zero otherwise.
benchmark_upload_result_map: the dictionary that describe which benchmarks
were successfully uploaded.
( return_code upload_results_map ) : return_code is 0 if the whole operation is successful non zero otherwise . benchmark_upload_result_map : the dictionary that describe which benchmarks were successfully uploaded .
output_json
configuration_name
build_properties
task_output_dir
smoke_test_mode
output_results_dir
lightweight
skip_perf