From: Timur Mustafin Date: Thu, 22 Apr 2021 22:56:28 +0000 (+0300) Subject: Collect/use multicorejit app profile X-Git-Tag: submit/tizen/20210623.065708~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=de26260d3da47644dd933cc11b67aff96aaf068b;p=platform%2Fcore%2Fdotnet%2Flauncher.git Collect/use multicorejit app profile Turn off --profile mode for default build Signed-off-by: Timur Mustafin --- diff --git a/NativeLauncher/dotnet-nui.launcher b/NativeLauncher/dotnet-nui.launcher index 6226c1d..311084d 100644 --- a/NativeLauncher/dotnet-nui.launcher +++ b/NativeLauncher/dotnet-nui.launcher @@ -3,5 +3,6 @@ NAME dotnet-nui-launcher EXE /usr/bin/dotnet-launcher APP_TYPE dotnet-nui EXTRA_ARG --PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE +# EXTRA_ARG --profile EXTRA_ARG --standalone diff --git a/NativeLauncher/dotnet-nui.loader b/NativeLauncher/dotnet-nui.loader index 7e714cd..17b5125 100644 --- a/NativeLauncher/dotnet-nui.loader +++ b/NativeLauncher/dotnet-nui.loader @@ -8,3 +8,4 @@ ON_BOOT OFF HYDRA OFF EXTRA --appType dotnet-nui EXTRA TIZEN_UIFW NUI +EXTRA --profile false diff --git a/NativeLauncher/dotnet.launcher b/NativeLauncher/dotnet.launcher index 4bcd42d..f9a89c0 100644 --- a/NativeLauncher/dotnet.launcher +++ b/NativeLauncher/dotnet.launcher @@ -3,6 +3,7 @@ NAME dotnet-launcher EXE /usr/bin/dotnet-launcher APP_TYPE dotnet EXTRA_ARG --PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE +# EXTRA_ARG --profile EXTRA_ARG --appType EXTRA_ARG dotnet EXTRA_ARG --standalone diff --git a/NativeLauncher/dotnet.loader b/NativeLauncher/dotnet.loader index 94a3b37..573db41 100644 --- a/NativeLauncher/dotnet.loader +++ b/NativeLauncher/dotnet.loader @@ -11,3 +11,4 @@ ON_BOOT OFF HYDRA OFF EXTRA --appType dotnet EXTRA TIZEN_UIFW ElmSharp +EXTRA --profile false diff --git a/NativeLauncher/inc/utils.h b/NativeLauncher/inc/utils.h index a6b1d2d..983eca8 100644 --- a/NativeLauncher/inc/utils.h +++ b/NativeLauncher/inc/utils.h @@ -29,6 +29,10 @@ #define PATH_SEPARATOR '/' #endif +#ifndef PROFILE_BASENAME +#define PROFILE_BASENAME ".__tizen_specific_profile_data" +#endif + namespace bf = boost::filesystem; namespace bs = boost::system; diff --git a/NativeLauncher/launcher/exec/launcher.cc b/NativeLauncher/launcher/exec/launcher.cc index e52001e..a829dbe 100644 --- a/NativeLauncher/launcher/exec/launcher.cc +++ b/NativeLauncher/launcher/exec/launcher.cc @@ -39,6 +39,7 @@ using tizen::runtime::dotnetcore::CoreRuntime; static std::string StandaloneOption("--standalone"); static std::string PaddingOption("--PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE"); static std::string AppTypeOption("--appType"); +static std::string ProfileOption("--profile"); int main(int argc, char *argv[]) { @@ -46,6 +47,7 @@ int main(int argc, char *argv[]) char* standalonePath = nullptr; bool paddingExist = false; + bool profile = false; const char* appType = NULL; const char* appRootPath = NULL; char appId[APPID_MAX_LENGTH] = {0,}; @@ -63,6 +65,8 @@ int main(int argc, char *argv[]) standalonePath = argv[i]; } else if (PaddingOption.compare(argv[i]) == 0) { paddingExist = true; + } else if (ProfileOption.compare(argv[i]) == 0) { + profile = true; } else if (AppTypeOption.compare(argv[i]) == 0) { if (i > argc - 1) { _ERR("app type for launchpad must be after \"--appType\" option"); @@ -107,7 +111,7 @@ int main(int argc, char *argv[]) _ERR("Failed to initialize"); } else { // launch application - err = CoreRuntime::launch(appId, appRootPath, standalonePath, vargs.size(), &vargs[0]); + err = CoreRuntime::launch(appId, appRootPath, standalonePath, vargs.size(), &vargs[0], profile); if (err) { _ERR("Failed to launch"); } diff --git a/NativeLauncher/launcher/exec/loader.cc b/NativeLauncher/launcher/exec/loader.cc index e7e1a76..af74eae 100644 --- a/NativeLauncher/launcher/exec/loader.cc +++ b/NativeLauncher/launcher/exec/loader.cc @@ -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; } diff --git a/NativeLauncher/launcher/lib/core_runtime.cc b/NativeLauncher/launcher/lib/core_runtime.cc index 1e5fb5e..1dcbbc2 100644 --- a/NativeLauncher/launcher/lib/core_runtime.cc +++ b/NativeLauncher/launcher/lib/core_runtime.cc @@ -503,7 +503,7 @@ void CoreRuntime::finalize() _INFO("CoreRuntime finalized"); } -int CoreRuntime::launch(const char* appId, const char* root, const char* path, int argc, char* argv[]) +int CoreRuntime::launch(const char* appId, const char* root, const char* path, int argc, char* argv[], bool profile) { if (!__initialized) { _ERR("Runtime is not initialized"); @@ -535,6 +535,18 @@ int CoreRuntime::launch(const char* appId, const char* root, const char* path, i char* localDataPath = app_get_data_path(); if (localDataPath != nullptr) { setEnvironmentVariable("XDG_DATA_HOME", localDataPath); + + // set profile.data path and collect/use it if it non-exists/exists. + if (profile) { + char multiCoreJitProfile[strlen(localDataPath) + strlen(PROFILE_BASENAME)]; + strcpy(multiCoreJitProfile, localDataPath); + strcat(multiCoreJitProfile, PROFILE_BASENAME); + + setEnvironmentVariable("COMPlus_MultiCoreJitProfile", multiCoreJitProfile); + if (!access(multiCoreJitProfile, R_OK)) { + setEnvironmentVariable("COMPlus_MultiCoreJitNoProfileGather", "1"); + } + } free(localDataPath); } diff --git a/NativeLauncher/launcher/lib/core_runtime.h b/NativeLauncher/launcher/lib/core_runtime.h index c4aa53f..f341261 100644 --- a/NativeLauncher/launcher/lib/core_runtime.h +++ b/NativeLauncher/launcher/lib/core_runtime.h @@ -37,7 +37,7 @@ class CoreRuntime public: static int initialize(const char* appType, LaunchMode launchMode); static void finalize(); - static int launch(const char* appId, const char* root, const char* path, int argc, char* argv[]); + static int launch(const char* appId, const char* root, const char* path, int argc, char* argv[], bool profile); private: static PathManager* __pm;