Set collect delay when profile data does not exist
authorWoongsuk Cho <ws77.cho@samsung.com>
Tue, 26 Apr 2022 00:17:52 +0000 (09:17 +0900)
committer조웅석/Common Platform Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Fri, 29 Apr 2022 00:33:20 +0000 (09:33 +0900)
NativeLauncher/launcher/lib/core_runtime.cc

index f11aa79..c2fca03 100644 (file)
@@ -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);