Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 """Script to generate chromium.perf.json and chromium.perf.fyi.json in | 6 """Script to generate chromium.perf.json and chromium.perf.fyi.json in |
| 7 the src/testing/buildbot directory and benchmark.csv in the src/tools/perf | 7 the src/testing/buildbot directory and benchmark.csv in the src/tools/perf |
| 8 directory. Maintaining these files by hand is too unwieldy. | 8 directory. Maintaining these files by hand is too unwieldy. |
| 9 """ | 9 """ |
| 10 import argparse | 10 import argparse |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 799 all_tests = {} | 799 all_tests = {} |
| 800 for w in waterfalls: | 800 for w in waterfalls: |
| 801 tests = generate_all_tests(w) | 801 tests = generate_all_tests(w) |
| 802 tests_data = json.dumps(tests, indent=2, separators=(',', ': '), | 802 tests_data = json.dumps(tests, indent=2, separators=(',', ': '), |
| 803 sort_keys=True) | 803 sort_keys=True) |
| 804 config_file = get_json_config_file_for_waterfall(w) | 804 config_file = get_json_config_file_for_waterfall(w) |
| 805 with open(config_file, 'r') as fp: | 805 with open(config_file, 'r') as fp: |
| 806 config_data = fp.read().strip() | 806 config_data = fp.read().strip() |
| 807 all_tests.update(tests) | 807 all_tests.update(tests) |
| 808 up_to_date &= tests_data == config_data | 808 up_to_date &= tests_data == config_data |
| 809 verify_all_tests_in_benchmark_csv(all_tests, get_all_benchmarks_metadata()) | 809 verify_all_tests_in_benchmark_csv(all_tests, |
| 810 get_all_waterfall_benchmarks_metadata()) | |
| 810 return up_to_date | 811 return up_to_date |
| 811 | 812 |
| 812 | 813 |
| 813 def update_all_tests(waterfalls): | 814 def update_all_tests(waterfalls): |
| 814 all_tests = {} | 815 all_tests = {} |
| 815 for w in waterfalls: | 816 for w in waterfalls: |
| 816 tests = generate_all_tests(w) | 817 tests = generate_all_tests(w) |
| 817 config_file = get_json_config_file_for_waterfall(w) | 818 config_file = get_json_config_file_for_waterfall(w) |
| 818 with open(config_file, 'w') as fp: | 819 with open(config_file, 'w') as fp: |
| 819 json.dump(tests, fp, indent=2, separators=(',', ': '), sort_keys=True) | 820 json.dump(tests, fp, indent=2, separators=(',', ': '), sort_keys=True) |
| 820 fp.write('\n') | 821 fp.write('\n') |
| 821 all_tests.update(tests) | 822 all_tests.update(tests) |
| 822 verify_all_tests_in_benchmark_csv(all_tests, get_all_benchmarks_metadata()) | 823 verify_all_tests_in_benchmark_csv(all_tests, |
| 824 get_all_waterfall_benchmarks_metadata()) | |
| 823 | 825 |
| 824 | 826 |
| 825 def src_dir(): | 827 def src_dir(): |
| 826 file_path = os.path.abspath(__file__) | 828 file_path = os.path.abspath(__file__) |
| 827 return os.path.dirname(os.path.dirname( | 829 return os.path.dirname(os.path.dirname( |
| 828 os.path.dirname(os.path.dirname(file_path)))) | 830 os.path.dirname(os.path.dirname(file_path)))) |
| 829 | 831 |
| 830 | 832 |
| 831 BenchmarkMetadata = collections.namedtuple( | 833 BenchmarkMetadata = collections.namedtuple( |
| 832 'BenchmarkMetadata', 'emails component') | 834 'BenchmarkMetadata', 'emails component') |
| 833 NON_TELEMETRY_BENCHMARKS = { | 835 NON_TELEMETRY_BENCHMARKS = { |
| 834 'angle_perftests': BenchmarkMetadata('jmadill@chromium.org', None), | 836 'angle_perftests': BenchmarkMetadata('jmadill@chromium.org', None), |
| 835 'cc_perftests': BenchmarkMetadata('enne@chromium.org', None), | 837 'cc_perftests': BenchmarkMetadata('enne@chromium.org', None), |
| 836 'gpu_perftests': BenchmarkMetadata('reveman@chromium.org', None), | 838 'gpu_perftests': BenchmarkMetadata('reveman@chromium.org', None), |
| 837 'tracing_perftests': BenchmarkMetadata( | 839 'tracing_perftests': BenchmarkMetadata( |
| 838 'kkraynov@chromium.org, primiano@chromium.org', None), | 840 'kkraynov@chromium.org, primiano@chromium.org', None), |
| 839 'load_library_perf_tests': BenchmarkMetadata(None, None), | 841 'load_library_perf_tests': BenchmarkMetadata(None, None), |
| 840 'media_perftests': BenchmarkMetadata('crouleau@chromium.org', None), | 842 'media_perftests': BenchmarkMetadata('crouleau@chromium.org', None), |
| 841 'performance_browser_tests': BenchmarkMetadata( | 843 'performance_browser_tests': BenchmarkMetadata( |
| 842 'hubbe@chromium.org, justinlin@chromium.org, miu@chromium.org', None) | 844 'hubbe@chromium.org, justinlin@chromium.org, miu@chromium.org', None) |
| 843 } | 845 } |
| 844 | 846 |
| 845 | 847 |
| 846 # Returns a dictionary mapping benchmark name to benchmark owner metadata | 848 # If you change this dictionary, run tools/perf/generate_perf_data |
| 847 def get_all_benchmarks_metadata(): | 849 NON_WATERFALL_BENCHMARKS = { |
| 848 metadata = NON_TELEMETRY_BENCHMARKS | 850 'sizes (mac)': BenchmarkMetadata('tapted', None), |
|
nednguyen
2017/03/23 17:15:28
all these owner should be @chromium.org?
Maybe we
| |
| 851 'sizes (win)': BenchmarkMetadata('grt', None), | |
| 852 'sizes (linux)': BenchmarkMetadata('thestig', None), | |
| 853 'resource_sizes': BenchmarkMetadata('agrieve, rnephew, perezju', None) | |
| 854 } | |
| 855 | |
| 856 | |
| 857 # Returns a dictionary mapping waterfall benchmark name to benchmark owner | |
| 858 # metadata | |
| 859 def get_all_waterfall_benchmarks_metadata(): | |
| 860 return get_all_benchmarks_metadata(NON_TELEMETRY_BENCHMARKS) | |
| 861 | |
| 862 | |
| 863 def get_all_benchmarks_metadata(metadata): | |
| 849 benchmark_list = current_benchmarks(False) | 864 benchmark_list = current_benchmarks(False) |
| 850 | 865 |
| 851 for benchmark in benchmark_list: | 866 for benchmark in benchmark_list: |
| 852 emails = decorators.GetEmails(benchmark) | 867 emails = decorators.GetEmails(benchmark) |
| 853 if emails: | 868 if emails: |
| 854 emails = ', '.join(emails) | 869 emails = ', '.join(emails) |
| 855 metadata[benchmark.Name()] = BenchmarkMetadata( | 870 metadata[benchmark.Name()] = BenchmarkMetadata( |
| 856 emails, decorators.GetComponent(benchmark)) | 871 emails, decorators.GetComponent(benchmark)) |
| 857 return metadata | 872 return metadata |
| 858 | 873 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 890 | 905 |
| 891 Updates telemetry/perf/benchmark.csv containing the current benchmark names, | 906 Updates telemetry/perf/benchmark.csv containing the current benchmark names, |
| 892 owners, and components. | 907 owners, and components. |
| 893 """ | 908 """ |
| 894 header_data = [['AUTOGENERATED FILE DO NOT EDIT'], | 909 header_data = [['AUTOGENERATED FILE DO NOT EDIT'], |
| 895 ['See //tools/perf/generate_perf_data.py to make changes'], | 910 ['See //tools/perf/generate_perf_data.py to make changes'], |
| 896 ['Benchmark name', 'Individual owners', 'Component'] | 911 ['Benchmark name', 'Individual owners', 'Component'] |
| 897 ] | 912 ] |
| 898 | 913 |
| 899 csv_data = [] | 914 csv_data = [] |
| 900 benchmark_metadata = get_all_benchmarks_metadata() | 915 all_benchmarks = NON_TELEMETRY_BENCHMARKS |
| 916 all_benchmarks.update(NON_WATERFALL_BENCHMARKS) | |
| 917 benchmark_metadata = get_all_benchmarks_metadata(all_benchmarks) | |
| 901 for benchmark_name in benchmark_metadata: | 918 for benchmark_name in benchmark_metadata: |
| 902 csv_data.append([ | 919 csv_data.append([ |
| 903 benchmark_name, | 920 benchmark_name, |
| 904 benchmark_metadata[benchmark_name].emails, | 921 benchmark_metadata[benchmark_name].emails, |
| 905 benchmark_metadata[benchmark_name].component | 922 benchmark_metadata[benchmark_name].component |
| 906 ]) | 923 ]) |
| 907 | 924 |
| 908 csv_data = sorted(csv_data, key=lambda b: b[0]) | 925 csv_data = sorted(csv_data, key=lambda b: b[0]) |
| 909 csv_data = header_data + csv_data | 926 csv_data = header_data + csv_data |
| 910 | 927 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 938 return 0 | 955 return 0 |
| 939 else: | 956 else: |
| 940 print ('The perf JSON config files are not up-to-date. Please run %s ' | 957 print ('The perf JSON config files are not up-to-date. Please run %s ' |
| 941 'without --validate-only flag to update the perf JSON ' | 958 'without --validate-only flag to update the perf JSON ' |
| 942 'configs and benchmark.csv.') % sys.argv[0] | 959 'configs and benchmark.csv.') % sys.argv[0] |
| 943 return 1 | 960 return 1 |
| 944 else: | 961 else: |
| 945 update_all_tests([fyi_waterfall, waterfall]) | 962 update_all_tests([fyi_waterfall, waterfall]) |
| 946 update_benchmark_csv() | 963 update_benchmark_csv() |
| 947 return 0 | 964 return 0 |
| OLD | NEW |