1 # Copyright 2017 The Chromium OS Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 """Configuration file for the benchmark suite.""" 6 from __future__ import print_function 7 8 import ConfigParser 9 import os 10 11 from parse_result import parse_Panorama 12 from parse_result import parse_Dex2oat 13 from parse_result import parse_Hwui 14 from parse_result import parse_Skia 15 from parse_result import parse_Synthmark 16 from parse_result import parse_Binder 17 18 from set_flags import add_flags_Panorama 19 from set_flags import add_flags_Dex2oat 20 from set_flags import add_flags_Hwui 21 from set_flags import add_flags_Skia 22 from set_flags import add_flags_Synthmark 23 from set_flags import add_flags_Binder 24 25 home = os.environ['HOME'] 26 27 # Load user configurations for default envrionments 28 env_config = ConfigParser.ConfigParser(allow_no_value=True) 29 env_config.read('env_setting') 30 31 def get_suite_env(name, path=False): 32 variable = env_config.get('Suite_Environment', name) 33 if variable: 34 if path and not os.path.isdir(variable): 35 raise ValueError('The path of %s does not exist.' % name) 36 return variable 37 else: 38 raise ValueError('Please specify %s in env_setting' % name) 39 40 # Android source code type: internal or aosp 41 android_type = get_suite_env('android_type') 42 43 # Android home directory specified as android_home, 44 android_home = get_suite_env('android_home', True) 45 46 # The benchmark results will be saved in bench_suite_dir. 47 # Please create a directory to store the results, default directory is 48 # android_home/benchtoolchain 49 bench_suite_dir = get_suite_env('bench_suite_dir', True) 50 51 # Crosperf directory is used to generate crosperf report. 52 toolchain_utils = get_suite_env('toolchain_utils', True) 53 54 # Please change both product and architecture at same time 55 # Product can be chosen from the lunch list of android building. 56 product_combo = get_suite_env('product_combo') 57 58 # Arch can be found from out/target/product 59 product = get_suite_env('product') 60 61 # Benchmarks list is in following variables, you can change it adding new 62 # benchmarks. 63 bench_dict = { 64 'Panorama': 'packages/apps/LegacyCamera/jni/', 65 'Dex2oat': 'art/compiler/', 66 'Hwui': 'frameworks/base/libs/hwui/', 67 'Skia': 'external/skia/', 68 'Synthmark': 'synthmark/', 69 'Binder': 'frameworks/native/libs/binder/', 70 } 71 72 bench_parser_dict = { 73 'Panorama': parse_Panorama, 74 'Dex2oat': parse_Dex2oat, 75 'Hwui': parse_Hwui, 76 'Skia': parse_Skia, 77 'Synthmark': parse_Synthmark, 78 'Binder': parse_Binder, 79 } 80 81 bench_flags_dict = { 82 'Panorama': add_flags_Panorama, 83 'Dex2oat': add_flags_Dex2oat, 84 'Hwui': add_flags_Hwui, 85 'Skia': add_flags_Skia, 86 'Synthmark': add_flags_Synthmark, 87 'Binder': add_flags_Binder, 88 } 89 90 bench_list = bench_dict.keys() 91 92 # Directories used in the benchmark suite 93 autotest_dir = 'external/autotest/' 94 out_dir = os.path.join(android_home, 'out') 95