tools/perf/cli_tools/pinpoint_cli/commands.py
def DownloadJobResultsAsCsv(job_ids, only_differences, output_file):
  """Download the perf results of a job as a csv file."""
  with open(output_file, 'wb') as f:
    writer = csv.writer(f)
    writer.writerow(('job_id', 'change', 'isolate') + histograms_df.COLUMNS)
    num_rows = 0
    for job_id in job_ids:
      job = pinpoint_service.Job(job_id, with_state=True)
      os_path = _OsPathFromJob(job)
      results_file = os_path.join(
          job['arguments']['benchmark'], 'perf_results.json')
      print('Fetching results for %s job %s:' % (job['status'].lower(), job_id))
      for change_id, isolate_hash in job_results.IterTestOutputIsolates(
          job, only_differences):
        print('- isolate: %s ...' % isolate_hash)
        try:
          histograms = isolate_service.RetrieveFile(isolate_hash, results_file)
        except KeyError:
          logging.warning('Skipping over isolate, results not found.')
          continue
        for row in histograms_df.IterRows(json.loads(histograms)):
          writer.writerow((job_id, change_id, isolate_hash) + row)
          num_rows += 1
  print('Wrote data from %d histograms in %s.' % (num_rows, output_file))
Download the perf results of a job as a csv file.
Download the perf results of a job as a csv file.
Download the perf results of a job as a csv file .
def DownloadJobResultsAsCsv(job_ids, only_differences, output_file):
  with open(output_file, 'wb') as f:
    writer = csv.writer(f)
    writer.writerow(('job_id', 'change', 'isolate') + histograms_df.COLUMNS)
    num_rows = 0
    for job_id in job_ids:
      job = pinpoint_service.Job(job_id, with_state=True)
      os_path = _OsPathFromJob(job)
      results_file = os_path.join(
          job['arguments']['benchmark'], 'perf_results.json')
      print('Fetching results for %s job %s:' % (job['status'].lower(), job_id))
      for change_id, isolate_hash in job_results.IterTestOutputIsolates(
          job, only_differences):
        print('- isolate: %s ...' % isolate_hash)
        try:
          histograms = isolate_service.RetrieveFile(isolate_hash, results_file)
        except KeyError:
          logging.warning('Skipping over isolate, results not found.')
          continue
        for row in histograms_df.IterRows(json.loads(histograms)):
          writer.writerow((job_id, change_id, isolate_hash) + row)
          num_rows += 1
  print('Wrote data from %d histograms in %s.' % (num_rows, output_file))
def DownloadJobResultsAsCsv ( job_ids , only_differences , output_file ) : with open ( output_file , 'wb' ) as f : writer = csv . writer ( f ) writer . writerow ( ( 'job_id' , 'change' , 'isolate' ) + histograms_df . COLUMNS ) num_rows = 0 for job_id in job_ids : job = pinpoint_service . Job ( job_id , with_state = True ) os_path = _OsPathFromJob ( job ) results_file = os_path . join ( job [ 'arguments' ] [ 'benchmark' ] , 'perf_results.json' ) print ( 'Fetching results for %s job %s:' % ( job [ 'status' ] . lower ( ) , job_id ) ) for change_id , isolate_hash in job_results . IterTestOutputIsolates ( job , only_differences ) : print ( '- isolate: %s ...' % isolate_hash ) try : histograms = isolate_service . RetrieveFile ( isolate_hash , results_file ) except KeyError : logging . warning ( 'Skipping over isolate, results not found.' ) continue for row in histograms_df . IterRows ( json . loads ( histograms ) ) : writer . writerow ( ( job_id , change_id , isolate_hash ) + row ) num_rows += 1 print ( 'Wrote data from %d histograms in %s.' % ( num_rows , output_file ) )
Download the perf results of a job as a csv file.
Download the perf results of a job as a csv file .
"""Download the perf results of a job as a csv file."""
job_ids
only_differences
output_file