Change API name for better consistency and specify details 79/274079/2
authorHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 21 Apr 2022 05:16:22 +0000 (14:16 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 21 Apr 2022 05:18:52 +0000 (14:18 +0900)
Add resource_unregister_cpu_inheritance_destination() API

Change-Id: I1442d2fc1da905beb65b96a15048204f5e823d0b
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
include/cpu-boosting.h

index fa247dc..0328b0a 100644 (file)
@@ -39,39 +39,55 @@ typedef struct resource_pid_info {
        int tid_count
 } resource_pid_t;
 
+typedef struct resource_cpu_boosting_level_info {
+       int pid_level,
+       int *tid_level,
+       int tid_count
+} cpu_boosting_level_info_t
+
 /**
- * @brief Start boosting cpu scheduler for the target process (pid/tids).
+ * @brief Set cpu boosting for the target process (pid/tids).
  *
- * @param[in] target_pid The target process pid/tids \n
-                         The caller process itself if target_pid.pid is 0
+ * @param[in] pid The target process pid/tids \n
+ *                If pid.pid is zero and pid.tid is NULL, pid of the calling thread is used. \n
+ *                If pid.pid is nonzero, pid.tid and pid.tid_count are ignored. \n
+ *                The caller must (de)allocate the buffer in the pid.tid pointer.
  * @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_cpu_sched_boosting (resource_pid_t target_pid, cpu_boosting_level_e level, int timeout_msec);
+int resource_set_cpu_boosting (resource_pid_t pid, cpu_boosting_level_e level, int timeout_msec);
 
 /**
- * @brief Stop boosting cpu scheduler for the target process (pid/tids).
+ * @brief Clear cpu boosting for the target process (pid/tids).
  *
- * @param[in] target_pid The target process (pid/tids) \n
+ * @param[in] pid The target process pid/tids \n
+ *                If pid.pid is zero and pid.tid is NULL, pid of the calling thread is used. \n
+ *                If pid.pid is nonzero, pid.tid and pid.tid_count are ignored. \n
+ *                The caller must (de)allocate the buffer in the pid.tid pointer.
  *
  * @return 0 on success, otherwise a negative error value.
  */
-int resource_stop_cpu_sched_boosting (resource_pid_t target_pid);
+int resource_clear_cpu_boosting (resource_pid_t pid);
 
 /**
- * @brief Ask for the cpu scheduler boosting level for the target thread (tid).
+ * @brief Get the cpu boosting level for the target process (pid/tids).
  *
- * @param[in] tid The thread id to check \n
- * @param[out] boosting_level The boosting level (cpu_boosting_level_e) \n
+ * @param[in] pid The target process pid/tids \n
+ *                If pid.pid is zero and pid.tid is NULL, pid of the calling thread is used. \n
+ *                If pid.pid is nonzero, pid.tid and pid.tid_count are ignored. \n
+ *                The caller must (de)allocate the buffer in the pid.tid pointer.
+ * @param[out] level The boosting level for the target process (pid/tids) \n
+ *                   The level argument will be filled with the level value corresponding to the pid argument. \n
+ *                   The caller must (de)allocate the buffer in the level.tid_level pointer.
  *
  * @return 0 on success, otherwise a negative error value.
  */
-int resource_get_cpu_sched_boosting_level (int tid, cpu_boosting_level_e *boosting_level);
+int resource_get_cpu_boosting_level (resource_pid_t pid, cpu_boosting_level_info_t *level);
 
 /**
- * @brief Set cpu scheduler inheritance from the source tid to the destination process (pid/tids).
+ * @brief Set cpu resource 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
@@ -79,27 +95,37 @@ int resource_get_cpu_sched_boosting_level (int tid, cpu_boosting_level_e *boosti
  *
  * @return 0 on success, otherwise a negative error value.
  */
-int resource_set_cpu_sched_inheritance (int source_tid, char *dest_process, int timeout_msec);
+int resource_set_cpu_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).
+ * @brief Clear cpu resource 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);
+int resource_clear_cpu_inheritance (int source_tid, char *dest_process);
 
 /**
- * @brief Register a destination process (pid/tids) for cpu scheduler inheritance.
+ * @brief Register a destination process (pid/tids) for cpu resource 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);
+int resource_register_cpu_inheritance_destination (char *dest_process, resource_pid_t pid);
+
+/**
+ * @brief Unregister a destination process for cpu resource inheritance.
+ *
+ * @param[in] dest_process The name of destination process
+ *
+ * @return 0 on success, otherwise a negative error value.
+ */
+int resource_unregister_cpu_inheritance_destination (char *dest_process);
+
 
 #ifdef __cplusplus
 }