Add function declaration for CPU boosting APIs 40/273940/4
authorHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 18 Apr 2022 12:04:12 +0000 (21:04 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 18 Apr 2022 12:08:14 +0000 (21:08 +0900)
Change-Id: I9ac527fd70b41387e1f4e2e8d512774801a7dbe6
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
include/cpu-boosting.h [new file with mode: 0644]
include/resource.h [deleted file]
src/cpu-boosting.c [new file with mode: 0644]
src/resource.c [deleted file]

diff --git a/include/cpu-boosting.h b/include/cpu-boosting.h
new file mode 100644 (file)
index 0000000..d6ce97c
--- /dev/null
@@ -0,0 +1,98 @@
+/* MIT License
+ *
+ * Copyright (c) 2022 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 __TIZEN_SYSTEM_RESOURCE_H__
+#define __TIZEN_SYSTEM_RESOURCE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum resource_cpu_boosting_level {
+       CPU_BOOSTING_LEVEL_STRONG,
+       CPU_BOOSTING_LEVEL_MEDIUM,
+       CPU_BOOSTING_LEVEL_WEAK
+} cpu_boosting_level_e;
+
+typedef struct resource_pid_info {
+       int pid,
+       int *tid,
+       int tid_count
+} resource_pid_t;
+
+/**
+ * @brief Start boosting cpu scheduler for designated pid/tids.
+ *
+ * @param[in] target_pid The target process pid/tids \n
+                         The caller process itself if target_pid.pid is 0
+ * @param[in] level The cpu boosting level
+ * @param[in] timeout_msec The timeout in milliseconds, -1 to apply boosting permanently
+ *
+ * @return 0 on success, otherwise a negative error value.
+ */
+int resource_start_boosting_cpu_sched (resource_pid_t target_pid, cpu_boosting_level_e level, int timeout_msec);
+
+/**
+ * @brief Stop boosting cpu scheduler for designated pid/tids.
+ *
+ * @param[in] target_pid The target process (pid/tids) \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ */
+int resource_stop_boosting_cpu_sched (resource_pid_t target_pid);
+
+/**
+ * @brief Set cpu scheduler inheritance from the source tid to the destination process (pid/tids).
+ *
+ * @param[in] source_tid The caller thread tid
+ * @param[in] dest_process The name of destination process
+ * @param[in] timeout_msec The timeout in milliseconds, -1 to apply inheritance permanently
+ *
+ * @return 0 on success, otherwise a negative error value.
+ */
+int resource_set_cpu_sched_inheritance (int source_tid, char *dest_process, int timeout_msec);
+
+/**
+ * @brief Clear cpu scheduler inheritance from the source tid to the destination process (pid/tids).
+ *
+ * @param[in] source_tid The caller thread's tid
+ * @param[in] dest_process The name of destination process
+ *
+ * @return 0 on success, otherwise a negative error value.
+ */
+int resource_clear_cpu_sched_inheritance (int source_tid, char *dest_process);
+
+/**
+ * @brief Register a destination process (pid/tids) for cpu scheduler inheritance.
+ *
+ * @param[in] dest_process The name of destination process
+ * @param[in] pid The destination process pid/tids
+ *
+ * @return 0 on success, otherwise a negative error value.
+ */
+int resource_register_cpu_sched_inheritance_destination (char *dest_process, resource_pid_t pid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // __TIZEN_SYSTEM_RESOURCE_H__
diff --git a/include/resource.h b/include/resource.h
deleted file mode 100644 (file)
index 022bc2c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* MIT License
- *
- * Copyright (c) 2022 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 __TIZEN_SYSTEM_RESOURCE_H__
-#define __TIZEN_SYSTEM_RESOURCE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // __TIZEN_SYSTEM_RESOURCE_H__
diff --git a/src/cpu-boosting.c b/src/cpu-boosting.c
new file mode 100644 (file)
index 0000000..7cf60be
--- /dev/null
@@ -0,0 +1,23 @@
+/* MIT License
+ *
+ * Copyright (c) 2022 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. */
+
+
diff --git a/src/resource.c b/src/resource.c
deleted file mode 100644 (file)
index 7cf60be..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* MIT License
- *
- * Copyright (c) 2022 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. */
-
-