tools/cygprofile/orderfile_generator_backend.py
def _PerformanceBenchmark(self, apk):
    """Runs Speedometer2.0 to assess performance.

    Args:
      apk: (str) Path to the apk.

    Returns:
      results: ([float]) Speedometer2.0 results samples in milliseconds.
    """
    self._step_recorder.BeginStep("Running Speedometer2.0.")
    try:
      out_dir = tempfile.mkdtemp()
      self._profiler._RunCommand(['tools/perf/run_benchmark',
                                  '--device={}'.format(
                                      self._profiler._device.serial),
                                  '--browser=exact',
                                  '--output-format=histograms',
                                  '--output-dir={}'.format(out_dir),
                                  '--reset-results',
                                  '--browser-executable={}'.format(apk),
                                  'speedometer2'])

      out_file_path = os.path.join(out_dir, 'histograms.json')
      if not os.path.exists(out_file_path):
        raise Exception('Results file not found!')

      with open(out_file_path, 'r') as f:
        results = json.load(f)

      if not results:
        raise Exception('Results file is empty.')

      for el in results:
        if 'name' in el and el['name'] == 'Total' and 'sampleValues' in el:
          return el['sampleValues']

      raise Exception('Unexpected results format.')

    except Exception as e:
      return 'Error: ' + str(e)

    finally:
      shutil.rmtree(out_dir)
Runs Speedometer2.0 to assess performance.

    Args:
      apk: (str) Path to the apk.

    Returns:
      results: ([float]) Speedometer2.0 results samples in milliseconds.
    
Runs Speedometer2.0 to assess performance.
Runs Speedometer2 . 0 to assess performance .
def _PerformanceBenchmark(self, apk):
    self._step_recorder.BeginStep("Running Speedometer2.0.")
    try:
      out_dir = tempfile.mkdtemp()
      self._profiler._RunCommand(['tools/perf/run_benchmark',
                                  '--device={}'.format(
                                      self._profiler._device.serial),
                                  '--browser=exact',
                                  '--output-format=histograms',
                                  '--output-dir={}'.format(out_dir),
                                  '--reset-results',
                                  '--browser-executable={}'.format(apk),
                                  'speedometer2'])
      out_file_path = os.path.join(out_dir, 'histograms.json')
      if not os.path.exists(out_file_path):
        raise Exception('Results file not found!')
      with open(out_file_path, 'r') as f:
        results = json.load(f)
      if not results:
        raise Exception('Results file is empty.')
      for el in results:
        if 'name' in el and el['name'] == 'Total' and 'sampleValues' in el:
          return el['sampleValues']
      raise Exception('Unexpected results format.')
    except Exception as e:
      return 'Error: ' + str(e)
    finally:
      shutil.rmtree(out_dir)
def _PerformanceBenchmark ( self , apk ) : self . _step_recorder . BeginStep ( "Running Speedometer2.0." ) try : out_dir = tempfile . mkdtemp ( ) self . _profiler . _RunCommand ( [ 'tools/perf/run_benchmark' , '--device={}' . format ( self . _profiler . _device . serial ) , '--browser=exact' , '--output-format=histograms' , '--output-dir={}' . format ( out_dir ) , '--reset-results' , '--browser-executable={}' . format ( apk ) , 'speedometer2' ] ) out_file_path = os . path . join ( out_dir , 'histograms.json' ) if not os . path . exists ( out_file_path ) : raise Exception ( 'Results file not found!' ) with open ( out_file_path , 'r' ) as f : results = json . load ( f ) if not results : raise Exception ( 'Results file is empty.' ) for el in results : if 'name' in el and el [ 'name' ] == 'Total' and 'sampleValues' in el : return el [ 'sampleValues' ] raise Exception ( 'Unexpected results format.' ) except Exception as e : return 'Error: ' + str ( e ) finally : shutil . rmtree ( out_dir )
Runs Speedometer2.0 to assess performance.
Runs Speedometer2 . 0 to assess performance .
"""Runs Speedometer2.0 to assess performance.

    Args:
      apk: (str) Path to the apk.

    Returns:
      results: ([float]) Speedometer2.0 results samples in milliseconds.
    """
([float]) Speedometer2.0 results samples in milliseconds.
( [ float ] ) Speedometer2 . 0 results samples in milliseconds .
results
self
apk
(str) Path to the apk.
( str ) Path to the apk .