BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(capi-system-resource)
Requires: /bin/cp
Requires(post): /sbin/ldconfig
SYSCOMMON_PLUGIN_MODULE_DEVICED_BATTERY,
SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT,
SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY,
+ SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING,
SYSCOMMON_PLUGIN_MODULE_END,
};
.backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
},
},
+ [SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING] = {
+ [0] = {
+ .platform_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
+ .backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
+ },
+ },
};
static struct __plugin_module_info g_plugin_module_info[] = {
.num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY]),
.abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY],
},
+ [SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING] = {
+ .group = PLUGIN_GROUP_RESOURCED,
+ .module = SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING,
+ .license = PLUGIN_LICENSE_APACHE_2_0,
+ .module_name = "SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING",
+ .backend_module_name = "resourced-cpu-boosting",
+ .library_name = "/usr/lib/system/plugin/libplugin-backend-resourced-cpu-boosting.so",
+ .library_name_64bit = "/usr/lib64/system/plugin/libplugin-backend-resourced-cpu-boosting.so",
+ .symbol_name = "system_plugin_backend_resourced_cpu_boosting_data",
+ .num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING]),
+ .abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING],
+ },
};
#endif /* __PLUGIN_API_LIST_H__ */
if (${PLUGIN_API_RESOURCED_ENABLE_DLOG})
SET(PKG_MODULES
glib-2.0
- dlog)
+ dlog
+ capi-system-resource)
ADD_DEFINITIONS("-DENABLE_DLOG")
ADD_DEFINITIONS("-DLOG_TAG=\"SYSTEM_PLUGIN_API_RESOURCED\"")
else()
SET(PKG_MODULES
- glib-2.0)
+ glib-2.0
+ capi-system-resource)
endif()
INCLUDE(FindPkgConfig)
# Please remove them from SRCS and add 'syscommon-plugin-api-common'
# to PKG_MODULES.
SET(SRCS src/syscommon-plugin-resourced-memory-lmk.c
+ src/syscommon-plugin-resourced-cpu-boosting.c
../common/src/syscommon-plugin-api-common.c
../common/src/syscommon-plugin-api-conf.c)
--- /dev/null
+/**
+ * MIT License
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef __SYSCOMMON_PLUGIN_RESOURCED_CPU_BOOSTING_INTERFACE_H__
+#define __SYSCOMMON_PLUGIN_RESOURCED_CPU_BOOSTING_INTERFACE_H__
+
+#include <glib.h>
+#include <cpu-boosting-type.h>
+#include <cpu-boosting-private.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct syscommon_resourced_cpu_boosting_input {
+ cpu_boosting_input_t client_input;
+ int sock;
+ guint *gsource_id;
+ bool remove_input;
+};
+
+struct syscommon_resourced_cpu_boosting_info {
+ pid_t tid;
+ cpu_boosting_level_e level; /* current boosting level */
+ guint gsource_id; /* timer id */
+ int ref_cnt; /* reference count */
+ cpu_boosting_flag_e cpu_boosting_flags;
+};
+
+typedef struct _syscommon_plugin_backend_resourced_cpu_boosting_funcs {
+ int (*cpu_boosting_governor_govern_request) (
+ GHashTable *cpu_boosting_info_table,
+ cpu_boosting_level_e cpu_boosting_level,
+ GSList **cpu_boosting_controller_action)
+} syscommon_plugin_backend_resourced_cpu_boosting_funcs;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SYSCOMMON_PLUGIN_RESOURCED_CPU_BOOSTING_INTERFACE_H__ */
--- /dev/null
+/**
+ * MIT License
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef __SYSCOMMON_PLUGIN_RESOURCED_CPU_BOOSTING_H__
+#define __SYSCOMMON_PLUGIN_RESOURCED_CPU_BOOSTING_H__
+
+#include "syscommon-plugin-resourced-cpu-boosting-interface.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Get the backend data of resourced-cpu-boosting module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_resourced_cpu_boosting_get_backend(void);
+
+/**
+ * @brief Put the backend data of resourced-cpu-boosting module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_resourced_cpu_boosting_put_backend(void);
+
+/**
+ * @brief Analyze cpu contention reason and
+ * make a list to do for cpu boosting controller
+ * @param[in] cpu_boosting_info_table is a GHashTable containing cpu boosting info
+ * of the currently boosted thread
+ * @param[in] cpu_boosting_level is cpu boosting level among CPU_BOOSTING_LEVEL_STRONG,
+ * CPU_BOOSTING_LEVEL_MEDIUM, and CPU_BOOSTING_LEVEL_WEAK
+ * @param[out] cpu_boosting_controller_action is a GSList containing actions
+ * to be taken by cpu boosting controller
+ * @return @c zero on success,
+ * otherwise a negative error value
+ */
+int syscommon_plugin_resourced_cpu_boosting_governor_govern_request(
+ GHashTable *cpu_boosting_info_table,
+ cpu_boosting_level_e cpu_boosting_level,
+ GSList **cpu_boosting_controller_action);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SYSCOMMON_PLUGIN_RESOURCED_CPU_BOOSTING_H__ */
--- /dev/null
+/**
+ * MIT License
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <assert.h>
+
+#include <libsyscommon/log.h>
+
+#include <system/syscommon-plugin-common.h>
+#include <system/syscommon-plugin-resourced-cpu-boosting.h>
+
+#ifndef EXPORT
+#define EXPORT __attribute__((visibility("default")))
+#endif
+
+static syscommon_plugin_backend_resourced_cpu_boosting_funcs *funcs = NULL;
+
+EXPORT
+int syscommon_plugin_resourced_cpu_boosting_get_backend(void)
+{
+ int ret = 0;
+
+ if (funcs)
+ return 0;
+
+ ret = syscommon_plugin_common_get_backend(
+ SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING,
+ (void **)&funcs);
+ if (ret < 0) {
+ _E("Failed to get resourced_cpu_boosting backend: %d", ret);
+ return ret;
+ }
+
+ _I("Success to get resourced_cpu_boosting backend: %d", ret);
+
+ return 0;
+}
+
+EXPORT
+int syscommon_plugin_resourced_cpu_boosting_put_backend(void)
+{
+ int ret = 0;
+
+ if (!funcs)
+ return 0;
+
+ ret = syscommon_plugin_common_put_backend(
+ SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING,
+ (void *)funcs);
+ if (ret < 0) {
+ _E("Failed to put resourced_cpu_boosting backend: %d", ret);
+ return ret;
+ }
+ funcs = NULL;
+
+ _I("Success to put resourced_cpu_boosting backend: %d", ret);
+
+ return 0;
+}
+
+EXPORT
+int syscommon_plugin_resourced_cpu_boosting_governor_govern_request(
+ GHashTable *cpu_boosting_info_table,
+ cpu_boosting_level_e cpu_boosting_level,
+ GSList **cpu_boosting_controller_action)
+
+{
+ int ret = 0;
+
+ if (!funcs) {
+ ret = syscommon_plugin_resourced_cpu_boosting_get_backend();
+ if (ret < 0)
+ return ret;
+ }
+
+ assert(funcs);
+ if (!funcs->cpu_boosting_governor_govern_request) {
+ _E("No \"cpu_boosting_governor_govern_request\" function");
+ return -ENOTSUP;
+ }
+
+ return funcs->cpu_boosting_governor_govern_request(cpu_boosting_info_table,
+ cpu_boosting_level, cpu_boosting_controller_action);
+}