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

Side by Side Diff: scripts/slave/recipe_modules/bisect_tester/parse_metric.py

Issue 2352203002: [Bisect] Account for tir_label-level summaries in parse_metric (Closed)
Patch Set: fix typo ~_~ Created 4 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/recipe_modules/auto_bisect/config_validation_test.py ('k') | 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 import math 1 import math
2 import re 2 import re
3 from functools import reduce 3 from functools import reduce
4 4
5 5
6 def _geom_mean_and_std_dev_from_histogram(histogram): # pragma: no cover 6 def _geom_mean_and_std_dev_from_histogram(histogram): # pragma: no cover
7 # Copied from: https://code.google.com/p/chromium/codesearch#chromium/build/sc ripts/common/chromium_utils.py&l=222 7 # Copied from: https://code.google.com/p/chromium/codesearch#chromium/build/sc ripts/common/chromium_utils.py&l=222
8 # TODO(robertocn): Remove this code duplication from common.chromium_utils 8 # TODO(robertocn): Remove this code duplication from common.chromium_utils
9 if not 'buckets' in histogram: 9 if not 'buckets' in histogram:
10 return 0.0, 0.0 10 return 0.0, 0.0
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 trace_name = 'summary' 50 trace_name = 'summary'
51 try: 51 try:
52 for chart in results['charts']: 52 for chart in results['charts']:
53 if escape_chars(chart) == chart_name: 53 if escape_chars(chart) == chart_name:
54 chart_name = chart # Unescaping 54 chart_name = chart # Unescaping
55 break 55 break
56 for trace in results['charts'][chart_name]: 56 for trace in results['charts'][chart_name]:
57 if escape_chars(trace) == trace_name: 57 if escape_chars(trace) == trace_name:
58 trace_name = trace # Unescaping 58 trace_name = trace # Unescaping
59 break 59 break
60
61 # This can happen if trace_name is meant to be a tir_label. This workaround
62 # is necessary because test paths are ambiguous, such that a 2-part test
63 # name can represent a tir_label-level summary or a story-level summary.
64 if trace_name not in results['charts'].get(chart_name, {}):
65 chart_name = trace_name + '@@' + chart_name
66 trace_name = 'summary'
67
60 if (results['charts'][chart_name][trace_name]['type'] == 68 if (results['charts'][chart_name][trace_name]['type'] ==
61 'list_of_scalar_values'): 69 'list_of_scalar_values'):
62 values = results['charts'][chart_name][trace_name]['values'] 70 values = results['charts'][chart_name][trace_name]['values']
63 if values: 71 if values:
64 avg_value = [sum(values) / len(values)] 72 avg_value = [sum(values) / len(values)]
65 return True, avg_value, results 73 return True, avg_value, results
66 if results['charts'][chart_name][trace_name]['type'] == 'histogram': 74 if results['charts'][chart_name][trace_name]['type'] == 'histogram':
67 return True, [_geom_mean_and_std_dev_from_histogram( 75 return True, [_geom_mean_and_std_dev_from_histogram(
68 results['charts'][chart_name][trace_name])[0]], results 76 results['charts'][chart_name][trace_name])[0]], results
69 except KeyError: # e.g. metric not found 77 except KeyError: # e.g. metric not found
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 histogram_values = eval(current_line) 182 histogram_values = eval(current_line)
175 183
176 for b in histogram_values['buckets']: 184 for b in histogram_values['buckets']:
177 average_for_bucket = float(b['high'] + b['low']) * 0.5 185 average_for_bucket = float(b['high'] + b['low']) * 0.5
178 # Extends the list with N-elements with the average for that bucket. 186 # Extends the list with N-elements with the average for that bucket.
179 values_list.extend([average_for_bucket] * b['count']) 187 values_list.extend([average_for_bucket] * b['count'])
180 except Exception: 188 except Exception:
181 pass 189 pass
182 190
183 return values_list 191 return values_list
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/auto_bisect/config_validation_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698