this is great idea but there is something funny happening with top used as command line "/usr/bin/top -b -n 1"
here a little exemple you might understand what i means
(doing this in SSH)
# /usr/bin/top -b -n 1 | head -n 3
top - 16:43:56 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:00 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:02 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:06 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:08 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:13 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:15 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
after a fast look into this... you can see the time stamp change for each but notting else... like exemple Cpu % us is always at 3.0% witch is impossible in fact... but i dont think top is responsable of this probleme because it happend with vmstat, sar, iostat etc.. command similar that i tried.
note that if you use just "top" as standar in SSH you will see all information get well refresh each 5 sec...
maby the solution is some where in /proc/stat by calculating it on your own...but if any one have an idea how to get cpu status "up to date" i would apreciate to know how...
here a little exemple you might understand what i means
(doing this in SSH)
# /usr/bin/top -b -n 1 | head -n 3
top - 16:43:56 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:00 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:02 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:06 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:08 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:13 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
# /usr/bin/top -b -n 1 | head -n 3
top - 16:44:15 up 532 days, 8:33, 2 users, load average: 0.00, 0.01, 0.00
Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0% us, 2.5% sy, 1.7% ni, 87.6% id, 4.7% wa, 0.5% hi, 0.0% si
after a fast look into this... you can see the time stamp change for each but notting else... like exemple Cpu % us is always at 3.0% witch is impossible in fact... but i dont think top is responsable of this probleme because it happend with vmstat, sar, iostat etc.. command similar that i tried.
note that if you use just "top" as standar in SSH you will see all information get well refresh each 5 sec...
maby the solution is some where in /proc/stat by calculating it on your own...but if any one have an idea how to get cpu status "up to date" i would apreciate to know how...