1# This configuration is written in python and used by app_profiler.py. 2 3import os 4import os.path 5 6# The name of the android package, like com.example.android. 7app_package_name = "com.example.android" 8 9 10# Path of android studio project. It is used to find debug version of native shared libraries. 11# Set to "" if not available. 12android_studio_project_dir = "" 13 14 15# Path to find debug version of native shared libraries. 16native_lib_dir = "" 17 18if android_studio_project_dir and not native_lib_dir: 19 tmp_dir = os.path.join(android_studio_project_dir, 20 "app/build/intermediates/binaries/debug".replace('/', os.sep)) 21 if os.path.isdir(tmp_dir): 22 native_lib_dir = tmp_dir 23 24 25# The path of the apk file. It is used when we need to reinstall the app to 26# fully compile dalvik bytecode into native instructions. 27# Set to "" if not available. 28apk_file_path = "" 29 30 31# To profile java code, we need to compile dalvik bytecode into native binaries 32# with debug information. Set to False if there is no need to do so (For example, 33# when the app has been recompiled.). 34recompile_app = True 35 36 37# If launch_activity is specified, we use `am start -n [app_package_name]/[launch_activity]` to start the app. 38launch_activity = '.MainActivity' 39 40# If launch_activity is not set, and launch_inst_test is, we launch an instrumentation test: 41# `am instrument -e class [launch_inst_test] [app_package_name]/android.support.test.runner.AndroidJUnitRunner` 42# Generally, will be of the form 'com.example.MyTestClass#myTestMethod' 43launch_inst_test = '' 44 45 46if recompile_app and not launch_activity and not launch_inst_test: 47 raise Exception('one of [launch_activity or launch_inst_test] is' 48 + 'needed for [recompile_app] to take effect.') 49 50 51# Profiling record options that will be passed directly to `simpleperf record` command on device. 52# As we can't stop profiling by Ctrl-C, we need to set how long to profile using "--duration". 53record_options = "-e cpu-cycles:u -f 4000 -g --dump-symbols --duration 10" 54 55 56# The path to store generated perf.data on host. 57perf_data_path = "perf.data" 58 59 60# The path of adb. 61adb_path = "adb" 62 63 64# The path of readelf, used to read build id of files in binary cache. 65# Set to "" if not available. 66readelf_path = "readelf" 67 68 69# binary_cache_dir is used to cache binaries pulled from device. To report precisely, we pull each 70# binary hit by perf.data on host. 71binary_cache_dir = "binary_cache" 72