- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to retrieve cpu usage for all processes
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2005 07:51 AM
08-19-2005 07:51 AM
How to retrieve cpu usage for all processes
I would to retrieve cpu usage for all processes. I have try TOP and PS, but after adding up the cpu usage percentage for all the processes, it did not equal or come close to the total CPU usage reported by TOP.
This is what I used:
# to get all process with top
top -n 300 -f top_list.file
# to get all process with ps
ps -elfo pcpu,args
# I get the total CPU usage from vmstat
vmstat 1 5
Thanks,
Charles Li
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2005 08:05 AM
08-19-2005 08:05 AM
Re: How to retrieve cpu usage for all processes
say sd1
How many cpus you have??. check the value you got from above to "no of cpus*valus_above" (sat sd)
The value sd should match sd1 (roughly and not exactly.)
glance/sar is better tool for this and not top.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2005 08:20 AM
08-19-2005 08:20 AM
Re: How to retrieve cpu usage for all processes
UNIX95= ps -ef -o "pcpu" | awk '(s+=41) END {printf "%d\n", s}'
This value should match with what you see in top/glance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2005 09:36 AM
08-20-2005 09:36 AM
Re: How to retrieve cpu usage for all processes
for all the CPU usage details :
# sar -u -M 5 5 ( For 5 instance)
for all top processes:
# ps -elf pcpu | sort -r -k4 | more ( 4rth column is cpu usage).
Cheers,
Raj.D.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2005 10:00 AM
08-20-2005 10:00 AM
Re: How to retrieve cpu usage for all processes
It doesn't make any sense to track all the programs and add up the usage. Instead, you look at the 'interesting' processes, those which consume more than 5-10% of total CPU for the system. top is a good start, but keep in mind that there is nothing wrong with your system is these processes are supposed to consume large amounts of CPU. Of course, the trick is how to determine 'normal' application behavior.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2005 12:29 AM
08-22-2005 12:29 AM
Re: How to retrieve cpu usage for all processes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2005 04:26 AM
08-22-2005 04:26 AM
Re: How to retrieve cpu usage for all processes
All I got is ps, top and vmstat.
Anyways, I am using the same ps parameters to get the CPU usage, and its not adding up to what top and vmstat is displaying.
Even when I add up %CPU from top, it does not match top's cpu usage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2005 04:33 AM
08-22-2005 04:33 AM
Re: How to retrieve cpu usage for all processes
So, if you collec the cpu utilization data in a long term, and be content with some inaccuracies, you already have your answer above. If your are trying to get a 100% match between the decomposition of process cpu utilizations adding up to the total cpu utilization, you will never get there. There will always be a discrepancy regardless how small it is.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2005 04:45 AM
08-22-2005 04:45 AM
Re: How to retrieve cpu usage for all processes
sar -u 1
HP-UX yoda B.11.11 U 9000/831 08/22/05
12:39:33 %usr %sys %wio %idle
12:39:34 47 4 0 50
Note that to do all the graphs, HP has a very extensive program set in the GlancePlus product line which offers PerfView to create graphs of every metric (about 200+) measure by Glance.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 01:01 PM
08-23-2005 01:01 PM
Re: How to retrieve cpu usage for all processes
I'll have to agree with some of my other parnters in this post... it'll be down right hard to get it down to an exact amount. However, I have some good news.. there are some programs out there that can help with your graphs/measurements. One good one I've used in the past is called sarcheck. I also saved a bunch of money on my car insurance... jk. Check it out partner.
Into the sunset,
John E. Ophious