Monitoring Resource Usage
The function for monitoring the usage of CPU and memory, which has been provided in Beanviser, is added in CLI from v1.12.0.
Using the ares-device-info command with the --resource-monitor (-r) option, you can monitor the usage of CPU and memory at system or process level. You can also set the time interval to get the usage data periodically and save the data in a .csv file.
For details about each option and parameter, see ares-device-info.
Examples
The following are examples of monitoring the usage of CPU and memory at system and process level.
Display system-level CPU & memory usage
This example displays the system-level CPU and memory usage.
# Display resource usage
$ ares-device-info -d DEVICE -r
2022-02-17 08:46:13
(%) overall usermode kernelmode others
---- ------- -------- ---------- ------
cpu 2.41 0 1.38 1.03
cpu0 1.05 0 1.05 0
cpu1 1.03 0 1.03 0
cpu2 4.12 0 1.03 3.09
(KB) total used free shared buff/cache available
------ ------- ------ ------ ------ ---------- ---------
memory 1023356 245668 458604 1552 319084 727128
swap 0 0 0
=================================================================
# Display resource usage periodically and save them to a CSV file
$ ares-device-info -d DEVICE -r -s resource.csv -t 1
Create resource.csv to D:webOS_TV_SDKCLIbin
2022-02-17 08:47:02
(%) overall usermode kernelmode others
---- ------- -------- ---------- ------
cpu 1.37 0 1.37 0
cpu0 1.02 0 1.02 0
cpu1 1.03 0 1.03 0
cpu2 2.04 0 2.04 0
(KB) total used free shared buff/cache available
------ ------- ------ ------ ------ ---------- ---------
memory 1023356 245576 458688 1552 319092 727220
swap 0 0 0
=================================================================
2022-02-17 08:47:03
(%) overall usermode kernelmode others
---- ------- -------- ---------- ------
cpu 1.02 0 1.02 0
cpu0 3 1 2 0
cpu1 0 0 0 0
cpu2 2.04 0 1.02 1.02
(KB) total used free shared buff/cache available
------ ------- ------ ------ ------ ---------- ---------
memory 1023356 245684 458580 1552 319092 727112
swap 0 0 0
=================================================================
To terminate the periodic monitoring of resource usage, enter Ctrl + C.
Display process-level CPU & memory usage
This example displays the process-level CPU and memory usage.
# Launch your app before test
$ ares-launch -d DEViCE com.test.resource
Launched application com.test.resource
# Display resource usage of running apps and services
$ ares-device-info -d DEVICE -r -l
2022-02-17 08:51:51
PID ID CPU(%) MEMORY(%) MEMORY(KB)
---- ----------------- ------ --------- ----------
2336 com.test.resource 0.34 8.01 76060
2439 test 0 8.21 77924
======================================================================
# Display resource usage of specified running app
$ ares-device-info -d DEVICE -r -id com.test.resource
2022-02-17 08:52:53
PID ID CPU(%) MEMORY(%) MEMORY(KB)
---- ----------------- ------ --------- ----------
2336 com.test.resource 0.34 8.01 76060
======================================================================