webosose / ares-cli

ares-cli is a command-line interface(CLI) for webOS
Apache License 2.0
38 stars 17 forks source link

Support resource info #55

Closed YoungeunKim closed 3 years ago

YoungeunKim commented 3 years ago

:Release Notes: Support resource monitor feature

:Detailed Notes:

:Testing Performed:

  1. Pass unit test on ose target and emulator
  2. Pass eslint
  3. Verified with CLI commands
    #ares-device --resource-monitor
    : system resource usage should be displayed
    #ares-device -r --time-interval 2
    : system resource usage should be displayed repeatedly
    #ares-device -r --list 
    : dev running app and service CPU and memory should be displayed
    #ares-device -r --list --time-interval 2
    : dev running app and service CPU&memory should be displayed repeatedly
    #ares-device -r com.examples.app --time-interval 2
    : only specified ID's CPU and memory should be displayed repeatedly

Negative case:

:Issues Addressed: [WRN-4379] Implement ares-device --resource-monitor [WRN-8319] Implement ares-deivce --resoure-monitor --list/ID

YoungeunKim commented 3 years ago

Code :+1: Verified :+1:

ssuminahn commented 3 years ago

I think below case is error and this is need a tip as like "Please launch the app or service."

suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r com.domain.app [Info] Set target device : ose com.domain.app is not running

ssuminahn commented 3 years ago

suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r --interval 2 [Info] Set target device : ose Tue Oct 19 02:17:55 PDT 2021 (%) overall usermode kernelmode others


cpu 4.54 1.13 3.4 0
cpu0 5.97 1.49 4.48 0
cpu1 4.59 0 4.59 0
cpu2 3.54 2.02 1.52 0
cpu3 4.06 1.02 3.05 0

(KB) total used free shared buff/cache available


memory 3693004 551212 2661156 165888 480636 2920556
swap 766972 0 766972

================================================================

I think some char such as "-" is need in blanks .

ssuminahn commented 3 years ago

I think below case is better error and added tips as like "Please launch any dev app or service"

suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r --list --intval 3 [Info] Set target device : ose There is no runnig app/service There is no runnig app/service There is no runnig app/service There is no runnig app/service There is no runnig app/service There is no runnig app/service

ssuminahn commented 3 years ago

I think it would be better to take something first when you give an interval. For example, if interval is 10, nothing is taken for 10 seconds. If that can't get an exact number because that need a calculation, how about taking the initial resource states? This is just one example. Let's think about it together.

ssuminahn commented 3 years ago

suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r --interval -d ose [Info] Set target device : mm ares-device ERR! [Tips]: Connection timed out. Please check the device IP address or the port number suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r --interval 2 -d ose [Info] Set target device : ose Tue Oct 19 19:03:49 PDT 2021 (%) overall usermode kernelmode others


cpu 5.17 1.51 3.4 0.25
cpu0 4.57 1.52 2.03 1.02
cpu1 3.54 1.52 2.02 0
cpu2 6.53 2.01 4.52 0
cpu3 6.03 1.01 5.03 0

(KB) total used free shared buff/cache available


memory 3693004 534016 2710756 148000 448232 2957612
swap 769020 0 769020

================================================================

^Csuminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$

I think that if user do not specify a number after interval, 1 is provided by default, and if user put a number, it is better to give an interval equal to that number. How about this? And If you don't do it like above, in the case of the above example, error handling seems to be necessary.

YoungeunKim commented 3 years ago

I think below case is error and this is need a tip as like "Please launch the app or service."

suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r com.domain.app [Info] Set target device : ose com.domain.app is not running

Done

YoungeunKim commented 3 years ago

suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r --interval 2 [Info] Set target device : ose Tue Oct 19 02:17:55 PDT 2021 (%) overall usermode kernelmode others

cpu 4.54 1.13 3.4 0 cpu0 5.97 1.49 4.48 0 cpu1 4.59 0 4.59 0 cpu2 3.54 2.02 1.52 0 cpu3 4.06 1.02 3.05 0

(KB) total used free shared buff/cache available

memory 3693004 551212 2661156 165888 480636 2920556 swap 766972 0 766972

================================================================

I think some char such as "-" is need in blanks .

Keep current statue. Done

YoungeunKim commented 3 years ago

I think below case is better error and added tips as like "Please launch any dev app or service"

suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r --list --intval 3 [Info] Set target device : ose There is no runnig app/service There is no runnig app/service There is no runnig app/service There is no runnig app/service There is no runnig app/service There is no runnig app/service

Fixed. Done.

YoungeunKim commented 3 years ago

I think it would be better to take something first when you give an interval. For example, if interval is 10, nothing is taken for 10 seconds. If that can't get an exact number because that need a calculation, how about taking the initial resource states? This is just one example. Let's think about it together.

Fixed. Done

YoungeunKim commented 3 years ago

suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r --interval -d ose [Info] Set target device : mm ares-device ERR! [Tips]: Connection timed out. Please check the device IP address or the port number suminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$ node ares-device.js -r --interval 2 -d ose [Info] Set target device : ose Tue Oct 19 19:03:49 PDT 2021 (%) overall usermode kernelmode others

cpu 5.17 1.51 3.4 0.25 cpu0 4.57 1.52 2.03 1.02 cpu1 3.54 1.52 2.02 0 cpu2 6.53 2.01 4.52 0 cpu3 6.03 1.01 5.03 0

(KB) total used free shared buff/cache available

memory 3693004 534016 2710756 148000 448232 2957612 swap 769020 0 769020

================================================================

^Csuminahn@suminahn:~/work/cli/open/verify/ares-cli/bin$

I think that if user do not specify a number after interval, 1 is provided by default, and if user put a number, it is better to give an interval equal to that number. How about this? And If you don't do it like above, in the case of the above example, error handling seems to be necessary.

I fixed the error : ares-device.js -r -t -d ose and handle "default value setting to 1" case.

YoungeunKim commented 3 years ago

Code :+1: Verified :+1: