Computing.Net > Forums > Unix > CPU usage calculation

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

CPU usage calculation

Reply to Message Icon

Name: Kwang
Date: July 25, 2002 at 21:02:56 Pacific
Comment:

Hi all
I need to create a shell script to list out only the average of CPU usage for a particular period, and direct it to the file. But when I used "top > top.lis" this output file is in a mesh, how can I extract only the CPU usage at a particular moment? Thanks for help?
Best Regards
Kwang



Sponsored Link
Ads by Google

Response Number 1
Name: Frank
Date: July 29, 2002 at 01:08:04 Pacific
Reply:

Kwang,

which OS you are using ?
try e.g.
"iostat -t 10 10 >> /tmp/average.txt"

This will show the overall CPU stat.

Or are you more interested in a special proccess?

No RISK no fun
Frank


0

Response Number 2
Name: ramesh
Date: July 30, 2002 at 01:32:44 Pacific
Reply:

hi, try this one it shows the top 10 process cpu useage and memory usage good luck

while [ 1 ]
do
tput clear
ps -efa -o pcpu= -o vsz= -o args= | grep -v "2 87" | sort -n -r -k 1 | a
wk 'BEGIN {print "CPU% MEM(Kb) PROCESS";pr-----"}
NR <= 10'
sleep 2
done


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: CPU usage calculation

CPU Usage : vmstat, prstat... www.computing.net/answers/unix/cpu-usage-vmstat-prstat/3848.html

unix process with recent cpu usage www.computing.net/answers/unix/unix-process-with-recent-cpu-usage/4892.html

How to find CPU usage, RAM, Hard Disk www.computing.net/answers/unix/how-to-find-cpu-usage-ram-hard-disk/3417.html