Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9fe624f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Handle the boot profile format when analyzing profiles" am: dbd5b432

Change-Id: I6657784360dc5c5b16f6c25c773d3e8fab761c67
parents 26fa117f dbd5b432
Loading
Loading
Loading
Loading
+27 −10
Original line number Diff line number Diff line
@@ -318,6 +318,16 @@ static const char* kJitZygoteImage =
// Phenotype property name for enabling profiling the boot class path.
static const char* PROFILE_BOOT_CLASS_PATH = "profilebootclasspath";

static bool IsBootClassPathProfilingEnable() {
    std::string profile_boot_class_path = GetProperty("dalvik.vm.profilebootclasspath", "");
    profile_boot_class_path =
        server_configurable_flags::GetServerConfigurableFlag(
            RUNTIME_NATIVE_BOOT_NAMESPACE,
            PROFILE_BOOT_CLASS_PATH,
            /*default_value=*/ profile_boot_class_path);
    return profile_boot_class_path == "true";
}

class RunDex2Oat : public ExecVHelper {
  public:
    RunDex2Oat(int zip_fd,
@@ -450,14 +460,7 @@ class RunDex2Oat : public ExecVHelper {
                                                                 ENABLE_JITZYGOTE_IMAGE,
                                                                 /*default_value=*/ "");

        std::string profile_boot_class_path = GetProperty("dalvik.vm.profilebootclasspath", "");
        profile_boot_class_path =
            server_configurable_flags::GetServerConfigurableFlag(
                RUNTIME_NATIVE_BOOT_NAMESPACE,
                PROFILE_BOOT_CLASS_PATH,
                /*default_value=*/ profile_boot_class_path);

        if (use_jitzygote_image == "true" || profile_boot_class_path == "true") {
        if (use_jitzygote_image == "true" || IsBootClassPathProfilingEnable()) {
          boot_image = StringPrintf("--boot-image=%s", kJitZygoteImage);
        } else {
          boot_image = MapPropertyToArg("dalvik.vm.boot-image", "--boot-image=%s");
@@ -896,7 +899,15 @@ static bool analyze_profiles(uid_t uid, const std::string& package_name,
    }

    RunProfman profman_merge;
    profman_merge.SetupMerge(profiles_fd, reference_profile_fd);
    const std::vector<unique_fd>& apk_fds = std::vector<unique_fd>();
    const std::vector<std::string>& dex_locations = std::vector<std::string>();
    profman_merge.SetupMerge(
            profiles_fd,
            reference_profile_fd,
            apk_fds,
            dex_locations,
            /* for_snapshot= */ false,
            IsBootClassPathProfilingEnable());
    pid_t pid = fork();
    if (pid == 0) {
        /* child -- drop privileges before continuing */
@@ -2810,7 +2821,13 @@ static bool create_app_profile_snapshot(int32_t app_id,
    }

    RunProfman args;
    args.SetupMerge(profiles_fd, snapshot_fd, apk_fds, dex_locations, /*for_snapshot=*/true);
    // This is specifically a snapshot for an app, so don't use boot image profiles.
    args.SetupMerge(profiles_fd,
            snapshot_fd,
            apk_fds,
            dex_locations,
            /* for_snapshot= */ true,
            /* for_boot_image= */ false);
    pid_t pid = fork();
    if (pid == 0) {
        /* child -- drop privileges before continuing */