Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: tracing/tracing/metrics/metric_runner.py

Issue 3007063002: Plumb trace canonicalUrl through TelemetryInfo. (Closed)
Patch Set: fix trace_unittest Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/metrics/metric_map_function.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/metrics/metric_runner.py
diff --git a/tracing/tracing/metrics/metric_runner.py b/tracing/tracing/metrics/metric_runner.py
index 2da120488ed224941b5483bebb27c03f6026df3c..8886becf86068046fa5b538907e883a11902eb03 100644
--- a/tracing/tracing/metrics/metric_runner.py
+++ b/tracing/tracing/metrics/metric_runner.py
@@ -32,15 +32,17 @@ def _GetMetricRunnerHandle(metrics):
return job_module.Job(map_function_handle, None)
def RunMetric(filename, metrics, extra_import_options=None,
- report_progress=True):
- result = RunMetricOnTraces(
- [filename], metrics, extra_import_options, report_progress)
- return result[filename]
+ report_progress=True, canonical_url=None):
+ filename_url = 'file://' + filename
+ if canonical_url is None:
+ canonical_url = filename_url
+ trace_handle = file_handle.URLFileHandle(canonical_url, filename_url)
+ result = RunMetricOnTraceHandles(
+ [trace_handle], metrics, extra_import_options, report_progress)
+ return result[canonical_url]
-def RunMetricOnTraces(filenames, metrics,
- extra_import_options=None, report_progress=True):
- trace_handles = [
- file_handle.URLFileHandle(f, 'file://%s' % f) for f in filenames]
+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
@@ -54,3 +56,13 @@ def RunMetricOnTraces(filenames, metrics,
map_results = runner.RunMapper()
return map_results
+
+def RunMetricOnTraces(filenames, metrics,
+ extra_import_options=None, report_progress=True):
+ trace_handles = []
+ for filename in filenames:
+ filename_url = 'file://' + filename
+ trace_handles.append(file_handle.URLFileHandle(filename_url, filename_url))
+
+ return RunMetricOnTraceHandles(trace_handles, metrics, extra_import_options,
+ report_progress)
« no previous file with comments | « tracing/tracing/metrics/metric_map_function.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698