From: pius.lee Date: Fri, 12 Aug 2016 07:34:57 +0000 (+0900) Subject: fix coreclr path and add launching time measure feature X-Git-Tag: submit/tizen/20161214.063015~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3425fb997d0bc226e6a5dcbf59df55433a91706;p=platform%2Fcore%2Fdotnet%2Flauncher.git fix coreclr path and add launching time measure feature --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8998418..0d49eba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIE") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -D_FILE_OFFSET_BITS=64") +#SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DLAUNCHING_TIME_MEASURE") SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") diff --git a/packaging/dotnet-launcher.ini b/packaging/dotnet-launcher.ini index dae9223..9d4809c 100644 --- a/packaging/dotnet-launcher.ini +++ b/packaging/dotnet-launcher.ini @@ -1,5 +1,5 @@ [dotnet] libcoreclr = libcoreclr.so -coreclr_dir = /usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0 -tpa_dirs = /usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0:/usr/share/assembly -native_so_search_dirs = /usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0:/usr/share/assembly +coreclr_dir = /opt/usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0 +tpa_dirs = /opt/usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0:/usr/share/assembly +native_so_search_dirs = /opt/usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0:/usr/share/assembly diff --git a/src/launcher.cc b/src/launcher.cc index ba15bb2..fcd1555 100644 --- a/src/launcher.cc +++ b/src/launcher.cc @@ -1,5 +1,9 @@ #include +#ifdef LAUNCHING_TIME_MEASURE +#include +#endif + #include #include #include @@ -204,6 +208,10 @@ Launcher::~Launcher() void Launcher::Initialize() { +#ifdef LAUNCHING_TIME_MEASURE + std::clock_t start = std::clock(); +#endif + std::ifstream iniStream(LauncherConfig); std::stringstream iniString; iniString << iniStream.rdbuf(); @@ -233,6 +241,11 @@ void Launcher::Initialize() _DBG("libcoreclr.so : [%s]", libcoreclr.c_str()); +#ifdef LAUNCHING_TIME_MEASURE + std::clock_t config_read_time = std::clock(); + _DBG("Reading Config file... : %Lf ms ", (config_read_time - start) / (double)(CLOCKS_PER_SEC / 1000)); +#endif + coreclrLib = dlopen(libcoreclr.c_str(), RTLD_NOW | RTLD_LOCAL); if (coreclrLib == nullptr) { @@ -268,6 +281,13 @@ void Launcher::Initialize() NativeDllSearchDirectories = nativeSoSearchDirs; AppDomainCompatSwitch = "UseLatestBehaviorWhenTFMNotSpecified"; } + +#ifdef LAUNCHING_TIME_MEASURE + std::clock_t dlopen_time = std::clock(); + _DBG("dlopen and dlsym time... : %Lf ms ", (dlopen_time - config_read_time) / (double)(CLOCKS_PER_SEC / 1000)); + _DBG("initialize time... : %Lf ms ", (dlopen_time - start) / (double)(CLOCKS_PER_SEC / 1000)); +#endif + } void Launcher::Launch(const string& exe_path, const string& app_root, int argc, char *argv[]) @@ -307,6 +327,9 @@ void Launcher::Launch(const string& exe_path, const string& app_root, int argc, _DBG("before initialize coreclr"); +#ifdef LAUNCHING_TIME_MEASURE + std::clock_t start = std::clock(); +#endif int st = initializeCoreCLR(exe_path.c_str(), "tizen_dotnet_launcher", sizeof(propertyKeys) / sizeof(propertyKeys[0]), @@ -316,6 +339,10 @@ void Launcher::Launch(const string& exe_path, const string& app_root, int argc, &domainId); _DBG("after initialize coreclr"); +#ifdef LAUNCHING_TIME_MEASURE + std::clock_t initialize_coreclr_time = std::clock(); + _DBG("call coreclr_initialize ... : %Lf ms ", (initialize_coreclr_time - start) / (double)(CLOCKS_PER_SEC / 1000)); +#endif if (st < 0) { // initialize coreclr fail @@ -339,11 +366,19 @@ void Launcher::Launch(const string& exe_path, const string& app_root, int argc, // shutdown fail _ERR("shutdown core clr fail! (0x%08x)", st); } +#ifdef LAUNCHING_TIME_MEASURE + std::clock_t execute_assembly_time = std::clock(); + _DBG("call execute_assembly_time ... : %Lf ms ", (execute_assembly_time - initialize_coreclr_time) / (double)(CLOCKS_PER_SEC / 1000)); +#endif } if (dlclose(coreclrLib) != 0) { _ERR("libcoreclr.so close failed"); } +#ifdef LAUNCHING_TIME_MEASURE + std::clock_t after_launching_time = std::clock(); + _DBG("launching end time ... : %Lf ms ", (after_launching_time - start) / (double)(CLOCKS_PER_SEC / 1000)); +#endif } } // namespace runtime