Collect/use multicorejit app profile
[platform/core/dotnet/launcher.git] / NativeLauncher / launcher / exec / loader.cc
index e7e1a76..af74eae 100644 (file)
@@ -34,6 +34,7 @@ using tizen::runtime::dotnetcore::CoreRuntime;
 
 static const char* KEY_APP_TYPE = "--appType";
 static const char* KEY_TIZEN_UIFW = "TIZEN_UIFW";
+static const char* KEY_PROFILE = "--profile";
 
 static Ecore_Fd_Handler *__fd_handler;
 static loader_receiver_cb __receiver;
@@ -53,6 +54,9 @@ typedef struct AppInfo {
 } AppInfo;
 static AppInfo __appInfo;
 
+// Collect/use multicorejit profile or not
+static bool profile;
+
 
 //################## Code for running event loop for loader ####################
 
@@ -129,6 +133,19 @@ static void __loader_create_cb(bundle *extra, int type, void *user_data)
                _INFO("TIZEN_UIFW is set to %s", uifw);
        }
 
+       char *profile_str = NULL;
+       profile = false;
+       bundle_get_str(extra, KEY_PROFILE, &profile_str);
+       if (profile_str != NULL) {
+               if (!strcmp(profile_str, "true")) {
+                       profile = true;
+               } else if (!strcmp(profile_str, "false")) {
+                       profile = false;
+               } else {
+                       _DBG("PROFILE value %s not recognized. Valid values: true, false. Turn off PROFILE mode as default", profile_str);
+           }
+       }
+
        // initialize CoreRuntime (launchmode, dlog redirection enable, root path NULL)
        if (CoreRuntime::initialize(appType ? appType : "dotnet", LaunchMode::loader) != 0) {
                _ERR("Failed to initialized");
@@ -160,7 +177,7 @@ static int __loader_terminate_cb(int argc, char **argv, void *user_data)
        // The launchpad pass the name of exe file to the first argument.
        // For the C# spec, we have to skip this first argument.
        if (CoreRuntime::launch(__appInfo.appid.c_str(), __appInfo.root.c_str(),
-                                               __appInfo.app_path.c_str(), argc - 1, argv + 1)) {
+                                               __appInfo.app_path.c_str(), argc - 1, argv + 1, profile)) {
                _ERR("Failed to launch");
                return -1;
        }