cpu-boosting: Move is_cpu_contention_alleviated to libsyscommon 52/298252/1
authorUnsung Lee <unsung.lee@samsung.com>
Fri, 1 Sep 2023 07:08:39 +0000 (16:08 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Fri, 1 Sep 2023 07:08:42 +0000 (16:08 +0900)
Move is_cpu_contention_alleviated function to libsyscommon and
reference syscommon_resourced_is_cpu_contention_alleviated() from libsyscommon.

Change-Id: I7f799bd4c1b8f0f7970c2731d9035e217b7696bb
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/resource-optimizer/cpu/cpu-boosting.c

index cfd3225..ecc245a 100644 (file)
@@ -113,18 +113,6 @@ static void find_cpu_boosting_info_in_tables(
        }
 }
 
-static bool is_cpu_contention_alleviated(guint timer_id)
-{
-       /**
-        * If additional monitor events are not triggered
-        * for CPU_CONTENTION_HANDLE_TIMEOUT_MSEC, then restore CPU boosting level.
-        */
-       if (g_latest_timer_id == timer_id)
-               return true;
-
-       return false;
-}
-
 static int restore_cpu_boosting_level(void)
 {
        GHashTableIter cpu_contention_handle_data_iter;
@@ -260,7 +248,8 @@ static gboolean cpu_contention_handle_timeout(gpointer data)
                return G_SOURCE_REMOVE;
        }
 
-       if (is_cpu_contention_alleviated(*timer_id))
+       if (syscommon_plugin_resourced_is_cpu_contention_alleviated
+                       (*timer_id, g_latest_timer_id))
                ret = restore_cpu_boosting_level();
 
        if (ret == RESOURCED_ERROR_OUT_OF_MEMORY)