Finding total Percentage CPU usage


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding total Percentage CPU usage
# 1  
Old 04-30-2010
Finding total Percentage CPU usage

Hi,

How can I find total CPU usage in percentage? e.g. if my system has 8 CPUs and I want to list total usage for all of them, is it possible through a command?

I have tried some of the commands like top, mpstat, sar. The output of those commands has to be manipulated to derive the percentage CPU utilization. I am looking for some other command.

Thanks in advance.
# 2  
Old 04-30-2010
What hardware?
Which Operating System?
Which shell?
# 3  
Old 04-30-2010
If your OS has mpstat, it is very likely to have vmstat too. vmstat last columns output are the CPU percentages you are looking for.
# 4  
Old 04-30-2010
OS: Red Hat Enterprise Linux AS release 3
Shell: ksh
# 5  
Old 04-30-2010
MySQL

Top command output..

Code:
CPU states:  cpu    user    nice  system    irq  softirq  iowait    idle
           total    8.9%    0.0%    4.3%   0.1%     0.8%   19.3%   66.3%
           cpu00    6.6%    0.0%    4.4%   0.5%     2.4%   20.8%   65.0%
           cpu01    4.0%    0.0%    2.3%   0.0%     0.6%   30.4%   62.4%
           cpu02   13.4%    0.0%    0.7%   0.0%     0.0%   16.7%   68.9%
           cpu03    2.1%    0.0%    1.2%   0.0%     0.0%   17.1%   79.2%
           cpu04    6.4%    0.0%    6.1%   0.0%     0.3%   19.3%   67.6%
           cpu05   16.5%    0.0%    4.5%   0.0%     0.0%   32.8%   45.9%
           cpu06    7.1%    0.0%    6.3%   0.0%     0.6%   19.9%   65.9%
           cpu07   12.7%    0.0%   12.0%   0.0%     0.2%   24.7%   50.1%
           cpu08    9.8%    0.0%    9.5%   1.0%     1.1%   13.1%   65.1%
           cpu09    8.8%    0.0%    5.7%   0.5%     6.4%   17.3%   61.0%
           cpu10   16.9%    0.0%    3.0%   0.0%     0.1%    7.1%   72.6%
           cpu11    7.7%    0.0%    3.6%   0.0%     0.2%   15.0%   73.2%
           cpu12    4.4%    0.0%    2.8%   0.0%     0.1%   15.9%   76.6%
           cpu13    9.0%    0.0%    3.0%   0.0%     0.0%   47.5%   40.2%
           cpu14    3.5%    0.0%    0.7%   0.0%     0.3%    0.8%   94.4%
           cpu15   83.5%    0.0%   16.4%   0.0%     0.0%    0.0%    0.0%



And when press the C .. (Collapsed SMP CPU stats)
the output

Code:
CPU states:  cpu    user    nice  system    irq  softirq  iowait    idle
           total   14.2%    0.0%    5.3%   0.1%     0.9%   20.6%   58.7%

Dou you want like this?

Last edited by ygemici; 04-30-2010 at 08:33 AM.. Reason: editing for Redhat 3
# 6  
Old 04-30-2010
Quote:
Originally Posted by jal_capri
The output of those commands has to be manipulated to derive the percentage CPU utilization. I am looking for some other command.
You might find that a bit of a setback, but Unix is a general-purpose operating system and not specifically designed to meet your personal needs. The Bell Labs. people, in short-sighted ignorance, only implemented the tools you need to build what you want and did not bother at all to anticipate what especially you might want a few decades later.

With this in mind: write a small script which converts the data you get from the system into the form you want and be done. Its the way things are.

bakunin
# 7  
Old 04-30-2010
Code:
$ vmstat
procs                      memory      swap          io     system         cpu
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 0  0      0 10982104 232072 2817792    0    0     0     0    2     2  0  0  0  0

Can you please help me understand the output above?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Capture PRSTAT based on CPU usage percentage

Hi, Recently i have write a simple script to capture CPU high usage based on prstat but i found out that it did capture correctly. I need to capture the rows that contains CPU usage more than 3%. Below line which i thought will capture CPU usage based CPU column in prstat(9th parameter) which is... (3 Replies)
Discussion started by: tharmendran
3 Replies

2. Solaris

Total CPU usage on a server

hi, i am using solaris server. I want to find the total CPU usage on a server. Top command will give that result, but here that command is not working. So anyone can help me to find the total CPU usage. (2 Replies)
Discussion started by: Arasu123
2 Replies

3. UNIX for Advanced & Expert Users

Finding out total memory usage

Hi, I have a server box with 16GB ram in it, within the server box there are 3 VMs running with a total allocation of 9GB. if I add up all the numbers under memory info using vmstat I get 15.8GB so I can say it adds up to 16Gb... Is there a way to see from the command line how much memory... (2 Replies)
Discussion started by: speedhunt3r
2 Replies

4. Linux

How to calculate total CPU usage from SAR report?

Hi, I want to calculate the total cpu usage from the sar report. Say for example, Linux 2.6.24-21-generic (blade10) 09/10/2012 04:54:36 PM CPU %user %nice %system %iowait %steal %idle 04:54:37 PM all 0.00 0.00 0.00 0.00 ... (1 Reply)
Discussion started by: rohitmd
1 Replies

5. UNIX for Dummies Questions & Answers

Is total CPU usage for sar %user+%system+%iowait?

Hi all Can anyone advise/confirm whether total CPU usage when running sar is %user+%system+%iowait or is it %user+%system only? I want to confirm whether I am having a CPU-bound problem or not. This is a single-CPU VMware machine. $ sar 5 20 Linux 2.6.18-238.5.1.el5... (7 Replies)
Discussion started by: newbie_01
7 Replies

6. UNIX for Dummies Questions & Answers

Total cpu usage in percent(%)

How to determine the total percentage cpu usage of a server having 4 cpu cores(quad core)? (3 Replies)
Discussion started by: proactiveaditya
3 Replies

7. UNIX for Dummies Questions & Answers

HOWTO - Total memory and CPU usage ... without top?

Hi all, Is it possible to get total memory usage and free memory usage without top? By Googling I found for total memory usage, use vmstat, for CPU, use mpstat, for disk I/O use iostat, is this correct? Will using sar gives the same result as ALL of these three (3) commands? What about if I... (2 Replies)
Discussion started by: newbie_01
2 Replies

8. Shell Programming and Scripting

Help with bash script - Need to get CPU usage as a percentage

I'm writing a bash script to log some selections from a sensors output (core temp, mb temp, etc.) and I would also like to have the current cpu usage as a percentage. I have no idea how to go about getting it in a form that a bash script can use. For example, I would simply look in the output of... (3 Replies)
Discussion started by: graysky
3 Replies

9. UNIX for Advanced & Expert Users

Finding CPU usage by a Unix Process

Hi, I am designing a load balancer for an application. I am trying to find out the CPU usage by a specifc Unix process (PID is known). I guess I can use ps command to find that. can somebody help me in finding what exact command I should use to find? It is on AIX 5.3. Regards Asutosh (2 Replies)
Discussion started by: asutoshch
2 Replies

10. HP-UX

How to determine cpu&memory percentage usage per user

Using HP-UX v11 Need to monitor cpu and memory usage, total for system and separately for each user in command-line mode. Found out next ways to monitor total cpu usage under hp-ux: 1) vmstat, also shows free memory 2) sar -M ps -eo user,pcpu - does not work, means 'user-defined format'... (4 Replies)
Discussion started by: hp-ux-user
4 Replies
Login or Register to Ask a Question