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

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

Issue 11348284: [telemetry] Adding --output-format option to enable more user-friendly output. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | « no previous file | tools/telemetry/telemetry/multi_page_benchmark_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/multi_page_benchmark.py
diff --git a/tools/telemetry/telemetry/multi_page_benchmark.py b/tools/telemetry/telemetry/multi_page_benchmark.py
index b24374cc09f2a64b6d9f8d6ab89646eb64aa93c2..a7a3d1179d10e08956a99a81fa771cf610b05a8b 100644
--- a/tools/telemetry/telemetry/multi_page_benchmark.py
+++ b/tools/telemetry/telemetry/multi_page_benchmark.py
@@ -86,21 +86,16 @@ results! You must return the same dict keys every time."""
PrintPerfResult(measurement, trace, values, units, data_type)
-class CsvBenchmarkResults(BenchmarkResults):
- def __init__(self, results_writer):
- super(CsvBenchmarkResults, self).__init__()
- self._results_writer = results_writer
- self._did_write_header = False
+class IncrementalBenchmarkResults(BenchmarkResults):
+ def __init__(self):
+ super(IncrementalBenchmarkResults, self).__init__()
+ self._did_process_header = False
def DidMeasurePage(self):
- super(CsvBenchmarkResults, self).DidMeasurePage()
+ super(IncrementalBenchmarkResults, self).DidMeasurePage()
- if not self._did_write_header:
- self._did_write_header = True
- row = ['url']
- for name in self.field_names:
- row.append('%s (%s)' % (name, self.field_units[name]))
- self._results_writer.writerow(row)
+ if not self._did_process_header:
+ self.ProcessHeader()
row = [self._page.url]
for name in self.field_names:
@@ -112,8 +107,46 @@ class CsvBenchmarkResults(BenchmarkResults):
row.append(_Mean(value))
else:
row.append(value)
+ self.OutputRow(row)
+
+ def OutputRow(self, row):
+ raise NotImplementedError()
+
+ def ProcessHeader(self):
+ raise NotImplementedError()
+
+class CsvBenchmarkResults(IncrementalBenchmarkResults):
+ def __init__(self, results_writer):
+ super(CsvBenchmarkResults, self).__init__()
+ self._results_writer = results_writer
+
+ def OutputRow(self, row):
self._results_writer.writerow(row)
+ def ProcessHeader(self):
+ self._did_process_header = True
+ row = ['url']
+ for name in self.field_names:
+ row.append('%s (%s)' % (name, self.field_units[name]))
+ self.OutputRow(row)
+
+class TerminalBlockBenchmarkResults(IncrementalBenchmarkResults):
+ def __init__(self, output_location):
+ super(TerminalBlockBenchmarkResults, self).__init__()
+ self._output_location = output_location
+ self._header_row = None
+
+ def OutputRow(self, row):
+ for i in range(len(row)):
+ print >> self._output_location, '%s:' % self._header_row[i], row[i]
+ print >> self._output_location
+
+ def ProcessHeader(self):
+ self._did_process_header = True
+ self._header_row = ['url']
+ for name in self.field_names:
+ self._header_row.append('%s (%s)' % (name, self.field_units[name]))
+
# TODO(nduca): Rename to page_benchmark
class MultiPageBenchmark(page_test.PageTest):
« no previous file with comments | « no previous file | tools/telemetry/telemetry/multi_page_benchmark_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698