Chromium Code Reviews

Unified Diff: tools/telemetry/telemetry/block_page_benchmark_results.py

Issue 11779041: [telemetry] Add support for BenchmarkResults that vary from page to page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nitfix Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | tools/telemetry/telemetry/block_page_benchmark_results_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/block_page_benchmark_results.py
diff --git a/tools/telemetry/telemetry/block_page_benchmark_results.py b/tools/telemetry/telemetry/block_page_benchmark_results.py
new file mode 100644
index 0000000000000000000000000000000000000000..f76394cd9058cf3bef617d79e999cb914e3a914f
--- /dev/null
+++ b/tools/telemetry/telemetry/block_page_benchmark_results.py
@@ -0,0 +1,32 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import os
+
+from telemetry.page_benchmark_results import PageBenchmarkResults
+
+class BlockPageBenchmarkResults(PageBenchmarkResults):
+ def __init__(self, output_file):
+ super(BlockPageBenchmarkResults, self).__init__()
+ self._output_file = output_file
+
+ def DidMeasurePage(self):
+ page_values = self.values_for_current_page
+
+ lines = ['url: %s' %
+ self.values_for_current_page.page.url]
+ sorted_measurement_names = page_values.measurement_names
+ sorted_measurement_names.sort()
+
+ for measurement_name in sorted_measurement_names:
+ value = page_values.FindValueByMeasurementName(measurement_name)
+ lines.append('%s (%s): %s' %
+ (measurement_name,
+ value.units,
+ value.output_value))
+ for line in lines:
+ self._output_file.write(line)
+ self._output_file.write(os.linesep)
+ self._output_file.write(os.linesep)
+
+ super(BlockPageBenchmarkResults, self).DidMeasurePage()
« no previous file with comments | « no previous file | tools/telemetry/telemetry/block_page_benchmark_results_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine