resource-monitor: Add example code and update some brief 96/280596/1 submit/tizen/20220901.055710
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 1 Sep 2022 05:39:59 +0000 (14:39 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 1 Sep 2022 05:39:59 +0000 (14:39 +0900)
Add example code to give the guide about using
capi-system-resource-monitor and update some brief
to make it more understable when reading brief section.

Change-Id: I80a56b805c1fd65f8fcbc31a6a7c33ea6b37fb54
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
include/resource-monitor.h

index 59cbd868375945b95848e6b4526ef81952371c3d..1cc113216d7cb72ca500ca815aebeceab4ee2311 100644 (file)
@@ -180,6 +180,27 @@ typedef enum {
  * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
  * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  * @see    resource_monitor_exit()
+ * @example
+ *         // Create monitor_id and resource_id for CPU device.
+ *         int monitor_id = resource_monitor_init();
+ *         int resource_id = resource_monitor_create_resource(monitor_id, RESOURCE_MONITOR_TYPE_CPU);
+ *
+ *         // Set control value to indicate the specific CPU device.
+ *         // It assumes CPU cluster is only one for this example.
+ *         int ret = resource_monitor_set_resource_ctrl(monitor_id, resource_id, 0);
+ *
+ *         // Set interested resource attributes to monitor the CPU current/minimum frequency.
+ *         u_int64_t attr_mask = RESOURCE_MONITOR_CPU_ATTR_CUR_FREQ | RESOURCE_MONITOR_CPU_ATTR_MIN_FREQ;
+ *         ret = resource_monitor_set_resource_attr(monitor_id, resource_id, attr_mask);
+ *
+ *         // Update resource attribute data of CPU current /minimum frequency..
+ *         ret = resource_monitor_update(monitor_id);
+ *
+ *         // Get the monitored resource attribute data of CPU current/minimum frequency.
+ *         int cpu_cur_freq;
+ *         int cpu_min_freq;
+ *         ret = resource_monitor_get_value_int(monitor_id, resource_id, RESOURCE_MONITOR_CPU_ATTR_CUR_FREQ, &cpu_cur_freq);
+ *         ret = resource_monitor_get_value_int(monitor_id, resource_id, RESOURCE_MONITOR_CPU_ATTR_MIN_FREQ, &cpu_min_freq);
  */
 int resource_monitor_init(void);
 
@@ -275,7 +296,7 @@ int resource_monitor_delete_resource(int monitor_id, int resource_id);
 int resource_monitor_set_resource_ctrl(int monitor_id, int resource_id, resource_monitor_ctrl_id_e ctrl_id, int value);
 
 /**
- * @brief Sets the interested resource attributes for monitoring.
+ * @brief Sets the resource attributes of interest for monitoring.
  * @since_tizen 7.0
  * @privlevel public
  * @privilege %http://tizen.org/privilege/systemmonitor
@@ -295,7 +316,7 @@ int resource_monitor_set_resource_ctrl(int monitor_id, int resource_id, resource
 int resource_monitor_set_resource_attr(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_mask);
 
 /**
- * @brief Unsets the interested resource attributes for monitoring.
+ * @brief Unsets the resource attributes of interest for monitoring.
  * @since_tizen 7.0
  * @privlevel public
  * @privilege %http://tizen.org/privilege/systemmonitor
@@ -336,7 +357,7 @@ int resource_monitor_unset_resource_attr(int monitor_id, int resource_id, resour
 int resource_monitor_is_resource_attr_supported(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, bool *supported);
 
 /**
- * @brief Updates the value of interested attributes for all created resource.
+ * @brief Updates the value of attributes of interest for all created resource.
  * @since_tizen 7.0
  * @privlevel public
  * @privilege %http://tizen.org/privilege/systemmonitor
@@ -355,7 +376,7 @@ int resource_monitor_is_resource_attr_supported(int monitor_id, int resource_id,
 int resource_monitor_update(int monitor_id);
 
 /**
- * @brief Updates the value of interested attributes for a resource.
+ * @brief Updates the value of attributes of interest for a resource.
  * @since_tizen 7.0
  * @privlevel public
  * @privilege %http://tizen.org/privilege/systemmonitor