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

Side by Side Diff: scripts/slave/telemetry_utils.py

Issue 545803002: Update buildbots to parse new telemetry JSON format. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Addressed review comments Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « scripts/slave/telemetry.py ('k') | scripts/slave/unittests/results_dashboard_test.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 #! /usr/bin/env python
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5 # pylint: disable=R0201
6
7 """Log parsing for telemetry tests."""
8
9 import json
10 import logging
11 import os
12 import tempfile
13
14
15 class TelemetryResultsTracker(object):
16
17 def __init__(self):
18 self._chart_filename = None
19 self._ref_chart_filename = None
20
21 def GetArguments(self):
22 if not self._chart_filename:
23 (handle, self._chart_filename) = tempfile.mkstemp()
24 os.close(handle)
25 if not self._ref_chart_filename:
26 (handle, self._ref_chart_filename) = tempfile.mkstemp()
27 os.close(handle)
28 return (['--chart-output-filename', self._chart_filename,
29 '--ref-output-filename', self._ref_chart_filename])
30
31 def _GetFileJson(self, filename):
32 try:
33 return json.loads(open(filename).read())
34 except (IOError, ValueError):
35 logging.error('Error reading telemetry results from %s', filename)
36 return None
37
38 def ChartJson(self):
39 return self._GetFileJson(self._chart_filename)
40
41 def RefJson(self):
42 return self._GetFileJson(self._ref_chart_filename)
43
44 def Cleanup(self):
45 try:
46 os.remove(self._chart_filename)
47 except OSError:
48 pass
49 try:
50 os.remove(self._ref_chart_filename)
51 except OSError:
52 pass
53
54 def IsChartJson(self):
55 """This is the new telemetry --chartjson output format."""
56 return True
57
58 def ProcessLine(self, line):
59 pass
60
61 def FailedTests(self):
62 return []
63
64 def SuppressionHashes(self): # pylint: disable=R0201
65 return []
66
67 def ParsingErrors(self): # pylint: disable=R0201
68 return []
69
70 def PerformanceSummary(self):
71 return ''
OLDNEW
« no previous file with comments | « scripts/slave/telemetry.py ('k') | scripts/slave/unittests/results_dashboard_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698