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

Unified Diff: tools/telemetry/telemetry/results/output_formatter.py

Issue 416993008: Introduce OutputFormatter interface and wire it through PageTestResults. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, address review comments. Created 6 years, 5 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
Index: tools/telemetry/telemetry/results/output_formatter.py
diff --git a/tools/telemetry/telemetry/results/output_formatter.py b/tools/telemetry/telemetry/results/output_formatter.py
new file mode 100644
index 0000000000000000000000000000000000000000..cd6e330b84aacde40d475a9d9e254a9d7f8c79bc
--- /dev/null
+++ b/tools/telemetry/telemetry/results/output_formatter.py
@@ -0,0 +1,33 @@
+# Copyright 2014 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.
+
+
+class OutputFormatter(object):
+ """A formatter for PageTestResults.
+
+ An OutputFormatter takes PageTestResults, formats the results
+ (telemetry.value.Value instances), and output the formatted results
+ in the given output stream.
+
+ Examples of output formatter: CsvOutputFormatter produces results in
+ CSV format."""
+
+ def __init__(self, output_stream):
+ """Constructs a new formatter that writes to the output_stream.
+
+ Args:
+ output_stream: The stream to write the formatted output to.
+ """
+ self.output_stream = output_stream
+
+ def Format(self, page_test_results):
+ """Formats the given PageTestResults into the output stream.
+
+ This will be called once at the end of a benchmark.
+
+ Args:
+ page_test_results: A PageTestResults object containing all results
+ from the current benchmark run.
+ """
+ raise NotImplementedError()

Powered by Google App Engine
This is Rietveld 408576698