From 1d4be53cffbd0159bee69b56cd44a3720f34c60a Mon Sep 17 00:00:00 2001 From: Woongsuk Cho Date: Tue, 26 Apr 2022 09:17:52 +0900 Subject: [PATCH] Set collect delay when profile data does not exist --- NativeLauncher/launcher/lib/core_runtime.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/NativeLauncher/launcher/lib/core_runtime.cc b/NativeLauncher/launcher/lib/core_runtime.cc index f11aa79..c2fca03 100644 --- a/NativeLauncher/launcher/lib/core_runtime.cc +++ b/NativeLauncher/launcher/lib/core_runtime.cc @@ -574,19 +574,20 @@ int CoreRuntime::launch(const char* appId, const char* root, const char* path, i setEnvironmentVariable("COMPlus_MultiCoreJitProfile", multiCoreJitProfile); setEnvironmentVariable("COMPlus_MultiCoreJitMinNumCpus", "1"); - // stop profiling and write collected data after delay if env value is set. - char *env = getenv("CLR_MCJ_PROFILE_WRITE_DELAY"); - if (env != nullptr) { - int delay = std::atoi(env); - // To avoid undefined behavior by out-of-range input(atoi), set max delay value to 100. - if (delay > 0) { - if (delay > MAX_DELAY_SEC) delay = MAX_DELAY_SEC; - stopProfileAfterDelay(delay); - } - } - if (exist(multiCoreJitProfile)) { setEnvironmentVariable("COMPlus_MultiCoreJitNoProfileGather", "1"); + } else { + setEnvironmentVariable("COMPlus_MultiCoreJitNoProfileGather", "0"); + // stop profiling and write collected data after delay if env value is set. + char *env = getenv("CLR_MCJ_PROFILE_WRITE_DELAY"); + if (env != nullptr) { + int delay = std::atoi(env); + // To avoid undefined behavior by out-of-range input(atoi), set max delay value to 100. + if (delay > 0) { + if (delay > MAX_DELAY_SEC) delay = MAX_DELAY_SEC; + stopProfileAfterDelay(delay); + } + } } } free(localDataPath); -- 2.7.4