Operating System - HP-UX
1839888 Members
3930 Online
110156 Solutions
New Discussion

Cpu average using C Api on HP-UX 11.0

 
SOLVED
Go to solution
alessandro_37
Advisor

Cpu average using C Api on HP-UX 11.0

Dear All,
I have executed this C Api to have the avearge consuming of my cpu.




#include
#include

struct pst_dynamic psd; // dynamic system info -- stuff that change change

pstat_getdynamic ( &psd, sizeof ( psd ), (size_t)1 );
printf ( "1-minute: %lf, 5-minute: %lf, 15-minute: %lf\n",
psd.psd_avg_1_min,
psd.psd_avg_5_min,
psd.psd_avg_15_min );

Result;

1-minute load avg: 0.084683
5-minute load avg: 0.094141
15-minute load avg: 0.14590

For example, 1-minute load avg: 0.084683 what does it means? and How can i calculate the rate of Idle with these values?


Considering that my Idle is 99.6%,
ho can i transform
1-minute load avg: 0.084683
5-minute load avg: 0.094141
15-minute load avg: 0.145902 to have 99.6% IDLE?

#top (result of top command)
LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0.09 0.2% 0.0% 0.2% 99.6% 0.0% 0.0% 0.0% 0.0%


Hope you can help me.
Thanks
Alex
6 REPLIES 6
Nicolas Dumeige
Esteemed Contributor

Re: Cpu average using C Api on HP-UX 11.0

Alessandro,

Are you sure you can transform the load average wich is a ponderated machine wide average based on CPU runQ to CPU utilisation ?

What append when the box have multiple CPU ?

Cheers

Nicolas
All different, all Unix
alessandro_37
Advisor

Re: Cpu average using C Api on HP-UX 11.0

I have only a cpu...
Maxim Rozin
Frequent Advisor

Re: Cpu average using C Api on HP-UX 11.0

The connection between these two factors is not strict.

You may have one process consuming 100 percent of your cpu, while no other process wish to run, what will give you low load average, while 0 precent of idle cpu.
Nicolas Dumeige
Esteemed Contributor

Re: Cpu average using C Api on HP-UX 11.0

This is the second thread you post on this problem.

May I suggest a more primitive yet more precise way of getting the CPU consuption info. Have you considered using the standard HP tool to dump the resullt in file or a pipe and read the result set from you C program ?

Furthermore, resource accounting is one very complex task. If you choose to depend on the standard tool, your executable will benefit from the OS improvement.

Cheers,

Nicolas
All different, all Unix
Nicolas Dumeige
Esteemed Contributor
Solution

Re: Cpu average using C Api on HP-UX 11.0

To be blunt, forget the load average / time idle thing, this is like counting carots looking at cabages, it doesn't make sens (wheither you like it or not) !

Take a look at this, it might help you :

http://search.hp.com/redirect.html?url=http%3A//forums1.itrc.hp.com/service/forums/questionanswer.do%3FthreadId%3D137120&qt=pstat.h&hit=1

http://h21007.www2.hp.com/dspp/files/unprotected/hpux/u_faqs.pdf

Cheers

Nicolas
All different, all Unix
alessandro_37
Advisor

Re: Cpu average using C Api on HP-UX 11.0

Thanks a lot Nicolas,
i am verifying your documentation...