Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 """Performance Test Bisect Tool | 6 """Performance Test Bisect Tool |
| 7 | 7 |
| 8 This script bisects a series of changelists using binary search. It starts at | 8 This script bisects a series of changelists using binary search. It starts at |
| 9 a bad revision where a performance metric has regressed, and asks for a last | 9 a bad revision where a performance metric has regressed, and asks for a last |
| 10 known-good revision. It will then binary search across this revision range by | 10 known-good revision. It will then binary search across this revision range by |
| (...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1946 """ | 1946 """ |
| 1947 # Format is: RESULT <graph>: <trace>= <value> <units> | 1947 # Format is: RESULT <graph>: <trace>= <value> <units> |
| 1948 metric_formatted = re.escape('RESULT %s: %s=' % (metric[0], metric[1])) | 1948 metric_formatted = re.escape('RESULT %s: %s=' % (metric[0], metric[1])) |
| 1949 | 1949 |
| 1950 text_lines = text.split('\n') | 1950 text_lines = text.split('\n') |
| 1951 values_list = [] | 1951 values_list = [] |
| 1952 | 1952 |
| 1953 for current_line in text_lines: | 1953 for current_line in text_lines: |
| 1954 # Parse the output from the performance test for the metric we're | 1954 # Parse the output from the performance test for the metric we're |
| 1955 # interested in. | 1955 # interested in. |
| 1956 # The log will be parsed looking for format: | |
| 1957 # <*>RESULT <graph_name>: <trace_name>= <value> | |
| 1956 metric_re = metric_formatted +\ | 1958 metric_re = metric_formatted +\ |
| 1957 "(\s)*(?P<values>[0-9]+(\.[0-9]*)?)" | 1959 "(\s)*(?P<values>[0-9]+(\.[0-9]*)?)" |
| 1958 metric_re = re.compile(metric_re) | 1960 metric_re = re.compile(metric_re) |
| 1959 regex_results = metric_re.search(current_line) | 1961 regex_results = metric_re.search(current_line) |
| 1960 | 1962 |
| 1961 if not regex_results is None: | 1963 if not regex_results is None: |
| 1962 values_list += [regex_results.group('values')] | 1964 values_list += [regex_results.group('values')] |
| 1963 else: | 1965 else: |
| 1966 # The log will be parsed looking for format: | |
| 1967 # <*>RESULT <graph_name>: <trace_name>= [<value>,value,value,...] | |
| 1964 metric_re = metric_formatted +\ | 1968 metric_re = metric_formatted +\ |
| 1965 "(\s)*\[(\s)*(?P<values>[0-9,.]+)\]" | 1969 "(\s)*\[(\s)*(?P<values>[0-9,.]+)\]" |
| 1966 metric_re = re.compile(metric_re) | 1970 metric_re = re.compile(metric_re) |
| 1967 regex_results = metric_re.search(current_line) | 1971 regex_results = metric_re.search(current_line) |
| 1968 | 1972 |
| 1969 if not regex_results is None: | 1973 if not regex_results is None: |
| 1970 metric_values = regex_results.group('values') | 1974 metric_values = regex_results.group('values') |
| 1971 | 1975 |
| 1972 values_list += metric_values.split(',') | 1976 values_list += metric_values.split(',') |
| 1977 else: | |
| 1978 # The log will be parsed looking for format: | |
| 1979 # <*>RESULT <graph_name>: <trace_name>= {<mean>, <std deviation>} | |
|
qyearsley
2014/05/14 22:28:33
It would probably be neater/more readable to put t
prasadv
2014/05/15 19:49:09
Agreed, tried to trim this method and make it more
| |
| 1980 metric_re = metric_formatted +\ | |
| 1981 "(\s)*\{(\s)*(?P<values>[-\d\., ]+)\}" | |
| 1982 metric_re = re.compile(metric_re) | |
| 1983 regex_results = metric_re.search(current_line) | |
| 1984 if not regex_results is None: | |
| 1985 metric_values = regex_results.group('values') | |
| 1986 if metric_values: | |
| 1987 # Here we are interested only in mean. | |
| 1988 values_list += [metric_values.split(',')[0]] | |
| 1973 | 1989 |
| 1974 values_list = [float(v) for v in values_list if IsStringFloat(v)] | 1990 values_list = [float(v) for v in values_list if IsStringFloat(v)] |
| 1975 | 1991 |
| 1976 # If the metric is times/t, we need to sum the timings in order to get | 1992 # If the metric is times/t, we need to sum the timings in order to get |
| 1977 # similar regression results as the try-bots. | 1993 # similar regression results as the try-bots. |
| 1978 metrics_to_sum = [['times', 't'], ['times', 'page_load_time'], | 1994 metrics_to_sum = [['times', 't'], ['times', 'page_load_time'], |
| 1979 ['cold_times', 'page_load_time'], ['warm_times', 'page_load_time']] | 1995 ['cold_times', 'page_load_time'], ['warm_times', 'page_load_time']] |
| 1980 | 1996 |
| 1981 if metric in metrics_to_sum: | 1997 if metric in metrics_to_sum: |
| 1982 if values_list: | 1998 if values_list: |
| (...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3893 # The perf dashboard scrapes the "results" step in order to comment on | 3909 # The perf dashboard scrapes the "results" step in order to comment on |
| 3894 # bugs. If you change this, please update the perf dashboard as well. | 3910 # bugs. If you change this, please update the perf dashboard as well. |
| 3895 bisect_utils.OutputAnnotationStepStart('Results') | 3911 bisect_utils.OutputAnnotationStepStart('Results') |
| 3896 print 'Error: %s' % e.message | 3912 print 'Error: %s' % e.message |
| 3897 if opts.output_buildbot_annotations: | 3913 if opts.output_buildbot_annotations: |
| 3898 bisect_utils.OutputAnnotationStepClosed() | 3914 bisect_utils.OutputAnnotationStepClosed() |
| 3899 return 1 | 3915 return 1 |
| 3900 | 3916 |
| 3901 if __name__ == '__main__': | 3917 if __name__ == '__main__': |
| 3902 sys.exit(main()) | 3918 sys.exit(main()) |
| OLD | NEW |