cdff291a3f0825bd73cb0053b531c706c2d5fd3e
[platform/core/api/runtime-info.git] / include / runtime_info.h
1 /**
2  * Copyright (c) 2011 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __TIZEN_SYSTEM_RUNTIME_INFO_H__
18 #define __TIZEN_SYSTEM_RUNTIME_INFO_H__
19
20 #include <tizen.h>
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26
27
28 /**
29  * @addtogroup  CAPI_SYSTEM_RUNTIME_INFO_MODULE
30  * @{
31  */
32
33
34 /**
35  * @brief        Enumeration for error codes for runtime information.
36  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
37  */
38 typedef enum {
39         RUNTIME_INFO_ERROR_NONE = TIZEN_ERROR_NONE,                           /**< Successful */
40         RUNTIME_INFO_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
41         RUNTIME_INFO_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,         /**< Out of memory */
42         RUNTIME_INFO_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR,                   /**< An input/output error occurred when read value from system */
43         RUNTIME_INFO_ERROR_REMOTE_IO = TIZEN_ERROR_REMOTE_IO,                 /**< Remote I/O error occurred */
44         RUNTIME_INFO_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< No permission to use the api */
45         RUNTIME_INFO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,         /**< Not supported parameter */
46         RUNTIME_INFO_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA                      /**< No data available (Since 3.0) */
47 } runtime_info_error_e;
48
49
50 /**
51  * @brief        Enumeration for keys for runtime information.
52  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
53  */
54 typedef enum {
55         RUNTIME_INFO_KEY_BLUETOOTH_ENABLED = 2,                 /**<Indicates whether Bluetooth is enabled. */
56         RUNTIME_INFO_KEY_WIFI_HOTSPOT_ENABLED = 3,              /**<Indicates whether Wi-Fi hotspot is enabled. */
57         RUNTIME_INFO_KEY_BLUETOOTH_TETHERING_ENABLED = 4,       /**<Indicates whether Bluetooth tethering is enabled. */
58         RUNTIME_INFO_KEY_USB_TETHERING_ENABLED = 5,             /**<Indicates whether USB tethering is enabled. */
59         RUNTIME_INFO_KEY_PACKET_DATA_ENABLED = 9,               /**<Indicates Whether the packet data through 3G network is enabled. */
60         RUNTIME_INFO_KEY_DATA_ROAMING_ENABLED = 10,             /**<Indicates whether data roaming is enabled. */
61         RUNTIME_INFO_KEY_VIBRATION_ENABLED = 12,                /**<Indicates whether vibration is enabled. */
62         RUNTIME_INFO_KEY_AUDIO_JACK_CONNECTED = 17,             /**<Indicates whether audio jack is connected. */
63         RUNTIME_INFO_KEY_GPS_STATUS = 18,                       /**<Indicates the current status of GPS. */
64         RUNTIME_INFO_KEY_BATTERY_IS_CHARGING = 19,              /**<Indicates the battery is currently charging. */
65         RUNTIME_INFO_KEY_TV_OUT_CONNECTED = 20,                 /**<Indicates whether TV out is connected. */
66         RUNTIME_INFO_KEY_AUDIO_JACK_STATUS = 21,                /**<Indicates the current status of audio jack. */
67         RUNTIME_INFO_KEY_USB_CONNECTED = 23,                    /**<Indicates whether USB is connected. */
68         RUNTIME_INFO_KEY_CHARGER_CONNECTED = 24,                /**<Indicates whether charger is connected. */
69         RUNTIME_INFO_KEY_AUTO_ROTATION_ENABLED = 26,            /**<Indicates whether auto rotation is enabled. */
70 } runtime_info_key_e;
71
72
73 /**
74  * @brief        Enumeration for Wi-Fi status.
75  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
76  */
77 typedef enum {
78         RUNTIME_INFO_WIFI_STATUS_DISABLED,    /**< Wi-Fi is disabled. */
79         RUNTIME_INFO_WIFI_STATUS_UNCONNECTED, /**< Wi-Fi is enabled and network connection is not established. */
80         RUNTIME_INFO_WIFI_STATUS_CONNECTED,   /**< Network connection is established in Wi-Fi network. */
81 } runtime_info_wifi_status_e;
82
83
84 /**
85  * @brief        Enumeration for GPS status.
86  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
87  */
88 typedef enum {
89         RUNTIME_INFO_GPS_STATUS_DISABLED,  /**< GPS is disabled. */
90         RUNTIME_INFO_GPS_STATUS_SEARCHING, /**< GPS is searching for satellites. */
91         RUNTIME_INFO_GPS_STATUS_CONNECTED, /**< GPS connection is established. */
92 } runtime_info_gps_status_e;
93
94 /**
95  * @brief        Enumeration for audio jack status.
96  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
97  */
98 typedef enum {
99         RUNTIME_INFO_AUDIO_JACK_STATUS_UNCONNECTED,     /**< Audio jack is not connected */
100         RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE, /**< 3-conductor wire is connected. */
101         RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_4WIRE, /**< 4-conductor wire is connected. */
102 } runtime_info_audio_jack_status_e;
103
104
105 /**
106  * @brief        Called when the runtime information changes.
107  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
108  *
109  * @param[in] key        The type of notification
110  * @param[in] user_data  The user data passed from the callback registration function
111  *
112  * @pre  runtime_info_set_changed_cb() will invoke this callback function.
113  * @see  runtime_info_set_changed_cb()
114  * @see  runtime_info_unset_changed_cb()
115  */
116 typedef void (*runtime_info_changed_cb)(runtime_info_key_e key, void *user_data);
117
118
119 /**
120  * @brief        Gets the integer value of the runtime information.
121  * @details      This function gets current state of the given key which represents specific runtime information.
122  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
123  *
124  * @param[in]  key    The runtime information status key from which data should be read
125  * @param[out] value  The current value of the given key
126  *
127  * @return  @c 0 on success,
128  *          otherwise a negative error value
129  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
130  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
131  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An input/output error occurred when read value from system
132  * @retval #RUNTIME_INFO_ERROR_PERMISSION_DENIED  No permission to use the api
133  * @retval #RUNTIME_INFO_ERROR_NOT_SUPPORTED      Not supported parameter
134  */
135 int runtime_info_get_value_int(runtime_info_key_e key, int *value);
136
137
138 /**
139  * @brief        Gets the boolean value from the runtime information.
140  * @details      This function gets current state of the given key which represents specific runtime information.
141  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
142  *
143  * @param[in]  key    The runtime information key from which data should be read
144  * @param[out] value  The current value of the given key
145  *
146  * @return  @c 0 on success,
147  *          otherwise a negative error value
148  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
149  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
150  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An input/output error occurred when read value from system
151  * @retval #RUNTIME_INFO_ERROR_PERMISSION_DENIED  No permission to use the api
152  * @retval #RUNTIME_INFO_ERROR_NOT_SUPPORTED      Not supported parameter
153  */
154 int runtime_info_get_value_bool(runtime_info_key_e key, bool *value);
155
156
157 /**
158  * @brief        Gets the double value from the runtime information.
159  * @details      This function gets current state of the given key which represents specific runtime information.
160  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
161  *
162  * @param[in]  key    The runtime information key from which data should be read
163  * @param[out] value  The current value of the given key
164  *
165  * @return  @c 0 on success,
166  *          otherwise a negative error value
167  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
168  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
169  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An input/output error occurred when read value from system
170  * @retval #RUNTIME_INFO_ERROR_PERMISSION_DENIED  No permission to use the api
171  * @retval #RUNTIME_INFO_ERROR_NOT_SUPPORTED      Not supported parameter
172  */
173 int runtime_info_get_value_double(runtime_info_key_e key, double *value);
174
175
176 /**
177  * @brief        Gets the string value for specified runtime information.
178  * @details      This function gets current state of the given key which represents specific runtime information.
179  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
180  *
181  * @remarks  You must release @a value using free().
182  *
183  * @param[in]  key    The runtime information key from which data should be read
184  * @param[out] value  The current value of the given key
185  *
186  * @return  @c 0 on success,
187  *          otherwise a negative error value
188  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
189  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
190  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An input/output error occurred when read value from system
191  * @retval #RUNTIME_INFO_ERROR_OUT_OF_MEMORY      Out of memory
192  * @retval #RUNTIME_INFO_ERROR_PERMISSION_DENIED  No permission to use the api
193  * @retval #RUNTIME_INFO_ERROR_NOT_SUPPORTED      Not supported parameter
194  */
195 int runtime_info_get_value_string(runtime_info_key_e key, char **value);
196
197
198 /**
199  * @brief        Registers a change event callback for given runtime information key.
200  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
201  *
202  * @param[in] key        The runtime information type
203  * @param[in] callback   The callback function to invoke
204  * @param[in] user_data  The user data to be passed to the callback function
205  *
206  * @return  @c 0 on success,
207  *          otherwise a negative error value
208  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
209  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
210  * @retval #RUNTIME_INFO_ERROR_PERMISSION_DENIED  No permission to use the api
211  * @retval #RUNTIME_INFO_ERROR_NOT_SUPPORTED      Not supported parameter
212  *
213  * @post  runtime_info_changed_cb() will be invoked.
214  * @see   runtime_info_unset_changed_cb()
215  * @see   runtime_info_changed_cb()
216 */
217 int runtime_info_set_changed_cb(runtime_info_key_e key, runtime_info_changed_cb callback, void *user_data);
218
219
220 /**
221  * @brief        Unregisters the callback function.
222  * @since_tizen  @if WEARABLE 2.3.1 @else 2.3 @endif
223  *
224  * @param[in] key  The runtime information type
225  *
226  * @return  @c 0 on success,
227  *          otherwise a negative error value
228  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
229  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
230  *
231  * @see  runtime_info_set_changed_cb()
232  */
233 int runtime_info_unset_changed_cb(runtime_info_key_e key);
234
235
236 /**
237  * @brief        Structure for memory information.
238  * @since_tizen  @if WEARABLE 3.0 @else 2.4 @endif
239  */
240 typedef struct {
241         int total; /**< Total memory (KiB) */
242         int used;  /**< Used memory (KiB) */
243         int free;  /**< Free memory (KiB) */
244         int cache; /**< Cache memory (KiB) */
245         int swap;  /**< Swap memory (KiB) */
246 } runtime_memory_info_s;
247
248
249 /**
250  * @brief        Gets system memory information.
251  * @since_tizen  @if WEARABLE 3.0 @else 2.4 @endif
252  *
253  * @param[out] info  The system memory information structure
254  *
255  * @return  @c 0 on success,
256  *          otherwise a negative error value
257  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
258  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
259  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An Input/Output error occurred while reading from system
260  *
261  * @see  runtime_info_get_process_memory_info()
262  */
263 int runtime_info_get_system_memory_info(runtime_memory_info_s *info);
264
265
266 /**
267  * @brief        Structure for memory information per process.
268  * @since_tizen  @if WEARABLE 3.0 @else 2.4 @endif
269  */
270 typedef struct {
271         int vsz;           /**< Virtual memory size (KiB) */
272         int rss;           /**< Resident set size (KiB) */
273         int pss;           /**< Proportional set size (KiB) */
274         int shared_clean;  /**< Not modified and mapped by other processes (KiB) */
275         int shared_dirty;  /**< Modified and mapped by other processes (KiB) */
276         int private_clean; /**< Not modified and available only to that process (KiB) */
277         int private_dirty; /**< Modified and available only to that process (KiB) */
278 } process_memory_info_s;
279
280
281 /**
282  * @brief        Gets memory information per process.
283  * @since_tizen  @if WEARABLE 3.0 @else 2.4 @endif
284  *
285  * @privlevel  public
286  * @privilege  %http://tizen.org/privilege/systemmonitor
287  * @remarks    You must release @a s value using free(). \n
288  *             The size of @a s is the same with @a size.
289  *
290  * @param[in]  pid   The process unique id array
291  * @param[in]  size  The size of pid array
292  * @param[out] info  The memory information structure array of the processes
293  *
294  * @return  @c 0 on success,
295  *          otherwise a negative error value
296  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
297  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
298  * @retval #RUNTIME_INFO_ERROR_OUT_OF_MEMORY      Not able to allocate memory (for output param/other operations)
299  * @retval #RUNTIME_INFO_ERROR_REMOTE_IO          Call to resource daemon failed (dbus errors/resource daemon errors)
300  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An I/O error during dbus message operations
301  * @retval #RUNTIME_INFO_ERROR_PERMISSION_DENIED  Process not authorized to request process usage info
302  *
303  * @see  runtime_info_get_system_memory_info()
304  */
305 int runtime_info_get_process_memory_info(int *pid, int size, process_memory_info_s **info);
306
307
308 /**
309  * @brief        Structure for CPU usage.
310  * @since_tizen  @if WEARABLE 3.0 @else 2.4 @endif
311  */
312 typedef struct {
313         double user;   /**< Time running un-niced user processes (Percent) */
314         double system; /**< Time running kernel processes (Percent) */
315         double nice;   /**< Time running niced user processes (Percent) */
316         double iowait; /**< Time waiting for I/O completion (Percent) */
317 } runtime_cpu_usage_s;
318
319
320 /**
321  * @brief        Gets CPU information.
322  * @since_tizen  @if WEARABLE 3.0 @else 2.4 @endif
323  *
324  * @param[out] usage  The CPU usage structure
325  *
326  * @return  @c 0 on success,
327  *          otherwise a negative error value
328  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
329  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
330  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An input/output error occurred while reading from system
331  *
332  * @see  runtime_info_get_process_cpu_usage()
333  */
334 int runtime_info_get_cpu_usage(runtime_cpu_usage_s *usage);
335
336
337 /**
338  * @brief        Structure for CPU usage per process.
339  * @since_tizen  @if WEARABLE 3.0 @else 2.4 @endif
340  */
341 typedef struct {
342         int utime; /**< Amount of time that this process has been scheduled in user mode (clock ticks) */
343         int stime; /**< Amount of time that this process has been scheduled in kernel mode (clock ticks) */
344 } process_cpu_usage_s;
345
346
347 /**
348  * @brief        Gets CPU usage per process.
349  * @since_tizen  @if WEARABLE 3.0 @else 2.4 @endif
350  *
351  * @privlevel  public
352  * @privilege  %http://tizen.org/privilege/systemmonitor
353  * @remarks    You must release @a s value using free(). \n
354  *             The size of @a s is the same with @a size.
355  *
356  * @param[in]  pid   The process unique id array
357  * @param[in]  size  The size of pid array
358  * @param[out] usage The CPU usage structure array of the processes
359  *
360  * @return  @c 0 on success,
361  *          otherwise a negative error value
362  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
363  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
364  * @retval #RUNTIME_INFO_ERROR_OUT_OF_MEMORY      Not able to allocate memory (for output param/other operations)
365  * @retval #RUNTIME_INFO_ERROR_REMOTE_IO          Call to resource daemon failed (dbus errors/resource daemon errors)
366  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An I/O error occurred (during dbus message operations/other IO operations)
367  * @retval #RUNTIME_INFO_ERROR_PERMISSION_DENIED  Process not authorized to request process usage info
368  *
369  * @see  runtime_info_get_cpu_usage()
370  */
371 int runtime_info_get_process_cpu_usage(int *pid, int size, process_cpu_usage_s **usage);
372
373
374 /**
375  * @brief        Gets the number of processors.
376  * @since_tizen  3.0
377  *
378  * @param[out] num_core  The number of whole processors
379  *
380  * @return  @c 0 on success,
381  *          otherwise a negative error value
382  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
383  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
384  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An I/O error occurred (during file open operation)
385  */
386 int runtime_info_get_processor_count(int *num_core);
387
388
389 /**
390  * @brief        Gets the current frequency of processor.
391  * @since_tizen  3.0
392  *
393  * @param[in]  core_idx  The index (from 0) of CPU core that you want to know the frequency
394  * @param[out] cpu_freq  The current frequency(MHz) of processor
395  *
396  * @return  @c 0 on success,
397  *          otherwise a negative error value
398  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
399  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
400  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An I/O error occurred (during file open operation)
401  * @retval #RUNTIME_INFO_ERROR_NO_DATA            No data available (Since 3.0)
402  */
403 int runtime_info_get_processor_current_frequency(int core_idx, int *cpu_freq);
404
405
406 /**
407  * @brief        Gets the max frequency of processor.
408  * @since_tizen  3.0
409  *
410  * @param[in]  core_idx  The index (from 0) of CPU core that you want to know the frequency
411  * @param[out] cpu_freq  The max frequency(MHz) of processor
412  *
413  * @return  @c 0 on success,
414  *          otherwise a negative error value
415  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
416  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
417  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An I/O error occurred (during file open operation)
418  * @retval #RUNTIME_INFO_ERROR_NO_DATA            No data available (Since 3.0)
419  */
420 int runtime_info_get_processor_max_frequency(int core_idx, int *cpu_freq);
421
422
423 /**
424  * @brief        Gets the physical memory size.
425  * @since_tizen  4.0
426  *
427  * @param[out] size  Physical memory size (KiB)
428  *
429  * @return  @c 0 on success,
430  *          otherwise a negative error value
431  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
432  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
433  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An I/O error occurred (during file open operation)
434  */
435 int runtime_info_get_physical_memory_size(int *size);
436
437
438 /**
439  * @brief        Handle for app usage information.
440  * @since_tizen  4.0
441  */
442 typedef struct app_usages_s *app_usage_h;
443
444
445 /**
446  * @brief        Frees an app usage handle.
447  * @since_tizen  4.0
448  *
449  * @param[in] handle  App usage handle to free
450  *
451  * @return  @c 0 on success,
452  *          otherwise a negative error value
453  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
454  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
455  */
456 int runtime_info_app_usage_destroy(app_usage_h handle);
457
458
459 /**
460  * @brief        Gets the app count from an app usage handle.
461  * @since_tizen  4.0
462  *
463  * @param[in]  handle  The app usage handle
464  * @param[out] count   The number of apps on the app list
465  *
466  * @return  @c 0 on success,
467  *          otherwise a negative error value
468  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
469  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
470  *
471  * @see  runtime_info_get_all_apps_memory_usage()
472  * @see  runtime_info_get_all_apps_cpu_rate()
473  */
474 int runtime_info_app_usage_get_count(app_usage_h handle, int *count);
475
476
477 /**
478  * @brief        Gets the app ID from an app usage handle.
479  * @since_tizen  4.0
480  *
481  * @remarks  You must release @a appid using free().
482  *
483  * @param[in]  handle  The app usage handle
484  * @param[in]  index   The index in the app list; should be between 0 and @a count - 1 (inclusive), \n
485  *                     where @a count is provided by runtime_info_app_usage_get_count()
486  * @param[out] appid   The app ID
487  *
488  * @return  @c 0 on success,
489  *          otherwise a negative error value
490  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
491  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
492  *
493  * @see  runtime_info_get_all_apps_memory_usage()
494  * @see  runtime_info_get_all_apps_cpu_rate()
495  */
496 int runtime_info_app_usage_get_appid(app_usage_h handle, int index, char **appid);
497
498
499 /**
500  * @brief        Gets resource usage from an app usage handle.
501  * @since_tizen  4.0
502  *
503  * @remarks  The meaning of @a usage depends on which function was used to create @a handle.
504  *
505  * @param[in]  handle  The app usage handle
506  * @param[in]  index   The index in the app list; should be between 0 and @a count - 1 (inclusive), \n
507  *                     where @a count is provided by runtime_info_app_usage_get_count()
508  * @param[out] usage   Resource usage
509  *
510  * @return  @c 0 on success,
511  *          otherwise a negative error value
512  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
513  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
514  *
515  * @see  runtime_info_get_all_apps_memory_usage()
516  * @see  runtime_info_get_all_apps_cpu_rate()
517  */
518 int runtime_info_app_usage_get_usage(app_usage_h handle, int index, unsigned int *usage);
519
520
521 /**
522  * @brief        Gets memory usage of all apps.
523  * @since_tizen  4.0
524  *
525  * @privlevel  public
526  * @privilege  %http://tizen.org/privilege/systemmonitor
527  * @remarks    You must release @a usage using runtime_info_app_usage_destroy().
528  *
529  * @param[out] usage  An array of each app's memory usage (KB)
530  *
531  * @return  @c 0 on success,
532  *          otherwise a negative error value
533  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
534  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
535  * @retval #RUNTIME_INFO_ERROR_OUT_OF_MEMORY      Not able to allocate memory (for output param/other operations)
536  * @retval #RUNTIME_INFO_ERROR_REMOTE_IO          Call to resource daemon failed (dbus errors/resource daemon errors)
537  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An I/O error during dbus message operations
538  * @retval #RUNTIME_INFO_ERROR_PERMISSION_DENIED  Process not authorized to request app usage info
539  * @retval #RUNTIME_INFO_ERROR_NO_DATA            No app running
540  *
541  * @code
542  * #include <runtime_info.h>
543  *
544  * void print_memory_usage(void)
545  * {
546  *     int i;
547  *     int count;
548  *     app_usage_h mem_usage_handle;
549  *     char *appid;
550  *     unsigned int usage;
551  *
552  *     runtime_info_get_all_apps_memory_usage(&mem_usage_handle);
553  *     runtime_info_app_usage_get_count(mem_usage_handle, &count);
554  *
555  *     for (i = 0; i < count; i++) {
556  *         runtime_info_app_usage_get_appid(mem_usage_handle, i, &appid);
557  *         runtime_info_app_usage_get_usage(mem_usage_handle, i, &usage);
558  *         printf("appid = %s, usage = %u KB\n", appid, usage);
559  *         free(appid);
560  *     }
561  *
562  *     runtime_info_app_usage_destroy(mem_usage_handle);
563  *
564  * }
565  * @endcode
566  */
567 int runtime_info_get_all_apps_memory_usage(app_usage_h *usage);
568
569
570 /**
571  * @brief        Gets CPU rate of all apps.
572  * @since_tizen  4.0
573  *
574  * @privlevel  public
575  * @privilege  %http://tizen.org/privilege/systemmonitor
576  * @remarks    You must release @a rate using runtime_info_app_usage_destroy().
577  *
578  * @param[out] rate  An array of each app's CPU usage rate (%), the values are rounded down.
579  *
580  * @return  @c 0 on success,
581  *          otherwise a negative error value
582  * @retval #RUNTIME_INFO_ERROR_NONE               Successful
583  * @retval #RUNTIME_INFO_ERROR_INVALID_PARAMETER  Invalid parameter
584  * @retval #RUNTIME_INFO_ERROR_OUT_OF_MEMORY      Not able to allocate memory (for output param/other operations)
585  * @retval #RUNTIME_INFO_ERROR_REMOTE_IO          Call to resource daemon failed (dbus errors/resource daemon errors)
586  * @retval #RUNTIME_INFO_ERROR_IO_ERROR           An I/O error during dbus message operations
587  * @retval #RUNTIME_INFO_ERROR_PERMISSION_DENIED  Process not authorized to request app usage info
588  * @retval #RUNTIME_INFO_ERROR_NO_DATA            No app running
589  *
590  * @code
591  * #include <runtime_info.h>
592  *
593  * void print_cpu_usage(void)
594  * {
595  *     int i;
596  *     int count;
597  *     app_usage_h cpu_rate_handle;
598  *     char *appid;
599  *     unsigned int rate;
600  *
601  *     runtime_info_get_all_apps_cpu_rate(&cpu_rate_handle);
602  *     runtime_info_app_usage_get_count(cpu_rate_handle, &count);
603  *
604  *     for (i = 0; i < count; i++) {
605  *         runtime_info_app_usage_get_appid(cpu_rate_handle, i, &appid);
606  *         runtime_info_app_usage_get_usage(cpu_rate_handle, i, &rate);
607  *         printf("appid = %s, rate = %u %%\n", appid, rate);
608  *         free(appid);
609  *     }
610  *
611  *     runtime_info_app_usage_destroy(cpu_rate_handle);
612  *
613  * }
614  * @endcode
615  */
616 int runtime_info_get_all_apps_cpu_rate(app_usage_h *rate);
617
618
619 /**
620  * @}
621  */
622
623 #ifdef __cplusplus
624 }
625 #endif
626
627 #endif /** __TIZEN_SYSTEM_RUNTIME_INFO_H__ */