def Start(self):
    """Starts the logdog logcat monitor.

    Clears the logcat if |clear| was set in |__init__|.
    """
    if self._clear:
      self._adb.Logcat(clear=True)

    self._logdog_stream = logdog_helper.open_text(self._stream_name)
    self._StartRecording()
    def Start(self):
        """Starts the logdog logcat monitor.

    Clears the logcat if |clear| was set in |__init__|.
    """
        if self._clear:
            self._adb.Logcat(clear=True)

        self._logdog_stream = logdog_helper.open_text(self._stream_name)
        self._StartRecording()
Example #3
0
def _write_perf_data_to_logfile(benchmark_name, output_file,
                                configuration_name, build_properties,
                                logdog_dict, is_ref, upload_failure):
    viewer_url = None
    # logdog file to write perf results to
    if os.path.exists(output_file):
        results = None
        with open(output_file) as f:
            try:
                results = json.load(f)
            except ValueError:
                logging.error(
                    'Error parsing perf results JSON for benchmark  %s' %
                    benchmark_name)
        if results:
            try:
                output_json_file = logdog_helper.open_text(benchmark_name)
                json.dump(results,
                          output_json_file,
                          indent=4,
                          separators=(',', ': '))
            except ValueError as e:
                logging.error(
                    'ValueError: "%s" while dumping output to logdog' % e)
            finally:
                output_json_file.close()
            viewer_url = output_json_file.get_viewer_url()
    else:
        logging.warning(
            "Perf results JSON file doesn't exist for benchmark %s" %
            benchmark_name)

    base_benchmark_name = benchmark_name.replace('.reference', '')

    if base_benchmark_name not in logdog_dict:
        logdog_dict[base_benchmark_name] = {}

    # add links for the perf results and the dashboard url to
    # the logs section of buildbot
    if is_ref:
        if viewer_url:
            logdog_dict[base_benchmark_name]['perf_results_ref'] = viewer_url
        if upload_failure:
            logdog_dict[base_benchmark_name]['ref_upload_failed'] = 'True'
    else:
        logdog_dict[base_benchmark_name]['dashboard_url'] = (
            upload_results_to_perf_dashboard.GetDashboardUrl(
                benchmark_name, configuration_name, RESULTS_URL,
                build_properties['got_revision_cp'],
                _GetMachineGroup(build_properties)))
        if viewer_url:
            logdog_dict[base_benchmark_name]['perf_results'] = viewer_url
        if upload_failure:
            logdog_dict[base_benchmark_name]['upload_failed'] = 'True'
Example #4
0
 def upload_logcats_file():
   try:
     yield
   finally:
     if not args.logcat_output_file:
       logging.critical('Cannot upload logcats file. '
                       'File to save logcat is not specified.')
     else:
       with open(args.logcat_output_file) as src:
         dst = logdog_helper.open_text('unified_logcats')
         if dst:
           shutil.copyfileobj(src, dst)
           dst.close()
           logging.critical(
               'Logcat: %s', logdog_helper.get_viewer_url('unified_logcats'))
Example #5
0
 def upload_logcats_file():
     try:
         yield
     finally:
         if not args.logcat_output_file:
             logging.critical('Cannot upload logcats file. '
                              'File to save logcat is not specified.')
         else:
             with open(args.logcat_output_file) as src:
                 dst = logdog_helper.open_text('unified_logcats')
                 if dst:
                     shutil.copyfileobj(src, dst)
                     dst.close()
                     logging.critical(
                         'Logcat: %s',
                         logdog_helper.get_viewer_url('unified_logcats'))
Example #6
0
 def upload_logcats_file():
   try:
     yield
   finally:
     if not args.logcat_output_file:
       logging.critical('Cannot upload logcat file: no file specified.')
     elif not os.path.exists(args.logcat_output_file):
       logging.critical("Cannot upload logcat file: file doesn't exist.")
     else:
       with open(args.logcat_output_file) as src:
         dst = logdog_helper.open_text('unified_logcats')
         if dst:
           shutil.copyfileobj(src, dst)
           dst.close()
           logging.critical(
               'Logcat: %s', logdog_helper.get_viewer_url('unified_logcats'))
Example #7
0
 def upload_logcats_file():
   try:
     yield
   finally:
     if not args.logcat_output_file:
       logging.critical('Cannot upload logcat file: no file specified.')
     elif not os.path.exists(args.logcat_output_file):
       logging.critical("Cannot upload logcat file: file doesn't exist.")
     else:
       with open(args.logcat_output_file) as src:
         dst = logdog_helper.open_text('unified_logcats')
         if dst:
           shutil.copyfileobj(src, dst)
           dst.close()
           logging.critical(
               'Logcat: %s', logdog_helper.get_viewer_url('unified_logcats'))
Example #8
0
def _upload_and_write_perf_data_to_logfile(benchmark_name, directory,
                                           configuration_name,
                                           build_properties, oauth_file,
                                           tmpfile_dir, logdog_dict, is_ref):
    upload_failure = False
    # logdog file to write perf results to
    output_json_file = logdog_helper.open_text(benchmark_name)

    # upload results and write perf results to logdog file
    upload_failure = _upload_perf_results(join(directory, 'perf_results.json'),
                                          benchmark_name, configuration_name,
                                          build_properties, oauth_file,
                                          tmpfile_dir, output_json_file)

    output_json_file.close()

    base_benchmark_name = benchmark_name.replace('.reference', '')

    if base_benchmark_name not in logdog_dict:
        logdog_dict[base_benchmark_name] = {}

    # add links for the perf results and the dashboard url to
    # the logs section of buildbot
    if is_ref:
        logdog_dict[base_benchmark_name]['perf_results_ref'] = \
            output_json_file.get_viewer_url()
    else:
        if upload_failure:
            logdog_dict[base_benchmark_name]['dashboard_url'] = \
                'upload failed'
        else:
            logdog_dict[base_benchmark_name]['dashboard_url'] = \
                upload_results_to_perf_dashboard.GetDashboardUrl(
                    benchmark_name,
                    configuration_name, RESULTS_URL,
                    build_properties['got_revision_cp'],
                    _GetMachineGroup(build_properties))
        logdog_dict[base_benchmark_name]['perf_results'] = \
            output_json_file.get_viewer_url()

    return upload_failure