Reduce the execution time of top command
This commit is contained in:
parent
16aa5f080c
commit
7592fdd0fd
1 changed files with 1 additions and 1 deletions
|
@ -9,7 +9,7 @@ get_percent()
|
||||||
{
|
{
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Linux)
|
Linux)
|
||||||
percent=$(LC_NUMERIC=en_US.UTF-8 top -bn2 -p 1 | grep "Cpu(s)" | tail -1 | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
percent=$(LC_NUMERIC=en_US.UTF-8 top -bn2 -d 0.01 | grep "Cpu(s)" | tail -1 | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
||||||
normalize_percent_len $percent
|
normalize_percent_len $percent
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue