summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2014-06-09 09:56:31 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-09 09:56:31 +0000
commitfb617aa82ad2b6671aa1bc37afa115418cd9091c (patch)
tree47a51a1524cb7dc6d2c6f20a4e8a29c3516f3890 /cmds
parent17cbadf0f598b0d02179262ad5b6b270850ccb94 (diff)
parent066423423f04bf1c5972b1d611e01e2e17df3727 (diff)
downloadframeworks_native-fb617aa82ad2b6671aa1bc37afa115418cd9091c.zip
frameworks_native-fb617aa82ad2b6671aa1bc37afa115418cd9091c.tar.gz
frameworks_native-fb617aa82ad2b6671aa1bc37afa115418cd9091c.tar.bz2
am 06642342: Merge "Don\'t always add profile-file option to dex2oat"
* commit '066423423f04bf1c5972b1d611e01e2e17df3727': Don't always add profile-file option to dex2oat
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 34a5353..8911570 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -625,6 +625,10 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
property_get("dalvik.vm.dex2oat-flags", dex2oat_flags, "");
ALOGV("dalvik.vm.dex2oat-flags=%s\n", dex2oat_flags);
+ char profiler_prop[PROPERTY_VALUE_MAX];
+ bool profiler = property_get("dalvik.vm.profiler", profiler_prop, "0")
+ && (profiler_prop[0] == '1');
+
static const char* DEX2OAT_BIN = "/system/bin/dex2oat";
static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig
static const unsigned int MAX_INSTRUCTION_SET_LEN = 32;
@@ -647,9 +651,17 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
sprintf(oat_fd_arg, "--oat-fd=%d", oat_fd);
sprintf(oat_location_arg, "--oat-location=%s", output_file_name);
sprintf(instruction_set_arg, "--instruction-set=%s", instruction_set);
- if (strcmp(pkgname, "*") != 0) {
- snprintf(profile_file_arg, sizeof(profile_file_arg), "--profile-file=%s/%s",
+
+ if (profiler && (strcmp(pkgname, "*") != 0)) {
+ char profile_file[PKG_PATH_MAX];
+ snprintf(profile_file, sizeof(profile_file), "%s/%s",
DALVIK_CACHE_PREFIX "profiles", pkgname);
+ struct stat st;
+ if (stat(profile_file, &st) == -1) {
+ strcpy(profile_file_arg, "--no-profile-file");
+ } else {
+ sprintf(profile_file_arg, "--profile-file=%s", profile_file);
+ }
} else {
strcpy(profile_file_arg, "--no-profile-file");
}