Apply cpu boosting on booting time 85/300685/5
authorInhong Han <inhong1.han@samsung.com>
Tue, 31 Oct 2023 10:48:52 +0000 (19:48 +0900)
committerInhong Han <inhong1.han@samsung.com>
Fri, 10 Nov 2023 01:04:54 +0000 (10:04 +0900)
Change-Id: I518ee2d880ec511577980e1bb536d417f1cca256

configure.ac
ism/extras/efl_panel/Makefile.am
ism/extras/efl_panel/isf_panel_efl.cpp
packaging/isf.spec

index adfc9e4..7444038 100644 (file)
@@ -355,6 +355,9 @@ PKG_CHECK_MODULES(SYSTEMD, [libsystemd],
 # Check gmock
 PKG_CHECK_MODULES(GMOCK, [gmock])
 
+# Check system resource library
+PKG_CHECK_MODULES(SYSTEM_RESOURCE, [capi-system-resource])
+
 if test "$ISF_HAS_VCONF" = "yes"; then
   AC_DEFINE(HAVE_VCONF,1,[Have VConf functions.])
 fi
index 50c9395..f103004 100644 (file)
@@ -54,6 +54,7 @@ isf_panel_efl_CXXFLAGS = @ECORE_WL_CFLAGS@ \
                          @PACKAGE_MANAGER_CFLAGS@ \
                          @AUL_CFLAGS@ \
                          @SYSTEM_INFO_CFLAGS@ \
+                         @SYSTEM_RESOURCE_CFLAGS@ \
                          -fPIE
 
 isf_panel_efl_LDFLAGS  = @LTLIBINTL@ -rpath $(libdir) \
@@ -72,6 +73,7 @@ isf_panel_efl_LDFLAGS  = @LTLIBINTL@ -rpath $(libdir) \
                          @PACKAGE_MANAGER_LIBS@ \
                          @AUL_LIBS@ \
                          @SYSTEM_INFO_LIBS@ \
+                         @SYSTEM_RESOURCE_LIBS@ \
                          -pie
 
 isf_panel_efl_LDADD    = $(top_builddir)/ism/src/libscim@SCIM_EPOCH@.la \
index e3dbc83..7471e5d 100644 (file)
@@ -44,6 +44,7 @@
 #include <glib.h>
 #include <tzplatform_config.h>
 #include <system_info.h>
+#include <cpu-boosting.h>
 
 #include "scim_private.h"
 #include "scim.h"
@@ -272,6 +273,8 @@ static void       show_ime_selector_notification       (void);
 static void       set_language_and_locale              (const char *lang_str);
 static bool       app_control_launch                   (const char *app_id);
 static void       terminate_active_ise                 (const String uuid);
+static void       set_cpu_boosting                     (void);
+static void       clear_cpu_boosting                   (void);
 
 /////////////////////////////////////////////////////////////////////////////
 // Declaration of internal variables.
@@ -6328,6 +6331,24 @@ static void terminate_active_ise (const String uuid)
     }
 }
 
+static void set_cpu_boosting ()
+{
+    resource_pid_t resource_st;
+    resource_st.pid = getpid();
+    int ret = resource_set_cpu_boosting(resource_st, CPU_BOOSTING_LEVEL_STRONG, CPU_BOOSTING_RESET_ON_FORK, -1);
+    if (ret != 0)
+        LOGE("Failed to set cpu boosting");
+}
+
+static void clear_cpu_boosting ()
+{
+    resource_pid_t resource_st;
+    resource_st.pid = getpid();
+    int ret = resource_clear_cpu_boosting(resource_st);
+    if (ret != 0)
+        LOGE("Failed to clear cpu boosting");
+}
+
 static void slot_run_helper (const String &uuid, const String &config, const String &display)
 {
     ISF_SAVE_LOG ("time:%ld  pid:%d  %s  %s  uuid(%s)",
@@ -7527,6 +7548,8 @@ int main (int argc, char *argv [])
     ConfigBase::set (_config);
     check_time ("create config instance");
 
+    set_cpu_boosting();
+
     try {
         if (!initialize_panel_agent (_config, display_name, should_resident)) {
             check_time ("Failed to initialize Panel Agent!");
@@ -7695,6 +7718,8 @@ int main (int argc, char *argv [])
     if (!isf_cynara_initialize())
         LOGW ("Failed to initialize cynara");
 
+    clear_cpu_boosting();
+
 #if ISF_BUILD_CANDIDATE_UI
     elm_run ();
 #else
index 084f912..c8047dc 100644 (file)
@@ -41,6 +41,7 @@ BuildRequires:  pkgconfig(libsystemd)
 BuildRequires:  pkgconfig(notification)
 BuildRequires:  pkgconfig(gmock)
 BuildRequires:  pkgconfig(gio-2.0)
+BuildRequires:  pkgconfig(capi-system-resource)
 Requires(postun): /sbin/ldconfig
 Requires:      org.tizen.isf-kbd-mode-changer