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."""
6from __future__ import print_function
7
8import ConfigParser
9import os
10
11from parse_result import parse_Panorama
12from parse_result import parse_Dex2oat
13from parse_result import parse_Hwui
14from parse_result import parse_Skia
15from parse_result import parse_Synthmark
16from parse_result import parse_Binder
17
18from set_flags import add_flags_Panorama
19from set_flags import add_flags_Dex2oat
20from set_flags import add_flags_Hwui
21from set_flags import add_flags_Skia
22from set_flags import add_flags_Synthmark
23from set_flags import add_flags_Binder
24
25home = os.environ['HOME']
26
27# Load user configurations for default envrionments
28env_config = ConfigParser.ConfigParser(allow_no_value=True)
29env_config.read('env_setting')
30
31def 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
41android_type = get_suite_env('android_type')
42
43# Android home directory specified as android_home,
44android_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
49bench_suite_dir = get_suite_env('bench_suite_dir', True)
50
51# Crosperf directory is used to generate crosperf report.
52toolchain_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.
56product_combo = get_suite_env('product_combo')
57
58# Arch can be found from out/target/product
59product = get_suite_env('product')
60
61# Benchmarks list is in following variables, you can change it adding new
62# benchmarks.
63bench_dict = {
64    'Panorama': 'packages/apps/LegacyCamera/benchmark/',
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
72bench_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
81bench_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
90bench_list = bench_dict.keys()
91
92# Directories used in the benchmark suite
93autotest_dir = 'external/autotest/'
94out_dir = os.path.join(android_home, 'out')
95