2 * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __TIZEN_SYSTEM_MONITOR_RESOURCE_MONITOR_H__
18 #define __TIZEN_SYSTEM_MONITOR_RESOURCE_MONITOR_H__
22 #include <sys/types.h>
29 * @file resource-monitor.h
30 * @brief Provide resource C API for Resource Monitor
34 * @addtogroup CAPI_SYSTEM_RESOURCE_MONITOR_MODULE
39 * @brief Enumeration for resource monitor error value.
43 RESOURCE_MONITOR_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
44 RESOURCE_MONITOR_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission Denied */
45 RESOURCE_MONITOR_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid Parameter */
46 RESOURCE_MONITOR_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< Empty Data */
47 RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
48 RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_RESOURCE = TIZEN_ERROR_RESOURCE_MONITOR | 0x01, /**< Unavailable Resource Type */
49 RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE = TIZEN_ERROR_RESOURCE_MONITOR | 0x02, /**< Unavailable Attribute */
50 } resource_monitor_error_e;
53 * @brief Enumeration for resource type.
57 RESOURCE_MONITOR_TYPE_UNKNOWN = 0, /**< Unknown Resource Type */
58 RESOURCE_MONITOR_TYPE_CPU = 1, /**< CPU Resource Type */
59 RESOURCE_MONITOR_TYPE_BUS = 2, /**< BUS Resource Type */
60 RESOURCE_MONITOR_TYPE_GPU = 3, /**< GPU Resource Type */
61 RESOURCE_MONITOR_TYPE_MEMORY = 4, /**< Memory Resource Type */
62 RESOURCE_MONITOR_TYPE_BATTERY = 5, /**< Battery Resource Type */
63 RESOURCE_MONITOR_TYPE_DISPLAY = 7, /**< Display Resource Type */
64 RESOURCE_MONITOR_TYPE_SYSTEM = 8, /**< System Resource Type */
65 RESOURCE_MONITOR_TYPE_DISK = 10, /**< Disk Resource Type */
66 } resource_monitor_type_e;
69 * @brief Enumeration for resource attribute ID.
73 /* CPU Resource Attribute ID */
74 RESOURCE_MONITOR_CPU_ATTR_CUR_FREQ = (1ULL << 0), /**< Current CPU frequency (data type: DATA_TYPE_INT, unit: kHz) */
75 RESOURCE_MONITOR_CPU_ATTR_MIN_FREQ = (1ULL << 1), /**< Current CPU minimum frequency (data type: DATA_TYPE_INT, unit: kHz) */
76 RESOURCE_MONITOR_CPU_ATTR_MAX_FREQ = (1ULL << 2), /**< Current CPU maximum frequency (data type: DATA_TYPE_INT, unit: kHz) */
77 RESOURCE_MONITOR_CPU_ATTR_AVAILABLE_MIN_FREQ = (1ULL << 3), /**< Available CPU minimum frequency (data type: DATA_TYPE_INT, unit: kHz) */
78 RESOURCE_MONITOR_CPU_ATTR_AVAILABLE_MAX_FREQ = (1ULL << 4), /**< Available CPU maximum frequency (data type: DATA_TYPE_INT, unit: kHz) */
79 RESOURCE_MONITOR_CPU_ATTR_CUR_GOVERNOR = (1ULL << 5), /**< Current CPU frequency governor name (data type: DATA_TYPE_STRING) */
80 RESOURCE_MONITOR_CPU_ATTR_NAME = (1ULL << 6), /**< CPU cluster name (data type: DATA_TYPE_STRING) */
82 /* Bus Resource Attribute ID */
83 RESOURCE_MONITOR_BUS_ATTR_CUR_FREQ = (1ULL << 0), /**< Current bus frequency (data type: DATA_TYPE_INT, unit: kHz) */
84 RESOURCE_MONITOR_BUS_ATTR_MIN_FREQ = (1ULL << 1), /**< Current bus minimum frequency (data type: DATA_TYPE_INT, unit: kHz) */
85 RESOURCE_MONITOR_BUS_ATTR_MAX_FREQ = (1ULL << 2), /**< Current bus maximum frequency (data type: DATA_TYPE_INT, unit: kHz) */
86 RESOURCE_MONITOR_BUS_ATTR_AVAILABLE_MIN_FREQ = (1ULL << 3), /**< Available bus minimum frequency (data type: DATA_TYPE_INT, unit: kHz) */
87 RESOURCE_MONITOR_BUS_ATTR_AVAILABLE_MAX_FREQ = (1ULL << 4), /**< Available bus maximum frequency (data type: DATA_TYPE_INT, unit: kHz) */
88 RESOURCE_MONITOR_BUS_ATTR_CUR_GOVERNOR = (1ULL << 5), /**< Current bus frequency governor name (data type: DATA_TYPE_STRING) */
89 RESOURCE_MONITOR_BUS_ATTR_NAME = (1ULL << 6), /**< Bus device name (data type: DATA_TYPE_STRING) */
91 /* GPU Resource Attribute ID */
92 RESOURCE_MONITOR_GPU_ATTR_CUR_FREQ = (1ULL << 0), /**< Current GPU frequency (data type: DATA_TYPE_INT, unit: kHz) */
93 RESOURCE_MONITOR_GPU_ATTR_MIN_FREQ = (1ULL << 1), /**< Current GPU minimum frequency (data type: DATA_TYPE_INT, unit: kHz) */
94 RESOURCE_MONITOR_GPU_ATTR_MAX_FREQ = (1ULL << 2), /**< Current GPU maximum frequency (data type: DATA_TYPE_INT, unit: kHz) */
95 RESOURCE_MONITOR_GPU_ATTR_AVAILABLE_MIN_FREQ = (1ULL << 3), /**< Available GPU minimum frequency (data type: DATA_TYPE_INT, unit: kHz) */
96 RESOURCE_MONITOR_GPU_ATTR_AVAILABLE_MAX_FREQ = (1ULL << 4), /**< Available GPU maximum frequency (data type: DATA_TYPE_INT, unit: kHz) */
97 RESOURCE_MONITOR_GPU_ATTR_CUR_GOVERNOR = (1ULL << 5), /**< Current GPU frequency governor name (data type: DATA_TYPE_STRING) */
98 RESOURCE_MONITOR_GPU_ATTR_NAME = (1ULL << 6), /**< GPU device name (data type: DATA_TYPE_STRING) */
100 /* Memory Resource Attribute ID */
101 RESOURCE_MONITOR_MEMORY_ATTR_TOTAL = (1ULL << 0), /**< Memory total size (data type: DATA_TYPE_UINT64, unit: kB) */
102 RESOURCE_MONITOR_MEMORY_ATTR_AVAILABLE = (1ULL << 1), /**< Memory available size (data type: DATA_TYPE_UINT64, unit: kB) */
103 RESOURCE_MONITOR_MEMORY_ATTR_FREE = (1ULL << 2), /**< Memory free size (data type: DATA_TYPE_UINT64, unit: kB) */
104 RESOURCE_MONITOR_MEMORY_ATTR_BUFFER = (1ULL << 3), /**< Memory buffer size (data type: DATA_TYPE_UINT64, unit: kB) */
105 RESOURCE_MONITOR_MEMORY_ATTR_CACHED = (1ULL << 4), /**< Memory cached size (data type: DATA_TYPE_UINT64, unit: kB) */
106 RESOURCE_MONITOR_MEMORY_ATTR_CMA_TOTAL = (1ULL << 5), /**< CMA memory total size (data type: DATA_TYPE_UINT64, unit: kB) */
107 RESOURCE_MONITOR_MEMORY_ATTR_CMA_FREE = (1ULL << 6), /**< CMA memory free size (data type: DATA_TYPE_UINT64, unit: kB) */
108 RESOURCE_MONITOR_MEMORY_ATTR_SWAP_TOTAL = (1ULL << 7), /**< Swap memory total size (data type: DATA_TYPE_UINT64, unit: kB) */
109 RESOURCE_MONITOR_MEMORY_ATTR_SWAP_FREE = (1ULL << 8), /**< Swap memory free size (data type: DATA_TYPE_UINT64, unit: kB) */
111 /* Battery Resource Attribute ID */
112 RESOURCE_MONITOR_BATTERY_ATTR_CAPACITY = (1ULL << 0), /**< Battery capacity (data type: DATA_TYPE_INT, unit: %) */
113 RESOURCE_MONITOR_BATTERY_ATTR_STATUS = (1ULL << 1), /**< Battery status (data type: DATA_TYPE_STRING) */
114 RESOURCE_MONITOR_BATTERY_ATTR_TEMPERATURE = (1ULL << 2), /**< Battery temperature (data type: DATA_TYPE_INT) */
115 RESOURCE_MONITOR_BATTERY_ATTR_VOLTAGE_NOW = (1ULL << 3), /**< Battery voltage value (data type: DATA_TYPE_INT, unit: uV) */
116 RESOURCE_MONITOR_BATTERY_ATTR_CURRENT_NOW = (1ULL << 4), /**< Battery current value (data type: DATA_TYPE_INT, unit: uA) */
117 RESOURCE_MONITOR_BATTERY_ATTR_PRESENT = (1ULL << 5), /**< Battery connected status (data type: DATA_TYPE_INT) */
118 RESOURCE_MONITOR_BATTERY_ATTR_ONLINE = (1ULL << 6), /**< Battery Charger connector status (data type: DATA_TYPE_INT) */
120 /* Display Resource Attribute ID */
121 RESOURCE_MONITOR_DISPLAY_ATTR_FPS = (1ULL << 0), /**< Frame per second (data type: DATA_TYPE_DOUBLE) */
122 RESOURCE_MONITOR_DISPLAY_ATTR_NAME = (1ULL << 1), /**< Display device name (data type: DATA_TYPE_STRING, unit: fps) */
124 /* System Resource Attribute ID */
125 RESOURCE_MONITOR_SYSTEM_ATTR_CPU_UTIL = (1ULL << 0), /**< CPU average utilization (data type: DATA_TYPE_DOUBLE, unit: %) */
126 RESOURCE_MONITOR_SYSTEM_ATTR_CPU_USER_UTIL = (1ULL << 1), /**< CPU average utilization on user (data type: DATA_TYPE_DOUBLE, unit: %) */
127 RESOURCE_MONITOR_SYSTEM_ATTR_CPU_SYS_UTIL = (1ULL << 2), /**< CPU average utilization on system (data type: DATA_TYPE_DOUBLE, unit: %) */
128 RESOURCE_MONITOR_SYSTEM_ATTR_PER_CPU_UTIL = (1ULL << 3), /**< Per-CPU utilization (data type: DATA_TYPE_ARRAY_DOUBLE, unit: %) */
129 RESOURCE_MONITOR_SYSTEM_ATTR_PER_CPU_USER_UTIL = (1ULL << 4), /**< Per-CPU utilization on user (data type: DATA_TYPE_ARRAY_DOUBLE, unit: %) */
130 RESOURCE_MONITOR_SYSTEM_ATTR_PER_CPU_SYS_UTIL = (1ULL << 5), /**< Per-CPU utilization on system (data type: DATA_TYPE_ARRAY_DOUBLE, unit: %) */
131 RESOURCE_MONITOR_SYSTEM_ATTR_POSSIBLE_CPU = (1ULL << 6), /**< Number of possible CPU (data type: DATA_TYPE_INT, unit: ea) */
132 RESOURCE_MONITOR_SYSTEM_ATTR_ONLINE_CPU = (1ULL << 7), /**< Number of online CPU (data type: DATA_TYPE_INT, unit: ea) */
134 /* Disk Resource Attribute ID */
135 RESOURCE_MONITOR_DISK_ATTR_NAME = (1ULL << 0), /**< Disk device name (data type: DATA_TYPE_STRING) */
136 RESOURCE_MONITOR_DISK_ATTR_READ_PER_SEC = (1ULL << 1), /**< Disk read per second (data type: DATA_TYPE_DOUBLE, unit: kB/s) */
137 RESOURCE_MONITOR_DISK_ATTR_WRITE_PER_SEC = (1ULL << 2), /**< Disk write per second (data type: DATA_TYPE_DOUBLE, unit: kB/s) */
138 RESOURCE_MONITOR_DISK_ATTR_READ_TOTAL = (1ULL << 3), /**< Disk read total size (data type: DATA_TYPE_UINT64, unit: kB) */
139 RESOURCE_MONITOR_DISK_ATTR_WRITE_TOTAL = (1ULL << 4), /**< Disk write total size (data type: DATA_TYPE_UINT64, unit: kB) */
140 } resource_monitor_attr_id_e;
143 * @brief Enumeration for resource control ID.
147 /* CPU Resource Control ID */
148 RESOURCE_MONITOR_CPU_CTRL_CLUSTER_ID = (1ULL << 0), /**< CPU cluster resource control ID */
150 /* Bus Resource Control ID */
151 RESOURCE_MONITOR_BUS_CTRL_DEVICE_ID = (1ULL << 0), /**< Bus device resource control ID */
153 /* GPU Resource Control ID */
154 RESOURCE_MONITOR_GPU_CTRL_DEVICE_ID = (1ULL << 0), /**< GPU device resource control ID */
156 /* Display Resource Control ID */
157 RESOURCE_MONITOR_DISPLAY_CTRL_DEVICE_ID = (1ULL << 0), /**< Display device resource control ID */
159 /* Disk Resource Control ID */
160 RESOURCE_MONITOR_DISK_CTRL_DEVICE_ID = (1ULL << 0), /**< Disk device resource control ID */
161 } resource_monitor_ctrl_id_e;
168 * @addtogroup CAPI_SYSTEM_RESOURCE_MONITOR_MODULE
173 * @brief Initializes the resource monitor.
176 * @privilege %http://tizen.org/privilege/systemmonitor
177 * @remarks The @c return value should be released using resource_monitor_exit().
178 * @return @c positive integer as resource monitor ID on success, otherwise a negative error value
179 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
180 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
181 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
182 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
183 * @see resource_monitor_exit()
185 * // Create monitor_id and resource_id for CPU device.
186 * int monitor_id = resource_monitor_init();
187 * int resource_id = resource_monitor_create_resource(monitor_id, RESOURCE_MONITOR_TYPE_CPU);
189 * // Set control value to indicate the specific CPU device.
190 * // It assumes CPU cluster is only one for this example.
191 * int ret = resource_monitor_set_resource_ctrl(monitor_id, resource_id, 0);
193 * // Set interested resource attributes to monitor the CPU current/minimum frequency.
194 * u_int64_t attr_mask = RESOURCE_MONITOR_CPU_ATTR_CUR_FREQ | RESOURCE_MONITOR_CPU_ATTR_MIN_FREQ;
195 * ret = resource_monitor_set_resource_attr(monitor_id, resource_id, attr_mask);
197 * // Update resource attribute data of CPU current /minimum frequency..
198 * ret = resource_monitor_update(monitor_id);
200 * // Get the monitored resource attribute data of CPU current/minimum frequency.
203 * ret = resource_monitor_get_value_int(monitor_id, resource_id, RESOURCE_MONITOR_CPU_ATTR_CUR_FREQ, &cpu_cur_freq);
204 * ret = resource_monitor_get_value_int(monitor_id, resource_id, RESOURCE_MONITOR_CPU_ATTR_MIN_FREQ, &cpu_min_freq);
206 int resource_monitor_init(void);
209 * @brief Exits the resource monitor.
212 * @privilege %http://tizen.org/privilege/systemmonitor
213 * @param[in] monitor_id ID of resource monitor which be returned by resource_monitor_init()
214 * @return @c 0 on success, otherwise a negative error value
215 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
216 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
217 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
218 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
219 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
220 * @see resource_monitor_init()
222 int resource_monitor_exit(int monitor_id);
225 * @brief Gets the count of supported resources according to resource type.
228 * @privilege %http://tizen.org/privilege/systemmonitor
229 * @param[in] monitor_id Resource monitorID
230 * @param[in] resource_type Resource type
231 * @param[out] resource_count Resource count retrieved from resource monitor
232 * @return @c 0 on success, otherwise a negative error value
233 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
234 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
235 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
236 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
237 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
238 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_RESOURCE Unavailable Resource Type
239 * @see resource_monitor_init()
241 int resource_monitor_get_resource_count(int monitor_id, resource_monitor_type_e resource_type, int *resource_count);
244 * @brief Creates resource for given resource_type.
247 * @privilege %http://tizen.org/privilege/systemmonitor
248 * @remarks The @c return value should be released using resource_delete_resource().
249 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
250 * @param[in] resource_type Resource type
251 * @return @c positive integer as resource ID on success, otherwise a negative error value
252 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
253 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
254 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
255 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
256 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
257 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_RESOURCE Unavailable Resource Type
258 * @see resource_monitor_init()
259 * @see resource_monitor_delete_resource()
261 int resource_monitor_create_resource(int monitor_id, resource_monitor_type_e resource_type);
264 * @brief Deletes resource of given resource ID.
267 * @privilege %http://tizen.org/privilege/systemmonitor
268 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
269 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
270 * @return @c 0 on success, otherwise a negative error value
271 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
272 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
273 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
274 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
275 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
276 * @see resource_monitor_init()
277 * @see resource_monitor_create_resource()
279 int resource_monitor_delete_resource(int monitor_id, int resource_id);
282 * @brief Sets the resource control with value which is different according to resource control id.
285 * @privilege %http://tizen.org/privilege/systemmonitor
286 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
287 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
288 * @param[in] ctrl_id Resource control ID
289 * @param[in] value Value for resource control ID
290 * @return @c 0 on success, otherwise a negative error value
291 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
292 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
293 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
294 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
295 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
296 * @see resource_monitor_init()
297 * @see resource_monitor_create_resource()
299 int resource_monitor_set_resource_ctrl(int monitor_id, int resource_id, resource_monitor_ctrl_id_e ctrl_id, int value);
302 * @brief Sets the resource attributes of interest for monitoring.
305 * @privilege %http://tizen.org/privilege/systemmonitor
306 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
307 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
308 * @param[in] attr_mask Attribute mask including the various attributes
309 * @return @c 0 on success, otherwise a negative error value
310 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
311 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
312 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
313 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
314 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
315 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
316 * @see resource_monitor_init()
317 * @see resource_monitor_create_resource()
318 * @see resource_monitor_unset_resource_attr()
320 int resource_monitor_set_resource_attr(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_mask);
323 * @brief Unsets the resource attributes of interest for monitoring.
326 * @privilege %http://tizen.org/privilege/systemmonitor
327 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
328 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
329 * @param[in] attr_mask Attribute mask including the various attributes
330 * @return @c 0 on success, otherwise a negative error value
331 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
332 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
333 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
334 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
335 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
336 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
337 * @see resource_monitor_init()
338 * @see resource_monitor_create_resource()
339 * @see resource_monitor_set_resource_attr()
341 int resource_monitor_unset_resource_attr(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_mask);
344 * @brief Checks whether a resource attribute is supported or not.
347 * @privilege %http://tizen.org/privilege/systemmonitor
348 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
349 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
350 * @param[in] attr_id Resource attribute ID
351 * @param[out] supported Resource attributes is either supported or not (@c true == supported, @c false = not supported)
352 * @return @c 0 on success, otherwise a negative error value
353 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
354 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
355 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
356 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
357 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
358 * @see resource_monitor_init()
359 * @see resource_monitor_create_resource()
360 * @see resource_monitor_set_resource_attr()
362 int resource_monitor_is_resource_attr_supported(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, bool *supported);
365 * @brief Updates the value of attributes of interest for all created resource.
368 * @privilege %http://tizen.org/privilege/systemmonitor
369 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
370 * @return @c 0 on success, otherwise a negative error value
371 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
372 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
373 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
374 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
375 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
376 * @see resource_monitor_init()
377 * @see resource_monitor_create_resource()
378 * @see resource_monitor_set_resource_attr()
379 * @see resource_monitor_set_resource_ctrl()
381 int resource_monitor_update(int monitor_id);
384 * @brief Updates the value of attributes of interest for a resource.
387 * @privilege %http://tizen.org/privilege/systemmonitor
388 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
389 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
390 * @return @c 0 on success, otherwise a negative error value
391 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
392 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
393 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
394 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
395 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
396 * @see resource_monitor_init()
397 * @see resource_monitor_create_resource()
398 * @see resource_monitor_set_resource_attr()
399 * @see resource_monitor_set_resource_ctrl()
401 int resource_monitor_update_resource(int monitor_id, int resource_id);
404 * @brief Gets the int value of resource attribute.
407 * @privilege %http://tizen.org/privilege/systemmonitor
408 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
409 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
410 * @param[in] attr_id Resource attribute ID
411 * @param[out] value Value retrieved from resource attribute
412 * @return @c 0 on success, otherwise a negative error value
413 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
414 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
415 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
416 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
417 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
418 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
419 * @see resource_monitor_init()
420 * @see resource_monitor_create_resource()
421 * @see resource_monitor_set_resource_attr()
422 * @see resource_monitor_set_resource_ctrl()
423 * @see resource_monitor_update()
424 * @see resource_monitor_update_resource()
426 int resource_monitor_get_value_int(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, int32_t *value);
429 * @brief Gets the int64 value of resource attribute.
432 * @privilege %http://tizen.org/privilege/systemmonitor
433 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
434 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
435 * @param[in] attr_id Resource attribute ID
436 * @param[out] value Value retrieved from resource attribute
437 * @return @c 0 on success, otherwise a negative error value
438 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
439 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
440 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
441 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
442 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
443 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
444 * @see resource_monitor_init()
445 * @see resource_monitor_create_resource()
446 * @see resource_monitor_set_resource_attr()
447 * @see resource_monitor_set_resource_ctrl()
448 * @see resource_monitor_update()
449 * @see resource_monitor_update_resource()
451 int resource_monitor_get_value_int64(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, int64_t *value);
454 * @brief Gets the uint32 value of resource attribute.
457 * @privilege %http://tizen.org/privilege/systemmonitor
458 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
459 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
460 * @param[in] attr_id Resource attribute ID
461 * @param[out] value Value retrieved from resource attribute
462 * @return @c 0 on success, otherwise a negative error value
463 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
464 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
465 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
466 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
467 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
468 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
469 * @see resource_monitor_init()
470 * @see resource_monitor_create_resource()
471 * @see resource_monitor_set_resource_attr()
472 * @see resource_monitor_set_resource_ctrl()
473 * @see resource_monitor_update()
474 * @see resource_monitor_update_resource()
476 int resource_monitor_get_value_uint32(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, u_int32_t *value);
479 * @brief Gets the uint64 value of resource attribute.
482 * @privilege %http://tizen.org/privilege/systemmonitor
483 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
484 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
485 * @param[in] attr_id Resource attribute ID
486 * @param[out] value Value retrieved from resource attribute
487 * @return @c 0 on success, otherwise a negative error value
488 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
489 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
490 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
491 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
492 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
493 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
494 * @see resource_monitor_init()
495 * @see resource_monitor_create_resource()
496 * @see resource_monitor_set_resource_attr()
497 * @see resource_monitor_set_resource_ctrl()
498 * @see resource_monitor_update()
499 * @see resource_monitor_update_resource()
501 int resource_monitor_get_value_uint64(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, u_int64_t *value);
504 * @brief Gets the double value of resource attribute.
507 * @privilege %http://tizen.org/privilege/systemmonitor
508 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
509 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
510 * @param[in] attr_id Resource attribute ID
511 * @param[out] value Value retrieved from resource attribute
512 * @return @c 0 on success, otherwise a negative error value
513 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
514 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
515 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
516 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
517 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
518 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
519 * @see resource_monitor_init()
520 * @see resource_monitor_create_resource()
521 * @see resource_monitor_set_resource_attr()
522 * @see resource_monitor_set_resource_ctrl()
523 * @see resource_monitor_update()
524 * @see resource_monitor_update_resource()
526 int resource_monitor_get_value_double(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, double *value);
529 * @brief Gets the string value of resource attribute.
532 * @privilege %http://tizen.org/privilege/systemmonitor
533 * @remarks The @a value should be released using free().
534 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
535 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
536 * @param[in] attr_id Resource attribute ID
537 * @param[out] value Value retrieved from resource attribute
538 * @return @c 0 on success, otherwise a negative error value
539 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
540 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
541 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
542 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
543 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
544 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
545 * @see resource_monitor_init()
546 * @see resource_monitor_create_resource()
547 * @see resource_monitor_set_resource_attr()
548 * @see resource_monitor_set_resource_ctrl()
549 * @see resource_monitor_update()
550 * @see resource_monitor_update_resource()
552 int resource_monitor_get_value_string(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, char **value);
555 * @brief Gets the int array of resource attribute.
558 * @privilege %http://tizen.org/privilege/systemmonitor
559 * @remarks The @a array should be released using free().
560 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
561 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
562 * @param[in] attr_id Resource attribute ID
563 * @param[out] array Array retrieved from resource attribute
564 * @param[out] length Length of array
565 * @return @c 0 on success, otherwise a negative error value
566 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
567 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
568 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
569 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
570 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
571 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
572 * @see resource_monitor_init()
573 * @see resource_monitor_create_resource()
574 * @see resource_monitor_set_resource_attr()
575 * @see resource_monitor_set_resource_ctrl()
576 * @see resource_monitor_update()
577 * @see resource_monitor_update_resource()
579 int resource_monitor_get_array_int(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, int32_t **array, int *length);
582 * @brief Gets the int64 array of resource attribute.
585 * @privilege %http://tizen.org/privilege/systemmonitor
586 * @remarks The @a array should be released using free().
587 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
588 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
589 * @param[in] attr_id Resource attribute ID
590 * @param[out] array Array retrieved from resource attribute
591 * @param[out] length Length of array
592 * @return @c 0 on success, otherwise a negative error value
593 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
594 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
595 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
596 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
597 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
598 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
599 * @see resource_monitor_init()
600 * @see resource_monitor_create_resource()
601 * @see resource_monitor_set_resource_attr()
602 * @see resource_monitor_set_resource_ctrl()
603 * @see resource_monitor_update()
604 * @see resource_monitor_update_resource()
606 int resource_monitor_get_array_int64(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, int64_t **array, int *length);
609 * @brief Gets the uint32 array of resource attribute.
612 * @privilege %http://tizen.org/privilege/systemmonitor
613 * @remarks The @a array should be released using free().
614 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
615 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
616 * @param[in] attr_id Resource attribute ID
617 * @param[out] array Array retrieved from resource attribute
618 * @param[out] length Length of array
619 * @return @c 0 on success, otherwise a negative error value
620 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
621 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
622 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
623 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
624 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
625 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
626 * @see resource_monitor_init()
627 * @see resource_monitor_create_resource()
628 * @see resource_monitor_set_resource_attr()
629 * @see resource_monitor_set_resource_ctrl()
630 * @see resource_monitor_update()
631 * @see resource_monitor_update_resource()
633 int resource_monitor_get_array_uint32(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, u_int32_t **array, int *length);
636 * @brief Gets the uint64 array of resource attribute.
639 * @privilege %http://tizen.org/privilege/systemmonitor
640 * @remarks The @a array should be released using free().
641 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
642 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
643 * @param[in] attr_id Resource attribute ID
644 * @param[out] array Array retrieved from resource attribute
645 * @param[out] length Length of array
646 * @return @c 0 on success, otherwise a negative error value
647 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
648 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
649 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
650 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
651 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
652 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
653 * @see resource_monitor_init()
654 * @see resource_monitor_create_resource()
655 * @see resource_monitor_set_resource_attr()
656 * @see resource_monitor_set_resource_ctrl()
657 * @see resource_monitor_update()
658 * @see resource_monitor_update_resource()
660 int resource_monitor_get_array_uint64(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, u_int64_t **array, int *length);
663 * @brief Gets the double array of resource attribute.
666 * @privilege %http://tizen.org/privilege/systemmonitor
667 * @remarks The @a array should be released using free().
668 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
669 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
670 * @param[in] attr_id Resource attribute ID
671 * @param[out] array Array retrieved from resource attribute
672 * @param[out] length Length of array
673 * @return @c 0 on success, otherwise a negative error value
674 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
675 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
676 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
677 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
678 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
679 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
680 * @see resource_monitor_init()
681 * @see resource_monitor_create_resource()
682 * @see resource_monitor_set_resource_attr()
683 * @see resource_monitor_set_resource_ctrl()
684 * @see resource_monitor_update()
685 * @see resource_monitor_update_resource()
687 int resource_monitor_get_array_double(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, double **array, int *length);
690 * @brief Gets the string array of resource attribute.
693 * @privilege %http://tizen.org/privilege/systemmonitor
694 * @remarks The @a array and each data in the array should be released using free().
695 * @param[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
696 * @param[in] resource_id Resource ID which be returned by resource_monitor_create_resource()
697 * @param[in] attr_id Resource attribute ID
698 * @param[out] array Array retrieved from resource attribute
699 * @param[out] length Length of array
700 * @return @c 0 on success, otherwise a negative error value
701 * @retval #RESOURCE_MONITOR_ERROR_NONE Successful
702 * @retval #RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied
703 * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter
704 * @retval #RESOURCE_MONITOR_ERROR_NO_DATA Empty Data
705 * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
706 * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
707 * @see resource_monitor_init()
708 * @see resource_monitor_create_resource()
709 * @see resource_monitor_set_resource_attr()
710 * @see resource_monitor_set_resource_ctrl()
711 * @see resource_monitor_update()
712 * @see resource_monitor_update_resource()
714 int resource_monitor_get_array_string(int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, char ***array, int *length);
724 #endif /* __TIZEN_SYSTEM_MONITOR_RESOURCE_MONITOR_H__ */