Operating System - HP-UX
1846469 Members
3846 Online
110256 Solutions
New Discussion

Caculate CPU load using PSTAT

 
Mark Ma_4
Occasional Advisor

Caculate CPU load using PSTAT

i am in the process of develop a simple system that monitor system load.and i am using C programing and PSTAT system call to do it not shell script.the target is HP-UX 11i.

my question is ,how to caculate CPU load using pstat field.

i have think that psd_avg_1_min could show the system load in last mins.it seems that i make a big mistake.maybe i still havn't full understand PSTAT system call.
anyone suggestion will be appreciate.

P.S. i think the same problem will happens when i caculate MEM threshold ,DISK load as well.so where can i find the formula of caculate all the resource by PSTAT struct fields ?is it a secert of HP ?

wish my describtion is clearly.thanks & reagrds

Mark
6 REPLIES 6
curt larson_1
Honored Contributor

Re: Caculate CPU load using PSTAT

you could just down load the source code for top
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/top-3.5beta12/

and take a look and see how they did it
Mark Ma_4
Occasional Advisor

Re: Caculate CPU load using PSTAT

i've check that source code , while it havnt using PSTAT system call .anyway ,thank u for that.and i think the source code will be helpful sometimes later.

any suggestion about caculate CPU/MEM/DISK utilization by PSTAT system call's stuct field?

curt larson_1
Honored Contributor

Re: Caculate CPU load using PSTAT

well it doesn't use the pstat function call specifically, it uses the pstat_getdynamic system call to do this.
check the machine.c file
Mark Ma_4
Occasional Advisor

Re: Caculate CPU load using PSTAT

thanks for your search page. expecially for Curt's source top.

Mark Ma_4
Occasional Advisor

Re: Caculate CPU load using PSTAT

sorry,after re-searching the resource you give me ,i still have no idea that how can i get the DISK's utilization in program.

any suggestion ?