resource-monitor: Use pass_resource_monitor_set_resource_flag to make the resource PUBLIC
Some information should be protected from public users.
So the users of capi only can access to attirbutes
which have PUBLIC visibility. By using the added
libpass function, we can enforce the user of capi to
only access PUBLIC attributes. If the user tries to
access PRIVATE attributes, the set attribute function
will return RESOURCE_MONITOR_ERROR_PERMISSION_DENIED
error.
Change-Id: If7f40a7cf4e2c0987fa3594a6e3e3f0839c0aded
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
resource-monitor: Define enumeration type name and add description for each enum
Define enumeration type name and add description for each enum
according to Natvie API rules.
[Added enumeration definition]
- resource_monitor_error_e for resource monitor error value
- resource_monitor_attr_id_e for resource attribute ID like "u_int64_t attr_id"
- resource_monitor_ctrl_id_e for resource control ID like "u_int64_t ctrl_id"
Change-Id: I43ff0ec643e61fc9dd74e12f20e156204c5b072f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
resource-monitor: Add system-resource-monitor tool
Add system-resource-monitor cli tool to print the supported resources
and resource attributes. Also, monitor the resource attribute data.
[Example of system-resource-monitor]
-------------------------------------------------------------------------------------------------------------------------------
: | Resource Attribute Name | Resource Attribute Value | Unit | Resource Attribute Description
-------------------------------------------------------------------------------------------------------------------------------
0: 0| RESOURCE_MONITOR_SYSTEM_ATTR_CPU_UTIL | 0.74 | % | CPU average utilization
0: 1| RESOURCE_MONITOR_SYSTEM_ATTR_CPU_USER_UTIL | 0.25 | % | CPU average utilization on user
0: 2| RESOURCE_MONITOR_SYSTEM_ATTR_CPU_SYS_UTIL | 0.50 | % | CPU average utilization on system
0: 3| RESOURCE_MONITOR_SYSTEM_ATTR_PER_CPU_UTIL | 0.99 0.99 0.99 0.00 | % | Per-CPU utilization
0: 4| RESOURCE_MONITOR_SYSTEM_ATTR_PER_CPU_USER_UTIL | 0.99 0.00 0.00 0.00 | % | Per-CPU utilization on user
0: 5| RESOURCE_MONITOR_SYSTEM_ATTR_PER_CPU_SYS_UTIL | 0.00 0.99 0.99 0.00 | % | Per-CPU utilization on system
0: 6| RESOURCE_MONITOR_SYSTEM_ATTR_POSSIBLE_CPU | 4 | ea | Number of possible CPU
0: 7| RESOURCE_MONITOR_SYSTEM_ATTR_ONLINE_CPU | 4 | ea | Number of online CPU
1: 0| RESOURCE_MONITOR_MEMORY_ATTR_TOTAL |
1051213824 | kB | Memory total size
1: 1| RESOURCE_MONITOR_MEMORY_ATTR_AVAILABLE |
783130624 | kB | Memory available size
1: 2| RESOURCE_MONITOR_MEMORY_ATTR_FREE |
545079296 | kB | Memory free size
1: 3| RESOURCE_MONITOR_MEMORY_ATTR_BUFFER |
16211968 | kB | Memorry buffer size
1: 4| RESOURCE_MONITOR_MEMORY_ATTR_CACHED |
224661504 | kB | Memory cached size
1: 5| RESOURCE_MONITOR_MEMORY_ATTR_CMA_TOTAL | 0 | kB | CMA memory total size
1: 6| RESOURCE_MONITOR_MEMORY_ATTR_CMA_FREE | 0 | kB | CMA memory free size
1: 7| RESOURCE_MONITOR_MEMORY_ATTR_SWAP_TOTAL |
4294963200 | kB | Swap memory total size
1: 8| RESOURCE_MONITOR_MEMORY_ATTR_SWAP_FREE |
4294963200 | kB | Swap memory free size
2: 0| RESOURCE_MONITOR_DISPLAY_ATTR_NAME | lcd | | Display device name
2: 1| RESOURCE_MONITOR_DISPLAY_ATTR_FPS | 0.00 | fps | Frame per second
3: 0| RESOURCE_MONITOR_BATTERY_ATTR_CAPACITY | 50 | % | Battery capacity
3: 1| RESOURCE_MONITOR_BATTERY_ATTR_STATUS | Not Supported | | Battery status
3: 2| RESOURCE_MONITOR_BATTERY_ATTR_TEMPERATURE | Not Supported | | Battery temperature
3: 3| RESOURCE_MONITOR_BATTERY_ATTR_VOLTAGE_NOW | Not Supported | uV | Battery voltage figure
3: 4| RESOURCE_MONITOR_BATTERY_ATTR_CURRENT_NOW | Not Supported | uA | Battery current figure
3: 5| RESOURCE_MONITOR_BATTERY_ATTR_PRESENT | Not Supported | | Battery connected status
3: 6| RESOURCE_MONITOR_BATTERY_ATTR_ONLINE | Not Supported | | Battery Charger connector status
4: 0| RESOURCE_MONITOR_CPU_ATTR_NAME | cpu0 | | CPU cluster name
4: 1| RESOURCE_MONITOR_CPU_ATTR_CUR_FREQ | Not Supported | kHz | Current CPU frequency
4: 2| RESOURCE_MONITOR_CPU_ATTR_MIN_FREQ | Not Supported | kHz | Current CPU minimum frequency
4: 3| RESOURCE_MONITOR_CPU_ATTR_MAX_FREQ | Not Supported | kHz | Current CPU maximum frequency
4: 4| RESOURCE_MONITOR_CPU_ATTR_AVAILABLE_MIN_FREQ | Not Supported | kHz | Available CPU minimum frequency
4: 5| RESOURCE_MONITOR_CPU_ATTR_AVAILABLE_MAX_FREQ | Not Supported | kHz | Available CPU maximum frequency
4: 6| RESOURCE_MONITOR_CPU_ATTR_CUR_GOVERNOR | Not Supported | | Current CPU frequency governor name
5: 0| RESOURCE_MONITOR_DISK_ATTR_NAME | vda | | Disk device name
5: 1| RESOURCE_MONITOR_DISK_ATTR_READ_PER_SEC | 0.00 | kB/s | Disk read per second
5: 2| RESOURCE_MONITOR_DISK_ATTR_WRITE_PER_SEC | 0.00 | kB/s | Disk write per second
5: 3| RESOURCE_MONITOR_DISK_ATTR_READ_TOTAL | 485198 | kB | Disk read total size
5: 4| RESOURCE_MONITOR_DISK_ATTR_WRITE_TOTAL | 24352 | kB | Disk write total size
Change-Id: Ibf7e1f0fb380feb54b36c874a09df64ee493ea7c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>