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