| 
    Tizen Native API
    5.5
    
   
   | 
  
  
  
 
The Runtime Information API provides functions to obtain runtime information.
#include <runtime_info.h>
The Runtime Information API provides functions to obtain runtime information, containing miscellaneous system preference. The Runtime Information available is stored in key/value pairs, where there may be different data types for the value. The runtime_info_set_changed_cb() registers a callback function for a particular key, which will be invoked by the System Service if the state matching that key changes.
Functions | |
| int | runtime_info_get_value_int (runtime_info_key_e key, int *value) | 
| Gets the integer value of the runtime information.   | |
| int | runtime_info_get_value_bool (runtime_info_key_e key, bool *value) | 
| Gets the boolean value from the runtime information.   | |
| int | runtime_info_get_value_double (runtime_info_key_e key, double *value) | 
| Gets the double value from the runtime information.   | |
| int | runtime_info_get_value_string (runtime_info_key_e key, char **value) | 
| Gets the string value for specified runtime information.   | |
| int | runtime_info_set_changed_cb (runtime_info_key_e key, runtime_info_changed_cb callback, void *user_data) | 
| Registers a change event callback for given runtime information key.   | |
| int | runtime_info_unset_changed_cb (runtime_info_key_e key) | 
| Unregisters the callback function.   | |
| int | runtime_info_get_system_memory_info (runtime_memory_info_s *info) | 
| Gets system memory information.   | |
| int | runtime_info_get_process_memory_info (int *pid, int size, process_memory_info_s **info) | 
| Gets memory information per process.   | |
| int | runtime_info_get_cpu_usage (runtime_cpu_usage_s *usage) | 
| Gets CPU information.   | |
| int | runtime_info_get_process_cpu_usage (int *pid, int size, process_cpu_usage_s **usage) | 
| Gets CPU usage per process.   | |
| int | runtime_info_get_processor_count (int *num_core) | 
| Gets the number of processors.   | |
| int | runtime_info_get_processor_current_frequency (int core_idx, int *cpu_freq) | 
| Gets the current frequency of processor.   | |
| int | runtime_info_get_processor_max_frequency (int core_idx, int *cpu_freq) | 
| Gets the max frequency of processor.   | |
| int | runtime_info_get_physical_memory_size (int *size) | 
| Gets the physical memory size.   | |
| int | runtime_info_app_usage_destroy (app_usage_h handle) | 
| Frees an app usage handle.   | |
| int | runtime_info_app_usage_get_count (app_usage_h handle, int *count) | 
| Gets the app count from an app usage handle.   | |
| int | runtime_info_app_usage_get_appid (app_usage_h handle, int index, char **appid) | 
| Gets the app ID from an app usage handle.   | |
| int | runtime_info_app_usage_get_usage (app_usage_h handle, int index, unsigned int *usage) | 
| Gets resource usage from an app usage handle.   | |
| int | runtime_info_get_all_apps_memory_usage (app_usage_h *usage) | 
| Gets memory usage of all apps.   | |
| int | runtime_info_get_all_apps_cpu_rate (app_usage_h *rate) | 
| Gets CPU rate of all apps.   | |
Typedefs | |
| typedef void(* | runtime_info_changed_cb )(runtime_info_key_e key, void *user_data) | 
| Called when the runtime information changes.   | |
| typedef struct app_usages_s * | app_usage_h | 
| Handle for app usage information.   | |
| typedef struct app_usages_s* app_usage_h | 
Handle for app usage information.
| typedef void(* runtime_info_changed_cb)(runtime_info_key_e key, void *user_data) | 
Called when the runtime information changes.
| [in] | key | The type of notification | 
| [in] | user_data | The user data passed from the callback registration function | 
| enum runtime_info_error_e | 
Enumeration for error codes for runtime information.
| enum runtime_info_key_e | 
Enumeration for keys for runtime information.
| int runtime_info_app_usage_destroy | ( | app_usage_h | handle | ) | 
Frees an app usage handle.
| [in] | handle | App usage handle to free | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| int runtime_info_app_usage_get_appid | ( | app_usage_h | handle, | 
| int | index, | ||
| char ** | appid | ||
| ) | 
Gets the app ID from an app usage handle.
| [in] | handle | The app usage handle | 
| [in] | index | The index in the app list; should be between 0 and count - 1 (inclusive),  where count is provided by runtime_info_app_usage_get_count()  | 
| [out] | appid | The app ID | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| int runtime_info_app_usage_get_count | ( | app_usage_h | handle, | 
| int * | count | ||
| ) | 
Gets the app count from an app usage handle.
| [in] | handle | The app usage handle | 
| [out] | count | The number of apps on the app list | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| int runtime_info_app_usage_get_usage | ( | app_usage_h | handle, | 
| int | index, | ||
| unsigned int * | usage | ||
| ) | 
Gets resource usage from an app usage handle.
| [in] | handle | The app usage handle | 
| [in] | index | The index in the app list; should be between 0 and count - 1 (inclusive),  where count is provided by runtime_info_app_usage_get_count()  | 
| [out] | usage | Resource usage | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| int runtime_info_get_all_apps_cpu_rate | ( | app_usage_h * | rate | ) | 
Gets CPU rate of all apps.
| [out] | rate | An array of each app's CPU usage rate (%), the values are rounded down. | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_OUT_OF_MEMORY | Not able to allocate memory (for output param/other operations) | 
| RUNTIME_INFO_ERROR_REMOTE_IO | Call to resource daemon failed (dbus errors/resource daemon errors) | 
| RUNTIME_INFO_ERROR_IO_ERROR | An I/O error during dbus message operations | 
| RUNTIME_INFO_ERROR_PERMISSION_DENIED | Process not authorized to request app usage info | 
| RUNTIME_INFO_ERROR_NO_DATA | No app running | 
#include <runtime_info.h> void print_cpu_usage(void) { int i; int count; app_usage_h cpu_rate_handle; char *appid; unsigned int rate; runtime_info_get_all_apps_cpu_rate(&cpu_rate_handle); runtime_info_app_usage_get_count(cpu_rate_handle, &count); for (i = 0; i < count; i++) { runtime_info_app_usage_get_appid(cpu_rate_handle, i, &appid); runtime_info_app_usage_get_usage(cpu_rate_handle, i, &rate); printf("appid = %s, rate = %u %%\n", appid, rate); free(appid); } runtime_info_app_usage_destroy(cpu_rate_handle); }
| int runtime_info_get_all_apps_memory_usage | ( | app_usage_h * | usage | ) | 
Gets memory usage of all apps.
| [out] | usage | An array of each app's memory usage (KB) | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_OUT_OF_MEMORY | Not able to allocate memory (for output param/other operations) | 
| RUNTIME_INFO_ERROR_REMOTE_IO | Call to resource daemon failed (dbus errors/resource daemon errors) | 
| RUNTIME_INFO_ERROR_IO_ERROR | An I/O error during dbus message operations | 
| RUNTIME_INFO_ERROR_PERMISSION_DENIED | Process not authorized to request app usage info | 
| RUNTIME_INFO_ERROR_NO_DATA | No app running | 
#include <runtime_info.h> void print_memory_usage(void) { int i; int count; app_usage_h mem_usage_handle; char *appid; unsigned int usage; runtime_info_get_all_apps_memory_usage(&mem_usage_handle); runtime_info_app_usage_get_count(mem_usage_handle, &count); for (i = 0; i < count; i++) { runtime_info_app_usage_get_appid(mem_usage_handle, i, &appid); runtime_info_app_usage_get_usage(mem_usage_handle, i, &usage); printf("appid = %s, usage = %u KB\n", appid, usage); free(appid); } runtime_info_app_usage_destroy(mem_usage_handle); }
| int runtime_info_get_cpu_usage | ( | runtime_cpu_usage_s * | usage | ) | 
Gets CPU information.
| [out] | usage | The CPU usage structure | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An input/output error occurred while reading from system | 
| int runtime_info_get_physical_memory_size | ( | int * | size | ) | 
Gets the physical memory size.
| [out] | size | Physical memory size (KiB) | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An I/O error occurred (during file open operation) | 
| int runtime_info_get_process_cpu_usage | ( | int * | pid, | 
| int | size, | ||
| process_cpu_usage_s ** | usage | ||
| ) | 
Gets CPU usage per process.
| [in] | pid | The process unique id array | 
| [in] | size | The size of pid array | 
| [out] | usage | The CPU usage structure array of the processes | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_OUT_OF_MEMORY | Not able to allocate memory (for output param/other operations) | 
| RUNTIME_INFO_ERROR_REMOTE_IO | Call to resource daemon failed (dbus errors/resource daemon errors) | 
| RUNTIME_INFO_ERROR_IO_ERROR | An I/O error occurred (during dbus message operations/other IO operations) | 
| RUNTIME_INFO_ERROR_PERMISSION_DENIED | Process not authorized to request process usage info | 
| int runtime_info_get_process_memory_info | ( | int * | pid, | 
| int | size, | ||
| process_memory_info_s ** | info | ||
| ) | 
Gets memory information per process.
| [in] | pid | The process unique id array | 
| [in] | size | The size of pid array | 
| [out] | info | The memory information structure array of the processes | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_OUT_OF_MEMORY | Not able to allocate memory (for output param/other operations) | 
| RUNTIME_INFO_ERROR_REMOTE_IO | Call to resource daemon failed (dbus errors/resource daemon errors) | 
| RUNTIME_INFO_ERROR_IO_ERROR | An I/O error during dbus message operations | 
| RUNTIME_INFO_ERROR_PERMISSION_DENIED | Process not authorized to request process usage info | 
| int runtime_info_get_processor_count | ( | int * | num_core | ) | 
Gets the number of processors.
| [out] | num_core | The number of whole processors | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An I/O error occurred (during file open operation) | 
| int runtime_info_get_processor_current_frequency | ( | int | core_idx, | 
| int * | cpu_freq | ||
| ) | 
Gets the current frequency of processor.
| [in] | core_idx | The index (from 0) of CPU core that you want to know the frequency | 
| [out] | cpu_freq | The current frequency(MHz) of processor | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An I/O error occurred (during file open operation) | 
| RUNTIME_INFO_ERROR_NO_DATA | No data available (Since 3.0) | 
| int runtime_info_get_processor_max_frequency | ( | int | core_idx, | 
| int * | cpu_freq | ||
| ) | 
Gets the max frequency of processor.
| [in] | core_idx | The index (from 0) of CPU core that you want to know the frequency | 
| [out] | cpu_freq | The max frequency(MHz) of processor | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An I/O error occurred (during file open operation) | 
| RUNTIME_INFO_ERROR_NO_DATA | No data available (Since 3.0) | 
| int runtime_info_get_system_memory_info | ( | runtime_memory_info_s * | info | ) | 
Gets system memory information.
| [out] | info | The system memory information structure | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An Input/Output error occurred while reading from system | 
| int runtime_info_get_value_bool | ( | runtime_info_key_e | key, | 
| bool * | value | ||
| ) | 
Gets the boolean value from the runtime information.
This function gets current state of the given key which represents specific runtime information.
| [in] | key | The runtime information key from which data should be read | 
| [out] | value | The current value of the given key | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An input/output error occurred when read value from system | 
| RUNTIME_INFO_ERROR_PERMISSION_DENIED | No permission to use the api | 
| RUNTIME_INFO_ERROR_NOT_SUPPORTED | Not supported parameter | 
| int runtime_info_get_value_double | ( | runtime_info_key_e | key, | 
| double * | value | ||
| ) | 
Gets the double value from the runtime information.
This function gets current state of the given key which represents specific runtime information.
| [in] | key | The runtime information key from which data should be read | 
| [out] | value | The current value of the given key | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An input/output error occurred when read value from system | 
| RUNTIME_INFO_ERROR_PERMISSION_DENIED | No permission to use the api | 
| RUNTIME_INFO_ERROR_NOT_SUPPORTED | Not supported parameter | 
| int runtime_info_get_value_int | ( | runtime_info_key_e | key, | 
| int * | value | ||
| ) | 
Gets the integer value of the runtime information.
This function gets current state of the given key which represents specific runtime information.
| [in] | key | The runtime information status key from which data should be read | 
| [out] | value | The current value of the given key | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An input/output error occurred when read value from system | 
| RUNTIME_INFO_ERROR_PERMISSION_DENIED | No permission to use the api | 
| RUNTIME_INFO_ERROR_NOT_SUPPORTED | Not supported parameter | 
| int runtime_info_get_value_string | ( | runtime_info_key_e | key, | 
| char ** | value | ||
| ) | 
Gets the string value for specified runtime information.
This function gets current state of the given key which represents specific runtime information.
| [in] | key | The runtime information key from which data should be read | 
| [out] | value | The current value of the given key | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_IO_ERROR | An input/output error occurred when read value from system | 
| RUNTIME_INFO_ERROR_OUT_OF_MEMORY | Out of memory | 
| RUNTIME_INFO_ERROR_PERMISSION_DENIED | No permission to use the api | 
| RUNTIME_INFO_ERROR_NOT_SUPPORTED | Not supported parameter | 
| int runtime_info_set_changed_cb | ( | runtime_info_key_e | key, | 
| runtime_info_changed_cb | callback, | ||
| void * | user_data | ||
| ) | 
Registers a change event callback for given runtime information key.
| [in] | key | The runtime information type | 
| [in] | callback | The callback function to invoke | 
| [in] | user_data | The user data to be passed to the callback function | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter | 
| RUNTIME_INFO_ERROR_PERMISSION_DENIED | No permission to use the api | 
| RUNTIME_INFO_ERROR_NOT_SUPPORTED | Not supported parameter | 
| int runtime_info_unset_changed_cb | ( | runtime_info_key_e | key | ) | 
Unregisters the callback function.
| [in] | key | The runtime information type | 
0 on success, otherwise a negative error value | RUNTIME_INFO_ERROR_NONE | Successful | 
| RUNTIME_INFO_ERROR_INVALID_PARAMETER | Invalid parameter |