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

Unified Diff: tools/perf_expectations/make_expectations.py

Issue 7942011: Support setting 'better' and using it in expectations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/perf_expectations/perf_expectations.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf_expectations/make_expectations.py
diff --git a/tools/perf_expectations/make_expectations.py b/tools/perf_expectations/make_expectations.py
index f73383dba650c5ff4dea61fd822c0fab0a56f177..aee5f4c5eafa5171569ca4bc1eb975a824122f3d 100755
--- a/tools/perf_expectations/make_expectations.py
+++ b/tools/perf_expectations/make_expectations.py
@@ -79,7 +79,7 @@ def GetRowData(data, key):
if subkey in data[key]:
rowdata.append('"%s": %s' % (subkey, data[key][subkey]))
# Strings, like type, come next.
- for subkey in ['type']:
+ for subkey in ['type', 'better']:
if subkey in data[key]:
rowdata.append('"%s": "%s"' % (subkey, data[key][subkey]))
# Finally the main numbers come last.
@@ -160,6 +160,7 @@ def Main(args):
for key in perfkeys:
value = perf[key]
tolerance = value.get('tolerance', DEFAULT_TOLERANCE)
+ better = value.get('better', None)
# Verify the checksum.
original_checksum = value.get('sha1', '')
@@ -267,21 +268,32 @@ def Main(args):
regress = float(trace_values[tracename]['high'])
improve = float(trace_values[tracename]['low'])
- # At this point, regress > improve. If regress == improve, we adjust
- # improve so it is just a little less than regress. I'm picking on improve
- # so we keep the sizes assumptions in place for now.
- if regress == improve:
- improve = float(regress * 0.99)
+ # So far we've assumed better is lower (regress > improve). If the actual
+ # values for regress and improve are equal, though, and better was not
+ # specified, alert the user so we don't let them create a new file with
+ # ambiguous rules.
+ if better == None and regress == improve:
+ OutputMessage('regress (%s) is equal to improve (%s), and "better" is '
+ 'unspecified, please fix by setting "better": "lower" or '
+ '"better": "higher" in this perf trace\'s expectation' % (
+ regress, improve), verbose_message=False)
+ return 1
# If the existing values assume regressions are low deltas relative to
# improvements, swap our regress and improve. This value must be a
# scores-like result.
if ('regress' in perf[key] and 'improve' in perf[key] and
perf[key]['regress'] < perf[key]['improve']):
+ assert(better != 'lower')
+ better = 'higher'
temp = regress
regress = improve
improve = temp
- if regress < improve:
+ else:
+ assert(better != 'higher')
+ better = 'lower'
+
+ if better == 'higher':
regress = int(math.floor(regress - abs(regress*tolerance)))
improve = int(math.ceil(improve + abs(improve*tolerance)))
else:
« no previous file with comments | « no previous file | tools/perf_expectations/perf_expectations.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698