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

Side by Side Diff: mojo/devtools/common/devtoolslib/perf_dashboard.py

Issue 1406063002: Teach mojo_benchmark to produce chart_data for the perf dashboard. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase. Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/perf_dashboard_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # Disable the line-too-long warning.
6 # pylint: disable=C0301
7 """This module implements the Chromium Performance Dashboard JSON v1.0 data
8 format.
9
10 See http://www.chromium.org/developers/speed-infra/performance-dashboard/sending -data-to-the-performance-dashboard.
11 """
12
13 import json
14 from collections import defaultdict
15
16 class ChartDataRecorder(object):
17 """Allows one to record measurement values one by one and then generate the
18 JSON string that represents them in the 'chart_data' format expected by the
19 performance dashboard.
20 """
21
22 def __init__(self):
23 self.charts = defaultdict(list)
24
25 def record_scalar(self, chart_name, value_name, units, value):
26 """Records a single measurement value of a scalar type."""
27 self.charts[chart_name].append({
28 'type': 'scalar',
29 'name': value_name,
30 'units': units,
31 'value': value})
32
33 def get_json(self):
34 """Returns the JSON string representing the recorded chart data."""
35 return json.dumps(self.charts)
OLDNEW
« 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