- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to get cpu usage in c++
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
05-31-2010 04:21 AM
05-31-2010 04:21 AM
how to get cpu usage in c++
I would like to use API like pst_dynamic
cpu usage=1-CPU IDLE% or USER+NICE+SYS+BLOCK+SWAIT+INTR+SSYS
is any api can calcuate it
because i use summary all process usage /number of cpu is not ccurate
how to do program get cpu usage in c++
thanks
- Tags:
- pstat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2010 04:45 AM
05-31-2010 04:45 AM
Re: how to get cpu usage in c++
I'd look at 'pstat_getprocessor()'. see the 'pstat(2)' manpages.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2010 04:50 AM
05-31-2010 04:50 AM
Re: how to get cpu usage in c++
The answer is the same as for C.
You'll need to scan the various pstat(2) headers in
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2010 06:06 PM
06-01-2010 06:06 PM
Re: how to get cpu usage in c++
I would like a workable cpu usage program example for hpux ,i search for a long time in web site ,but still have no idea how to do it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2010 02:59 AM
06-02-2010 02:59 AM
Re: how to get cpu usage in c++
pst_dynamic also looks like it would give usage by CPU.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2010 04:04 AM
06-02-2010 04:04 AM
Re: how to get cpu usage in c++
> I would like a workable cpu usage program example for hpux ,i search for a long time in web site ,but still have no idea how to do it
The 'pstat(2)' manpages offer some examples, including one using both the 'pst_dynamic' and the 'pst_processor' structures.
You will need to look at the header files (on your system: 'ls -l /usr/include/sys/pstat*' ) and as documented in the manpages for the specific data you can glean.
Regards!
...JRF...