Index: perf_insights/perf_insights/map_runner.py |
diff --git a/perf_insights/perf_insights/map_runner.py b/perf_insights/perf_insights/map_runner.py |
index e349e5d0130b8d8d12710d4a0e4e50ba6cb76e78..e66a330fb7b07b755a4fdab171bec91f51f069ca 100644 |
--- a/perf_insights/perf_insights/map_runner.py |
+++ b/perf_insights/perf_insights/map_runner.py |
@@ -14,11 +14,14 @@ from perf_insights import value as value_module |
from perf_insights.results import gtest_progress_reporter |
+import perf_insights_project |
+ |
+ |
AUTO_JOB_COUNT = 'auto-job-count' |
-class MapRunner: |
+class MapRunner(object): |
def __init__(self, trace_handles, map_function_handle, |
- stop_on_error=False, progress_reporter=None): |
+ stop_on_error=False, progress_reporter=None, vulcanize=True): |
self._map_function_handle = map_function_handle |
self._work_queue = queue.Queue() |
self._result_queue = queue.Queue() |
@@ -32,15 +35,15 @@ class MapRunner: |
self._progress_reporter = progress_reporter |
for trace_handle in trace_handles: |
self._work_queue.put(trace_handle) |
+ self._vulcanized_map_single_trace = None |
+ self._single_trace_mapper = map_single_trace.SingleTraceMapper(vulcanize) |
def _ProcessTrace(self, trace_handle): |
run_info = trace_handle.run_info |
subresults = results_module.Results() |
run_reporter = self._progress_reporter.WillRun(run_info) |
- map_single_trace.MapSingleTrace( |
- subresults, |
- trace_handle, |
- self._map_function_handle) |
+ self._single_trace_mapper.MapSingleTrace( |
+ subresults, trace_handle, self._map_function_handle) |
for v in subresults.all_values: |
run_reporter.DidAddValue(v) |
self._result_queue.put(subresults) |
@@ -56,6 +59,12 @@ class MapRunner: |
self._work_queue.task_done() |
def Run(self, jobs=1, output_formatters=None): |
+ try: |
+ return self._RunMapTraceJobs(jobs, output_formatters) |
+ finally: |
+ self._single_trace_mapper.CleanUp() |
+ |
+ def _RunMapTraceJobs(self, jobs, output_formatters): |
if jobs == AUTO_JOB_COUNT: |
jobs = multiprocessing.cpu_count() |