| 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 aa11ff687b7e355e5954202dfcbc536cb331ed4d..74eb8cabdc0d448528c227e921303e2d0d5e9a0e 100644
|
| --- a/mojo/devtools/common/devtoolslib/perf_dashboard.py
|
| +++ b/mojo/devtools/common/devtoolslib/perf_dashboard.py
|
| @@ -13,14 +13,16 @@ See http://www.chromium.org/developers/speed-infra/performance-dashboard/sending
|
| import json
|
| from collections import defaultdict
|
|
|
| +
|
| class ChartDataRecorder(object):
|
| """Allows one to record measurement values one by one and then generate the
|
| JSON string that represents them in the 'chart_data' format expected by the
|
| performance dashboard.
|
| """
|
|
|
| - def __init__(self):
|
| + def __init__(self, benchmark_name):
|
| self.charts = defaultdict(list)
|
| + self.benchmark_name = benchmark_name
|
|
|
| def record_scalar(self, chart_name, value_name, units, value):
|
| """Records a single measurement value of a scalar type."""
|
| @@ -31,5 +33,11 @@ class ChartDataRecorder(object):
|
| 'value': value})
|
|
|
| def get_json(self):
|
| - """Returns the JSON string representing the recorded chart data."""
|
| - return json.dumps(self.charts)
|
| + """Returns the JSON string representing the recorded chart data, wrapping
|
| + it with the required meta data."""
|
| + chart_data = {
|
| + 'format_version': '1.0',
|
| + 'benchmark_name': self.benchmark_name,
|
| + 'charts': self.charts
|
| + }
|
| + return json.dumps(chart_data)
|
|
|