Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mpstat to print per CPU utilization #188

Open
joyxiong opened this issue Apr 11, 2014 · 3 comments
Open

Support mpstat to print per CPU utilization #188

joyxiong opened this issue Apr 11, 2014 · 3 comments
Assignees

Comments

@joyxiong
Copy link
Contributor

The current SAR command prints the system's average CPU utilization. mpstat breaks down CPU utilization per CPU. With this data, we can find out if a particular CPU is more heavily used than others. A sample output is here:

mpstat -P ALL 2
11:30:49 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
11:30:51 AM all 6.88 0.00 1.79 0.71 0.00 0.00 0.00 0.00 90.61
11:30:51 AM 0 8.04 0.00 3.52 0.00 0.00 0.00 0.00 0.00 88.44
11:30:51 AM 1 2.48 0.00 1.49 0.00 0.00 0.00 0.00 0.00 96.04
11:30:51 AM 2 0.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 99.00
11:30:51 AM 3 0.50 0.00 0.50 6.53 0.00 0.00 0.00 0.00 92.46
11:30:51 AM 4 0.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 99.00
11:30:51 AM 5 0.50 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.50
11:30:51 AM 6 7.00 0.00 2.50 0.00 0.00 0.00 0.00 0.00 90.50
11:30:51 AM 7 58.00 0.00 4.50 0.00 0.00 0.00 0.00 0.00 37.50
11:30:51 AM 8 3.02 0.00 5.03 0.00 0.00 0.00 0.00 0.00 91.96
11:30:51 AM 9 0.50 0.00 2.00 2.00 0.00 0.00 0.00 0.00 95.50
11:30:51 AM 10 1.00 0.00 0.50 0.00 0.00 0.00 0.00 0.00 98.51
11:30:51 AM 11 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 99.00

@RiteshMaheshwari
Copy link
Collaborator

Joy, can you look into sar a little more and find out if using some other options in sar can give per-CPU usage?

@joyxiong
Copy link
Contributor Author

Ritesh, The command sar -u -P ALL 2 can print the per CPU utilization with 2-fewer breakdown columns, %irq and %soft per CPU. A sample output from sar is as below:
12:46:46 PM CPU %user %nice %system %iowait %steal %idle
12:46:48 PM all 6.97 0.00 1.67 0.83 0.00 90.53
12:46:48 PM 0 11.50 0.00 3.50 0.00 0.00 85.00
12:46:48 PM 1 3.02 0.00 1.51 7.54 0.00 87.94
12:46:48 PM 2 2.50 0.00 0.50 0.00 0.00 97.00
12:46:48 PM 3 0.50 0.00 0.50 0.00 0.00 99.00
12:46:48 PM 4 0.50 0.00 0.50 0.00 0.00 99.00
12:46:48 PM 5 0.50 0.00 0.50 0.00 0.00 98.99
12:46:48 PM 6 4.50 0.00 2.00 0.00 0.00 93.50
12:46:48 PM 7 57.21 0.00 5.47 2.49 0.00 34.83
12:46:48 PM 8 3.00 0.00 4.00 0.00 0.00 93.00
12:46:48 PM 9 0.50 0.00 1.00 0.00 0.00 98.50
12:46:48 PM 10 0.50 0.00 1.00 0.00 0.00 98.50
12:46:48 PM 11 0.00 0.00 0.50 0.00 0.00 99.50

@richardhsu
Copy link
Contributor

We can do sar -u ALL -P ALL will actually give us all the columns.
Just update we have sar -u -P ALL now to get per cpuusage.

@richardhsu richardhsu self-assigned this Nov 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants