예제 #1
0
    def __init__(self,
                 trace_handles,
                 job,
                 stop_on_error=False,
                 progress_reporter=None,
                 jobs=AUTO_JOB_COUNT,
                 output_formatters=None,
                 extra_import_options=None):
        self._job = job
        self._stop_on_error = stop_on_error
        self._failed_canonical_url_to_dump = None
        if progress_reporter is None:
            self._progress_reporter = gtest_progress_reporter.GTestProgressReporter(
                sys.stdout)
        else:
            self._progress_reporter = progress_reporter
        self._output_formatters = output_formatters or []
        self._extra_import_options = extra_import_options

        self._trace_handles = trace_handles
        self._num_traces_merged_into_results = 0
        self._map_results = None
        self._map_results_file = None

        if jobs == AUTO_JOB_COUNT:
            jobs = multiprocessing.cpu_count()
        self._wq = threaded_work_queue.ThreadedWorkQueue(num_threads=jobs)
예제 #2
0
def RunMetricOnTraces(filenames, metrics, extra_import_options=None):
    trace_handles = [
        file_handle.URLFileHandle(f, 'file://%s' % f) for f in filenames
    ]
    job = _GetMetricRunnerHandle(metrics)
    runner = map_runner.MapRunner(
        trace_handles,
        job,
        extra_import_options=extra_import_options,
        progress_reporter=gtest_progress_reporter.GTestProgressReporter())
    map_results = runner.RunMapper()
    return map_results
예제 #3
0
def RunMetricOnTraceHandles(trace_handles, metrics, extra_import_options=None,
                            report_progress=True):
  job = _GetMetricRunnerHandle(metrics)
  with open(os.devnull, 'w') as devnull_f:
    o_stream = sys.stdout
    if not report_progress:
      o_stream = devnull_f

    runner = map_runner.MapRunner(
        trace_handles, job, extra_import_options=extra_import_options,
        progress_reporter=gtest_progress_reporter.GTestProgressReporter(
            output_stream=o_stream))
    map_results = runner.RunMapper()

  return map_results
예제 #4
0
def RunMetricOnTraces(filenames,
                      metrics,
                      extra_import_options=None,
                      report_progress=True):
    trace_handles = [
        file_handle.URLFileHandle(f, 'file://%s' % f) for f in filenames
    ]
    job = _GetMetricRunnerHandle(metrics)
    with open(os.devnull, 'w') as devnull_f:
        o_stream = sys.stdout
        if report_progress:
            o_stream = devnull_f

        runner = map_runner.MapRunner(
            trace_handles,
            job,
            extra_import_options=extra_import_options,
            progress_reporter=gtest_progress_reporter.GTestProgressReporter(
                output_stream=o_stream))
        map_results = runner.RunMapper()

    return map_results