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

Unified Diff: mojo/devtools/common/devtoolslib/perf_dashboard.py

Issue 1422983002: Fix format produced by chart data recorder. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | mojo/devtools/common/devtoolslib/perf_dashboard_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/devtoolslib/perf_dashboard.py
diff --git a/mojo/devtools/common/devtoolslib/perf_dashboard.py b/mojo/devtools/common/devtoolslib/perf_dashboard.py
index 68d87a3db4e0342aa30d25dc49e87a803fff5409..defb54d8b431b68326285f3106e92beab8cc5253 100644
--- a/mojo/devtools/common/devtoolslib/perf_dashboard.py
+++ b/mojo/devtools/common/devtoolslib/perf_dashboard.py
@@ -10,7 +10,6 @@ format.
See http://www.chromium.org/developers/speed-infra/performance-dashboard/sending-data-to-the-performance-dashboard.
"""
-from collections import defaultdict
import httplib
import json
import pprint
@@ -28,18 +27,19 @@ class ChartDataRecorder(object):
"""
def __init__(self, benchmark_name):
- self.charts = defaultdict(list)
+ self.charts = {}
self.benchmark_name = benchmark_name
def record_scalar(self, chart_name, value_name, units, value):
"""Records a single measurement value of a scalar type."""
- self.charts[chart_name].append({
+ if chart_name not in self.charts:
+ self.charts[chart_name] = {}
+ self.charts[chart_name][value_name] = {
'type': 'scalar',
- 'name': value_name,
'units': units,
- 'value': value})
+ 'value': value}
- def get_json(self):
+ def get_chart_data(self):
"""Returns the JSON string representing the recorded chart data, wrapping
it with the required meta data."""
chart_data = {
@@ -47,7 +47,7 @@ class ChartDataRecorder(object):
'benchmark_name': self.benchmark_name,
'charts': self.charts
}
- return json.dumps(chart_data)
+ return chart_data
def add_argparse_server_arguments(parser):
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/perf_dashboard_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698