Tizen Native API  7.0
Resource Monitor

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.
int resource_monitor_exit (int monitor_id)
 Exits the resource monitor.
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.
int resource_monitor_delete_resource (int monitor_id, int resource_id)
 Deletes resource of given resource ID.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.

Enumeration Type Documentation

Enumeration for resource attribute ID.

Since :
7.0
Enumerator:
RESOURCE_MONITOR_CPU_ATTR_CUR_FREQ 

Current CPU frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_CPU_ATTR_MIN_FREQ 

Current CPU minimum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_CPU_ATTR_MAX_FREQ 

Current CPU maximum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_CPU_ATTR_AVAILABLE_MIN_FREQ 

Available CPU minimum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_CPU_ATTR_AVAILABLE_MAX_FREQ 

Available CPU maximum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_CPU_ATTR_CUR_GOVERNOR 

Current CPU frequency governor name (data type: DATA_TYPE_STRING)

RESOURCE_MONITOR_CPU_ATTR_NAME 

CPU cluster name (data type: DATA_TYPE_STRING)

RESOURCE_MONITOR_BUS_ATTR_CUR_FREQ 

Current bus frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_BUS_ATTR_MIN_FREQ 

Current bus minimum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_BUS_ATTR_MAX_FREQ 

Current bus maximum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_BUS_ATTR_AVAILABLE_MIN_FREQ 

Available bus minimum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_BUS_ATTR_AVAILABLE_MAX_FREQ 

Available bus maximum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_BUS_ATTR_CUR_GOVERNOR 

Current bus frequency governor name (data type: DATA_TYPE_STRING)

RESOURCE_MONITOR_BUS_ATTR_NAME 

Bus device name (data type: DATA_TYPE_STRING)

RESOURCE_MONITOR_GPU_ATTR_CUR_FREQ 

Current GPU frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_GPU_ATTR_MIN_FREQ 

Current GPU minimum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_GPU_ATTR_MAX_FREQ 

Current GPU maximum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_GPU_ATTR_AVAILABLE_MIN_FREQ 

Available GPU minimum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_GPU_ATTR_AVAILABLE_MAX_FREQ 

Available GPU maximum frequency (data type: DATA_TYPE_INT, unit: kHz)

RESOURCE_MONITOR_GPU_ATTR_CUR_GOVERNOR 

Current GPU frequency governor name (data type: DATA_TYPE_STRING)

RESOURCE_MONITOR_GPU_ATTR_NAME 

GPU device name (data type: DATA_TYPE_STRING)

RESOURCE_MONITOR_MEMORY_ATTR_TOTAL 

Memory total size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_MEMORY_ATTR_AVAILABLE 

Memory available size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_MEMORY_ATTR_FREE 

Memory free size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_MEMORY_ATTR_BUFFER 

Memory buffer size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_MEMORY_ATTR_CACHED 

Memory cached size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_MEMORY_ATTR_CMA_TOTAL 

CMA memory total size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_MEMORY_ATTR_CMA_FREE 

CMA memory free size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_MEMORY_ATTR_SWAP_TOTAL 

Swap memory total size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_MEMORY_ATTR_SWAP_FREE 

Swap memory free size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_BATTERY_ATTR_CAPACITY 

Battery capacity (data type: DATA_TYPE_INT, unit: %)

RESOURCE_MONITOR_BATTERY_ATTR_STATUS 

Battery status (data type: DATA_TYPE_STRING)

RESOURCE_MONITOR_BATTERY_ATTR_TEMPERATURE 

Battery temperature (data type: DATA_TYPE_INT)

RESOURCE_MONITOR_BATTERY_ATTR_VOLTAGE_NOW 

Battery voltage value (data type: DATA_TYPE_INT, unit: uV)

RESOURCE_MONITOR_BATTERY_ATTR_CURRENT_NOW 

Battery current value (data type: DATA_TYPE_INT, unit: uA)

RESOURCE_MONITOR_BATTERY_ATTR_PRESENT 

Battery connected status (data type: DATA_TYPE_INT)

RESOURCE_MONITOR_BATTERY_ATTR_ONLINE 

Battery Charger connector status (data type: DATA_TYPE_INT)

RESOURCE_MONITOR_DISPLAY_ATTR_FPS 

Frame per second (data type: DATA_TYPE_DOUBLE)

RESOURCE_MONITOR_DISPLAY_ATTR_NAME 

Display device name (data type: DATA_TYPE_STRING, unit: fps)

RESOURCE_MONITOR_SYSTEM_ATTR_CPU_UTIL 

CPU average utilization (data type: DATA_TYPE_DOUBLE, unit: %)

RESOURCE_MONITOR_SYSTEM_ATTR_CPU_USER_UTIL 

CPU average utilization on user (data type: DATA_TYPE_DOUBLE, unit: %)

RESOURCE_MONITOR_SYSTEM_ATTR_CPU_SYS_UTIL 

CPU average utilization on system (data type: DATA_TYPE_DOUBLE, unit: %)

RESOURCE_MONITOR_SYSTEM_ATTR_PER_CPU_UTIL 

Per-CPU utilization (data type: DATA_TYPE_ARRAY_DOUBLE, unit: %)

RESOURCE_MONITOR_SYSTEM_ATTR_PER_CPU_USER_UTIL 

Per-CPU utilization on user (data type: DATA_TYPE_ARRAY_DOUBLE, unit: %)

RESOURCE_MONITOR_SYSTEM_ATTR_PER_CPU_SYS_UTIL 

Per-CPU utilization on system (data type: DATA_TYPE_ARRAY_DOUBLE, unit: %)

RESOURCE_MONITOR_SYSTEM_ATTR_POSSIBLE_CPU 

Number of possible CPU (data type: DATA_TYPE_INT, unit: ea)

RESOURCE_MONITOR_SYSTEM_ATTR_ONLINE_CPU 

Number of online CPU (data type: DATA_TYPE_INT, unit: ea)

RESOURCE_MONITOR_DISK_ATTR_NAME 

Disk device name (data type: DATA_TYPE_STRING)

RESOURCE_MONITOR_DISK_ATTR_READ_PER_SEC 

Disk read per second (data type: DATA_TYPE_DOUBLE, unit: kB/s)

RESOURCE_MONITOR_DISK_ATTR_WRITE_PER_SEC 

Disk write per second (data type: DATA_TYPE_DOUBLE, unit: kB/s)

RESOURCE_MONITOR_DISK_ATTR_READ_TOTAL 

Disk read total size (data type: DATA_TYPE_UINT64, unit: kB)

RESOURCE_MONITOR_DISK_ATTR_WRITE_TOTAL 

Disk write total size (data type: DATA_TYPE_UINT64, unit: kB)

Enumeration for resource control ID.

Since :
7.0
Enumerator:
RESOURCE_MONITOR_CPU_CTRL_CLUSTER_ID 

CPU cluster resource control ID

RESOURCE_MONITOR_BUS_CTRL_DEVICE_ID 

Bus device resource control ID

RESOURCE_MONITOR_GPU_CTRL_DEVICE_ID 

GPU device resource control ID

RESOURCE_MONITOR_DISPLAY_CTRL_DEVICE_ID 

Display device resource control ID

RESOURCE_MONITOR_DISK_CTRL_DEVICE_ID 

Disk device resource control ID

Enumeration for resource monitor error value.

Since :
7.0
Enumerator:
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

RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTE 

Unavailable Attribute

Enumeration for resource type.

Since :
7.0
Enumerator:
RESOURCE_MONITOR_TYPE_UNKNOWN 

Unknown Resource Type

RESOURCE_MONITOR_TYPE_CPU 

CPU Resource Type

RESOURCE_MONITOR_TYPE_BUS 

BUS Resource Type

RESOURCE_MONITOR_TYPE_GPU 

GPU Resource Type

RESOURCE_MONITOR_TYPE_MEMORY 

Memory Resource Type

RESOURCE_MONITOR_TYPE_BATTERY 

Battery Resource Type

RESOURCE_MONITOR_TYPE_DISPLAY 

Display Resource Type

RESOURCE_MONITOR_TYPE_SYSTEM 

System Resource Type

RESOURCE_MONITOR_TYPE_DISK 

Disk Resource Type


Function Documentation

int resource_monitor_create_resource ( int  monitor_id,
resource_monitor_type_e  resource_type 
)

Creates resource for given resource_type.

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_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_typeResource type
Returns:
positive integer as resource ID on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_RESOURCEUnavailable Resource Type
See also:
resource_monitor_init()
resource_monitor_delete_resource()
int resource_monitor_delete_resource ( int  monitor_id,
int  resource_id 
)

Deletes resource of given resource ID.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
See also:
resource_monitor_init()
resource_monitor_create_resource()
int resource_monitor_exit ( int  monitor_id)

Exits the resource monitor.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idID of resource monitor which be returned by resource_monitor_init()
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut 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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Remarks:
The array should be released using free().
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]arrayArray retrieved from resource attribute
[out]lengthLength of array
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Remarks:
The array should be released using free().
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]arrayArray retrieved from resource attribute
[out]lengthLength of array
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Remarks:
The array should be released using free().
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]arrayArray retrieved from resource attribute
[out]lengthLength of array
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

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_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]arrayArray retrieved from resource attribute
[out]lengthLength of array
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Remarks:
The array should be released using free().
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]arrayArray retrieved from resource attribute
[out]lengthLength of array
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Remarks:
The array should be released using free().
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]arrayArray retrieved from resource attribute
[out]lengthLength of array
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitorID
[in]resource_typeResource type
[out]resource_countResource count retrieved from resource monitor
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_RESOURCEUnavailable 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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]valueValue retrieved from resource attribute
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]valueValue retrieved from resource attribute
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]valueValue retrieved from resource attribute
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Remarks:
The value should be released using free().
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]valueValue retrieved from resource attribute
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]valueValue retrieved from resource attribute
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]valueValue retrieved from resource attribute
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
resource_monitor_update()
resource_monitor_update_resource()
int resource_monitor_init ( void  )

Initializes 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_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut 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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_idResource attribute ID
[out]supportedResource 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_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_maskAttribute mask including the various attributes
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_unset_resource_attr()
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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]ctrl_idResource control ID
[in]valueValue for resource control ID
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
See also:
resource_monitor_init()
resource_monitor_create_resource()
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.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
[in]attr_maskAttribute mask including the various attributes
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
RESOURCE_MONITOR_ERROR_NOT_SUPPORTED_ATTRIBUTEUnavailable Attribute
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
int resource_monitor_update ( int  monitor_id)

Updates the value of attributes of interest for all created resource.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()
int resource_monitor_update_resource ( int  monitor_id,
int  resource_id 
)

Updates the value of attributes of interest for a resource.

Since :
7.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/systemmonitor
Parameters:
[in]monitor_idResource monitor ID which be returned by resource_monitor_init()
[in]resource_idResource ID which be returned by resource_monitor_create_resource()
Returns:
0 on success, otherwise a negative error value
Return values:
RESOURCE_MONITOR_ERROR_NONESuccessful
RESOURCE_MONITOR_ERROR_PERMISSION_DENIEDPermission Denied
RESOURCE_MONITOR_ERROR_INVALID_PARAMETERInvalid Parameter
RESOURCE_MONITOR_ERROR_NO_DATAEmpty Data
RESOURCE_MONITOR_ERROR_OUT_OF_MEMORYOut of Memory
See also:
resource_monitor_init()
resource_monitor_create_resource()
resource_monitor_set_resource_attr()
resource_monitor_set_resource_ctrl()