Tizen Native API
9.0
|
The Resource Monitor API provides functions for monitoring the devices such as CPU, GPU, Bus, Disk, System and so on.
Required Header
#include <system/resource-monitor.h>
Overview
The Resource Monitor API provides a set of functions to monitor the resources. It is required to monitor the various resources at the same time.
Each resource has the different monitoring data aka the resource attribute. The user of Resource Monitor API is able to select both the monitored resources and the monitored resource attributes they want before monitoring. Finally, the user can get the monitored value set they want at the same time.
The user is able to know the system status by analyzing the monitored data set. Also, the analysis of system status will be used to optimize the platform and application.
The Resource Monitor API allows to monitor the following resource types:
- CPU
- Bus
- GPU
- Memory
- Battery
- Display
- System
- Disk
Functions | |
int | resource_monitor_init (void) |
Initializes the resource monitor which monitors the physical and logical resource. | |
int | resource_monitor_exit (int monitor_id) |
Exits the resource monitor to finish the monitoring of physical and logical resource. | |
int | resource_monitor_get_resource_count (int monitor_id, resource_monitor_type_e resource_type, int *resource_count) |
Gets the count of supported resources according to resource type. | |
int | resource_monitor_create_resource (int monitor_id, resource_monitor_type_e resource_type) |
Creates resource for given resource_type which indicates the one of various resource type. | |
int | resource_monitor_delete_resource (int monitor_id, int resource_id) |
Deletes resource of given resource ID which indicates the resource instance. | |
int | resource_monitor_set_resource_ctrl (int monitor_id, int resource_id, resource_monitor_ctrl_id_e ctrl_id, int value) |
Sets the resource control with value which is different according to resource control id. | |
int | resource_monitor_set_resource_attr (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_mask) |
Sets the resource attributes of interest for monitoring. | |
int | resource_monitor_unset_resource_attr (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_mask) |
Unsets the resource attributes of interest for monitoring. | |
int | resource_monitor_is_resource_attr_supported (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, bool *supported) |
Checks whether a resource attribute is supported or not. | |
int | resource_monitor_update (int monitor_id) |
Updates the value of attributes of interest for all created resource. | |
int | resource_monitor_update_resource (int monitor_id, int resource_id) |
Updates the value of attributes of interest for a resource. | |
int | resource_monitor_get_value_int (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, int32_t *value) |
Gets the int value of resource attribute which indicates one characteristics of resource. | |
int | resource_monitor_get_value_int64 (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, int64_t *value) |
Gets the int64 value of resource attribute which indicates one characteristics of resource. | |
int | resource_monitor_get_value_uint32 (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, u_int32_t *value) |
Gets the uint32 value of resource attribute which indicates one characteristics of resource. | |
int | resource_monitor_get_value_uint64 (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, u_int64_t *value) |
Gets the uint64 value of resource attribute which indicates one characteristics of resource. | |
int | resource_monitor_get_value_double (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, double *value) |
Gets the double value of resource attribute which indicates one characteristics of resource. | |
int | resource_monitor_get_value_string (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, char **value) |
Gets the string value of resource attribute which indicates one characteristics of resource. | |
int | resource_monitor_get_array_int (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, int32_t **array, int *length) |
Gets the int array of resource attribute which indicates one characteristics of resource. | |
int | resource_monitor_get_array_int64 (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, int64_t **array, int *length) |
Gets the int64 array of resource attribute which indicates one characteristics of resource. | |
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) |
Gets the uint32 array of resource attribute which indicates one characteristics of resource. | |
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) |
Gets the uint64 array of resource attribute which indicates one characteristics of resource. | |
int | resource_monitor_get_array_double (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, double **array, int *length) |
Gets the double array of resource attribute which indicates one characteristics of resource. | |
int | resource_monitor_get_array_string (int monitor_id, int resource_id, resource_monitor_attr_id_e attr_id, char ***array, int *length) |
Gets the string array of resource attribute which indicates one characteristics of resource. |
Enumeration Type Documentation
Enumeration for resource attribute ID which indicates the attributes of each physical and logical resource.
- Since :
- 7.0
- Enumerator:
Enumeration for resource control ID. The device board have the multiple resources with same resource type. The resource control ID indicates the identification of each resource among same resource type.
- Since :
- 7.0
- Enumerator:
Enumeration for resource monitor error value to catch the accurate error reason.
- Since :
- 7.0
- Enumerator:
Enumeration for resource type which indicate physical and logical resource.
- Since :
- 7.0
- Enumerator:
Function Documentation
int resource_monitor_create_resource | ( | int | monitor_id, |
resource_monitor_type_e | resource_type | ||
) |
Creates resource for given resource_type which indicates the one of various resource type.
The various kinds of resources can be monitored using unique IDs generated using the resource_monitor_init function. Create the resource id required to monitor the resource.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Remarks:
- The
return
value should be released using resource_delete_resource().
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_type Resource type
- Returns:
positive
integer as resource ID on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_RESOURCE Unavailable Resource Type
int resource_monitor_delete_resource | ( | int | monitor_id, |
int | resource_id | ||
) |
Deletes resource of given resource ID which indicates the resource instance.
Deletes the resource_id when monitoring of a specific resource is no longer performed using the resource_monitor_create_resource function. Resource_id is no longer valid.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
int resource_monitor_exit | ( | int | monitor_id | ) |
Exits the resource monitor to finish the monitoring of physical and logical resource.
The resource monitor is terminated using the unique ID returned from the resource_monitor_init() function. The unique ID is no longer valid.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id ID of resource monitor which be returned by resource_monitor_init()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
- See also:
- resource_monitor_init()
int resource_monitor_get_array_double | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
double ** | array, | ||
int * | length | ||
) |
Gets the double array of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an double array data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Remarks:
- The array should be released using free().
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] array Array retrieved from resource attribute [out] length Length of array
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_get_array_int | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
int32_t ** | array, | ||
int * | length | ||
) |
Gets the int array of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an int-32bit array data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Remarks:
- The array should be released using free().
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] array Array retrieved from resource attribute [out] length Length of array
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_get_array_int64 | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
int64_t ** | array, | ||
int * | length | ||
) |
Gets the int64 array of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an int-64bit array data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Remarks:
- The array should be released using free().
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] array Array retrieved from resource attribute [out] length Length of array
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_get_array_string | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
char *** | array, | ||
int * | length | ||
) |
Gets the string array of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an string array data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Remarks:
- The array and each data in the array should be released using free().
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] array Array retrieved from resource attribute [out] length Length of array
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
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 | ||
) |
Gets the uint32 array of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an unsigned int-32bit array data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Remarks:
- The array should be released using free().
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] array Array retrieved from resource attribute [out] length Length of array
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
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 | ||
) |
Gets the uint64 array of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an unsigned int-64bit array data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Remarks:
- The array should be released using free().
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] array Array retrieved from resource attribute [out] length Length of array
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_get_resource_count | ( | int | monitor_id, |
resource_monitor_type_e | resource_type, | ||
int * | resource_count | ||
) |
Gets the count of supported resources according to resource type.
Returns the number of resources when one hardware board contains multiple resources of the same type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitorID [in] resource_type Resource type [out] resource_count Resource count retrieved from resource monitor
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_RESOURCE Unavailable Resource Type
- See also:
- resource_monitor_init()
int resource_monitor_get_value_double | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
double * | value | ||
) |
Gets the double value of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an double data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] value Value retrieved from resource attribute
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_get_value_int | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
int32_t * | value | ||
) |
Gets the int value of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an integer 32-bit data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] value Value retrieved from resource attribute
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_get_value_int64 | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
int64_t * | value | ||
) |
Gets the int64 value of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an integer 64-bit data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] value Value retrieved from resource attribute
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_get_value_string | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
char ** | value | ||
) |
Gets the string value of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an double data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Remarks:
- The value should be released using free().
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] value Value retrieved from resource attribute
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_get_value_uint32 | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
u_int32_t * | value | ||
) |
Gets the uint32 value of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an unsigned integer 32-bit data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] value Value retrieved from resource attribute
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_get_value_uint64 | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
u_int64_t * | value | ||
) |
Gets the uint64 value of resource attribute which indicates one characteristics of resource.
Obtain a resource attribute value having an unsigned integer 64-bit data type.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] value Value retrieved from resource attribute
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_init | ( | void | ) |
Initializes the resource monitor which monitors the physical and logical resource.
A unique ID is required to use the resource monitor. A unique ID is required to use all functions in the resource monitor.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Remarks:
- The
return
value should be released using resource_monitor_exit().
- Returns:
positive
integer as resource monitor ID on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
- See also:
- resource_monitor_exit()
// Create monitor_id and resource_id for CPU device. int monitor_id = resource_monitor_init(); int resource_id = resource_monitor_create_resource(monitor_id, RESOURCE_MONITOR_TYPE_CPU); // Set control value to indicate the specific CPU device. // It assumes CPU cluster is only one for this example. int ret = resource_monitor_set_resource_ctrl(monitor_id, resource_id, 0); // Set interested resource attributes to monitor the CPU current/minimum frequency. u_int64_t attr_mask = RESOURCE_MONITOR_CPU_ATTR_CUR_FREQ | RESOURCE_MONITOR_CPU_ATTR_MIN_FREQ; ret = resource_monitor_set_resource_attr(monitor_id, resource_id, attr_mask); // Update resource attribute data of CPU current /minimum frequency.. ret = resource_monitor_update(monitor_id); // Get the monitored resource attribute data of CPU current/minimum frequency. int cpu_cur_freq; int cpu_min_freq; ret = resource_monitor_get_value_int(monitor_id, resource_id, RESOURCE_MONITOR_CPU_ATTR_CUR_FREQ, &cpu_cur_freq); ret = resource_monitor_get_value_int(monitor_id, resource_id, RESOURCE_MONITOR_CPU_ATTR_MIN_FREQ, &cpu_min_freq);
int resource_monitor_is_resource_attr_supported | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_id, | ||
bool * | supported | ||
) |
Checks whether a resource attribute is supported or not.
Each monitorable data is represented by a resource_monitor_attr_id_e. You can check if monitoring of a specific resource attribute is supported.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_id Resource attribute ID [out] supported Resource attributes is either supported or not ( true
== supported,false
= not supported)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
int resource_monitor_set_resource_attr | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_mask | ||
) |
Sets the resource attributes of interest for monitoring.
The data that can be monitored for each individual resource is different. Each monitorable data is represented by a resource_monitor_attr_id_e. You must set the interest for the resource attribute you want to monitor before the monitoring request.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_mask Attribute mask including the various attributes
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_set_resource_ctrl | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_ctrl_id_e | ctrl_id, | ||
int | value | ||
) |
Sets the resource control with value which is different according to resource control id.
There may be multiple resources of the same type. A specific resource must be set to point to a specific resource by setting ctrl_id prior to the monitoring request.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] ctrl_id Resource control ID [in] value Value for resource control ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
int resource_monitor_unset_resource_attr | ( | int | monitor_id, |
int | resource_id, | ||
resource_monitor_attr_id_e | attr_mask | ||
) |
Unsets the resource attributes of interest for monitoring.
The data that can be monitored for each individual resource is different. Each monitorable data is represented by a resource_monitor_attr_id_e. The interest must be removed for the resource attribute you want to remove from the monitoring target.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource() [in] attr_mask Attribute mask including the various attributes
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE Unavailable Attribute
int resource_monitor_update | ( | int | monitor_id | ) |
Updates the value of attributes of interest for all created resource.
Requests monitoring of all resource types generated using unique IDs generated using the resource_monitor_init function.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory
int resource_monitor_update_resource | ( | int | monitor_id, |
int | resource_id | ||
) |
Updates the value of attributes of interest for a resource.
Requests monitoring of specific resource instances generated using unique IDs generated using the resource_monitor_init function.
- Since :
- 7.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/systemmonitor
- Parameters:
-
[in] monitor_id Resource monitor ID which be returned by resource_monitor_init() [in] resource_id Resource ID which be returned by resource_monitor_create_resource()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
RESOURCE_MONITOR_ERROR_NONE Successful RESOURCE_MONITOR_ERROR_PERMISSION_DENIED Permission Denied RESOURCE_MONITOR_ERROR_INVALID_PARAMETER Invalid Parameter RESOURCE_MONITOR_ERROR_NO_DATA Empty Data RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY Out of Memory