print HW clock log (#385)
author이형주/Common Platform Lab(SR)/삼성전자 <leee.lee@samsung.com>
Fri, 18 Feb 2022 02:23:35 +0000 (11:23 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 18 Feb 2022 02:23:35 +0000 (11:23 +0900)
NativeLauncher/inc/utils.h
NativeLauncher/launcher/exec/launcher.cc
NativeLauncher/util/utils.cc

index cfc28a85c163c6522b722cccad696b0830bdb753..1f495263e1b679d49dcf911767012fa8f0b3a148 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <launcher_env.h>
 
+#include <sys/prctl.h>
+
 #ifndef PATH_SEPARATOR
 #define PATH_SEPARATOR '/'
 #endif
@@ -45,6 +47,10 @@ enum FSFlag : int {
   FS_PRESERVE_OWNERSHIP_AND_PERMISSIONS = (1 << 3)
 };
 
+#ifndef PR_TASK_PERF_USER_TRACE
+#define PR_TASK_PERF_USER_TRACE 666
+#endif
+
 /**
  * @brief concat path with PATH_SEPARATOR
  * @param[in] destination path
@@ -301,4 +307,11 @@ int pkgmgrMDFilterForeach(pkgmgrinfo_appinfo_metadata_filter_h handle,
                                         pkgmgrinfo_app_list_cb app_cb,
                                         void *user_data);
 
+/**
+ * @brief Prints HW Clock log
+ * @param[in] format `printf`-like format string
+ * @param[in] ... `printf`-like variadic list of arguments corresponding to the format string
+ */
+void printHWClockLog(const char* format, ...);
+
 #endif /* __UTILS_H__ */
index a829dbe2441783c346c387bdfca479e32c5abac8..c98d76652af3987b91b4eae1bd095206cbe26bef 100644 (file)
@@ -43,6 +43,7 @@ static std::string ProfileOption("--profile");
 
 int main(int argc, char *argv[])
 {
+       printHWClockLog("[dotnet-launcher] launcher main!");
        _INFO("##### Run in standalone mode #####");
 
        char* standalonePath = nullptr;
index a12af284179e69a0c01057fe929187bd489298ea..64f44280b0e8c879b468dadaded7db6333eca6ab 100644 (file)
@@ -782,8 +782,8 @@ int pkgmgrGetAppInfo(const std::string& appId, pkgmgrinfo_appinfo_h* handle)
 }
 
 int pkgmgrMDFilterForeach(pkgmgrinfo_appinfo_metadata_filter_h handle,
-                                        pkgmgrinfo_app_list_cb app_cb,
-                                        void *user_data)
+                                                       pkgmgrinfo_app_list_cb app_cb,
+                                                       void *user_data)
 {
        uid_t uid = 0;
        int ret = 0;
@@ -803,3 +803,15 @@ int pkgmgrMDFilterForeach(pkgmgrinfo_appinfo_metadata_filter_h handle,
        return 0;
 }
 
+void printHWClockLog(const char* format, ...)
+{
+       char buf[1024] = {0,};
+       va_list ap;
+
+       va_start(ap, format);
+       vsnprintf(buf, sizeof(buf), format, ap);
+       va_end(ap);
+
+       prctl(PR_TASK_PERF_USER_TRACE, buf, strlen(buf));
+}
+