tools/perf/core/results_processor/processor.py
def ProcessResults(options, is_unittest=False):
  """Process intermediate results and produce the requested outputs.

  This function takes the intermediate results generated by Telemetry after
  running benchmarks (including artifacts such as traces, etc.), and processes
  them as requested by the result processing options.

  Args:
    options: An options object with values parsed from the command line and
      after any adjustments from ProcessOptions were applied.
    is_unittest: If True, this benchmark is run as part of a unittest, and
      should not upload to result sink (the calling unittest is responsible
      for determining test result).
  """
  if not getattr(options, 'output_formats', None):
    return 0

  test_results = _LoadTestResults(options.intermediate_dir)
  if not test_results:
    # TODO(crbug.com/981349): Make sure that no one is expecting Results
    # Processor to output results in the case of empty input
    # and make this an error.
    logging.warning('No test results to process.')

  test_suite_start = (test_results[0]['startTime']
      if test_results and 'startTime' in test_results[0]
      else datetime.datetime.utcnow().isoformat() + 'Z')
  run_identifier = RunIdentifier(options.results_label, test_suite_start)
  should_compute_metrics = any(
      fmt in FORMATS_WITH_METRICS for fmt in options.output_formats)

  if options.extra_metrics:
    _AddExtraMetrics(test_results, options.extra_metrics)

  begin_time = time.time()
  util.ApplyInParallel(
      lambda result: ProcessTestResult(
          test_result=result,
          upload_bucket=options.upload_bucket,
          results_label=options.results_label,
          run_identifier=run_identifier,
          test_suite_start=test_suite_start,
          should_compute_metrics=should_compute_metrics,
          max_num_values=options.max_values_per_test_case,
          test_path_format=options.test_path_format,
          trace_processor_path=options.trace_processor_path,
          enable_tbmv3=options.experimental_tbmv3_metrics,
          fetch_power_profile=options.fetch_power_profile),
      test_results,
      on_failure=util.SetUnexpectedFailure,
  )
  processing_duration = time.time() - begin_time
  _AmortizeProcessingDuration(processing_duration, test_results)

  if should_compute_metrics:
    histogram_dicts = ExtractHistograms(test_results)

  if not is_unittest:
    util.TryUploadingResultToResultSink(test_results)

  for output_format in options.output_formats:
    logging.info('Processing format: %s', output_format)
    formatter = formatters.FORMATTERS[output_format]
    if output_format in FORMATS_WITH_METRICS:
      output_file = formatter.ProcessHistogramDicts(histogram_dicts, options)
    else:
      output_file = formatter.ProcessIntermediateResults(test_results, options)

    print('View results at file://', output_file, sep='')

  if options.fetch_device_data:
    PullDeviceArtifacts(options.device_data_path, options.local_data_path)

  return GenerateExitCode(test_results)
Process intermediate results and produce the requested outputs.

  This function takes the intermediate results generated by Telemetry after
  running benchmarks (including artifacts such as traces, etc.), and processes
  them as requested by the result processing options.

  Args:
    options: An options object with values parsed from the command line and
      after any adjustments from ProcessOptions were applied.
    is_unittest: If True, this benchmark is run as part of a unittest, and
      should not upload to result sink (the calling unittest is responsible
      for determining test result).
  
Process intermediate results and produce the requested outputs.
This function takes the intermediate results generated by Telemetry after
running benchmarks (including artifacts such as traces, etc.), and processes
them as requested by the result processing options.
Process intermediate results and produce the requested outputs . This function takes the intermediate results generated by Telemetry after running benchmarks ( including artifacts such as traces etc . ) and processes them as requested by the result processing options .
def ProcessResults(options, is_unittest=False):
  if not getattr(options, 'output_formats', None):
    return 0
  test_results = _LoadTestResults(options.intermediate_dir)
  if not test_results:
    logging.warning('No test results to process.')
  test_suite_start = (test_results[0]['startTime']
      if test_results and 'startTime' in test_results[0]
      else datetime.datetime.utcnow().isoformat() + 'Z')
  run_identifier = RunIdentifier(options.results_label, test_suite_start)
  should_compute_metrics = any(
      fmt in FORMATS_WITH_METRICS for fmt in options.output_formats)
  if options.extra_metrics:
    _AddExtraMetrics(test_results, options.extra_metrics)
  begin_time = time.time()
  util.ApplyInParallel(
      lambda result: ProcessTestResult(
          test_result=result,
          upload_bucket=options.upload_bucket,
          results_label=options.results_label,
          run_identifier=run_identifier,
          test_suite_start=test_suite_start,
          should_compute_metrics=should_compute_metrics,
          max_num_values=options.max_values_per_test_case,
          test_path_format=options.test_path_format,
          trace_processor_path=options.trace_processor_path,
          enable_tbmv3=options.experimental_tbmv3_metrics,
          fetch_power_profile=options.fetch_power_profile),
      test_results,
      on_failure=util.SetUnexpectedFailure,
  )
  processing_duration = time.time() - begin_time
  _AmortizeProcessingDuration(processing_duration, test_results)
  if should_compute_metrics:
    histogram_dicts = ExtractHistograms(test_results)
  if not is_unittest:
    util.TryUploadingResultToResultSink(test_results)
  for output_format in options.output_formats:
    logging.info('Processing format: %s', output_format)
    formatter = formatters.FORMATTERS[output_format]
    if output_format in FORMATS_WITH_METRICS:
      output_file = formatter.ProcessHistogramDicts(histogram_dicts, options)
    else:
      output_file = formatter.ProcessIntermediateResults(test_results, options)
    print('View results at file://', output_file, sep='')
  if options.fetch_device_data:
    PullDeviceArtifacts(options.device_data_path, options.local_data_path)
  return GenerateExitCode(test_results)
def ProcessResults ( options , is_unittest = False ) : if not getattr ( options , 'output_formats' , None ) : return 0 test_results = _LoadTestResults ( options . intermediate_dir ) if not test_results : logging . warning ( 'No test results to process.' ) test_suite_start = ( test_results [ 0 ] [ 'startTime' ] if test_results and 'startTime' in test_results [ 0 ] else datetime . datetime . utcnow ( ) . isoformat ( ) + 'Z' ) run_identifier = RunIdentifier ( options . results_label , test_suite_start ) should_compute_metrics = any ( fmt in FORMATS_WITH_METRICS for fmt in options . output_formats ) if options . extra_metrics : _AddExtraMetrics ( test_results , options . extra_metrics ) begin_time = time . time ( ) util . ApplyInParallel ( lambda result : ProcessTestResult ( test_result = result , upload_bucket = options . upload_bucket , results_label = options . results_label , run_identifier = run_identifier , test_suite_start = test_suite_start , should_compute_metrics = should_compute_metrics , max_num_values = options . max_values_per_test_case , test_path_format = options . test_path_format , trace_processor_path = options . trace_processor_path , enable_tbmv3 = options . experimental_tbmv3_metrics , fetch_power_profile = options . fetch_power_profile ) , test_results , on_failure = util . SetUnexpectedFailure , ) processing_duration = time . time ( ) - begin_time _AmortizeProcessingDuration ( processing_duration , test_results ) if should_compute_metrics : histogram_dicts = ExtractHistograms ( test_results ) if not is_unittest : util . TryUploadingResultToResultSink ( test_results ) for output_format in options . output_formats : logging . info ( 'Processing format: %s' , output_format ) formatter = formatters . FORMATTERS [ output_format ] if output_format in FORMATS_WITH_METRICS : output_file = formatter . ProcessHistogramDicts ( histogram_dicts , options ) else : output_file = formatter . ProcessIntermediateResults ( test_results , options ) print ( 'View results at file://' , output_file , sep = '' ) if options . fetch_device_data : PullDeviceArtifacts ( options . device_data_path , options . local_data_path ) return GenerateExitCode ( test_results )
Process intermediate results and produce the requested outputs.
Process intermediate results and produce the requested outputs .
"""Process intermediate results and produce the requested outputs.

  This function takes the intermediate results generated by Telemetry after
  running benchmarks (including artifacts such as traces, etc.), and processes
  them as requested by the result processing options.

  Args:
    options: An options object with values parsed from the command line and
      after any adjustments from ProcessOptions were applied.
    is_unittest: If True, this benchmark is run as part of a unittest, and
      should not upload to result sink (the calling unittest is responsible
      for determining test result).
  """ # TODO(crbug.com/981349): Make sure that no one is expecting Results # Processor to output results in the case of empty input # and make this an error.
options
An options object with values parsed from the command line and
after any adjustments from ProcessOptions were applied.
An options object with values parsed from the command line and after any adjustments from ProcessOptions were applied .
is_unittest
If True, this benchmark is run as part of a unittest, and
should not upload to result sink (the calling unittest is responsible
for determining test result).
If True this benchmark is run as part of a unittest and should not upload to result sink ( the calling unittest is responsible for determining test result ) .