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

Side by Side Diff: tools/perf/generate_legacy_perf_dashboard_json.py

Issue 2570593005: Strip units string in legacy perf dashboard JSON generator (Closed)
Patch Set: fix incantation Created 4 years 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ Generates legacy perf dashboard json from non-telemetry based perf tests. 6 """ Generates legacy perf dashboard json from non-telemetry based perf tests.
7 Taken from chromium/build/scripts/slave/performance_log_processory.py 7 Taken from chromium/build/scripts/slave/performance_log_processory.py
8 (https://goo.gl/03SQRk) 8 (https://goo.gl/03SQRk)
9 """ 9 """
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 """Processes a line that matches the standard RESULT line format. 132 """Processes a line that matches the standard RESULT line format.
133 133
134 Args: 134 Args:
135 line_match: A MatchObject as returned by re.search. 135 line_match: A MatchObject as returned by re.search.
136 """ 136 """
137 match_dict = line_match.groupdict() 137 match_dict = line_match.groupdict()
138 graph_name = match_dict['GRAPH'].strip() 138 graph_name = match_dict['GRAPH'].strip()
139 trace_name = match_dict['TRACE'].strip() 139 trace_name = match_dict['TRACE'].strip()
140 140
141 graph = self._graphs.get(graph_name, self.Graph()) 141 graph = self._graphs.get(graph_name, self.Graph())
142 graph.units = match_dict['UNITS'] or '' 142 graph.units = (match_dict['UNITS'] or '').strip()
143 trace = graph.traces.get(trace_name, self.Trace()) 143 trace = graph.traces.get(trace_name, self.Trace())
144 trace.value = match_dict['VALUE'] 144 trace.value = match_dict['VALUE']
145 trace.important = match_dict['IMPORTANT'] or False 145 trace.important = match_dict['IMPORTANT'] or False
146 146
147 # Compute the mean and standard deviation for a list or a histogram, 147 # Compute the mean and standard deviation for a list or a histogram,
148 # or the numerical value of a scalar value. 148 # or the numerical value of a scalar value.
149 if trace.value.startswith('['): 149 if trace.value.startswith('['):
150 try: 150 try:
151 value_list = [float(x) for x in trace.value.strip('[],').split(',')] 151 value_list = [float(x) for x in trace.value.strip('[],').split(',')]
152 except ValueError: 152 except ValueError:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 digits *= 10 248 digits *= 10
249 exponent -= 1 249 exponent -= 1
250 while exponent < -3: 250 while exponent < -3:
251 digits /= 10 251 digits /= 10
252 exponent += 1 252 exponent += 1
253 if digits >= 100: 253 if digits >= 100:
254 # Don't append a meaningless '.0' to an integer number. 254 # Don't append a meaningless '.0' to an integer number.
255 digits = int(digits) 255 digits = int(digits)
256 # Exponent is now divisible by 3, between -3 and 6 inclusive: (-3, 0, 3, 6). 256 # Exponent is now divisible by 3, between -3 and 6 inclusive: (-3, 0, 3, 6).
257 return '%s%s' % (digits, metric_prefixes[exponent]) 257 return '%s%s' % (digits, metric_prefixes[exponent])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698