on hpunix cpu usage fields


 
Thread Tools Search this Thread
Operating Systems HP-UX on hpunix cpu usage fields
# 1  
Old 04-05-2002
Question on hpunix cpu usage fields

i have found a structure contained in file global _pstat_body.h at the path
/usr/include/sys/pstat which is
named __pst_dynamic . A field by name psd_cpu_time is
an array of maximum cpu states the kernel supports .
i,e psd_cpu_time [PST_MAX_CPUSTATES] specify all
the cpu timings in an array . i wanted to know which
index into the array spesify which element state i,e
whether the psd_cpu_time[0] is cpu time in user mode
and psd_cpu_time[1] is cpu time in kernel mode and so on .
Smilie
# 2  
Old 04-05-2002
Look at the first few lines in /usr/include/sys/sysinfo.h
# 3  
Old 04-06-2002
i needed a system call

thanks for your reply perderabo

you have shown me a new structure ,
as i saw the fields of structure ksysinfo but i could't find
the system call which fills that structure .will you please help me with that .
vish_shan
# 4  
Old 04-10-2002
# 5  
Old 04-11-2002
Question error return from nlist call

hello mr perderabo
thanks for showing me the new tool .
my program written was reffered from your program ,
The call nlist is returning error . please see to my
code and please specify the reason and the
alternative if any .

--------------------------------------------------------------------------------#include <sys/param.h>
#include <sys/unistd.h>
#include <nlist.h>
#include <sys/sysinfo.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/vmmeter.h>
main()
{
int fp;
static struct nlist nl[2] = { {"ksysinfo"}, {NULL} };
struct ksysinfo ksysinfo;
int off;
int check ;
fp=open("/dev/kmem", O_RDONLY);
check = nlist("/stand/vmunix",nl);
printf("check = %d\n",check );
off=nl[0].n_value;
lseek(fp,off,SEEK_SET);
read(fp,&ksysinfo,sizeof(struct ksysinfo));

printf("%ld\n",ksysinfo.cpu[0]);
printf("%ld\n",ksysinfo.cpu[1]);
printf("%ld\n",ksysinfo.cpu[2]);
printf("%ld\n",ksysinfo.cpu[3]);
printf("%ld\n",ksysinfo.cpu[4]);


}
--------------------------------------------------------------------------------

Last edited by vish_shan; 04-11-2002 at 11:15 AM..
# 6  
Old 04-11-2002
I tried your code and it worked for me. If nlist returns a zero that is good. Are you getting -1? Are you running as root? You really need to check the result from the open as well.

But the values in that structure were all zeroes. I don't think it is being used. This is the touble with poking around in the kernel. HP changes stuff in there at will. If you get want the cpu times, I would use pstat(). If you must extract them via these calls, I think, that the stuff in sys/dk.h is a better choice.
# 7  
Old 04-11-2002
nlist return

no ,nlist is returning -1 and i am not running as root . thanks for your reply .

Last edited by vish_shan; 04-11-2002 at 11:33 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

2. Windows & DOS: Issues & Discussions

CPU usage

Hi all, Top command is used to monitor CPU usage in unix,solaris etc..likewise is there any command in windows environment? Regards William (3 Replies)
Discussion started by: William1482
3 Replies

3. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

4. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

5. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

6. Programming

Cpu usage

Hi all, When I have a below while loop in my code (This observation is same for C and Perl) i= 0; while(1) { i++; } for above the CPU uses goes beyond 49% on hp-ux machine, why cpu usage increase at this level for just a simple while loop? and if I have a single print statement... (2 Replies)
Discussion started by: zing_foru
2 Replies

7. Programming

CPU usage and memory usage

Please tell me solaris functions/api for getting following information 1- Function that tells how much memory used by current process 2- Function that tells how much memory used by all running processes 3- Function that tells how much CPU is used by current process 4- Function that tells how... (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

8. UNIX for Dummies Questions & Answers

cpu usage

when i got the cpu usage values of the all process running in my sytem i see that 140% of the cpu is used. (using ps aux command) i have a 4 cpu system. can we say that averagely 35% of each cpu is used? and if i want to speak more precisely, how can i find out that, which cpu is used at... (4 Replies)
Discussion started by: gfhgfnhhn
4 Replies

9. Programming

Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries through a c program or java program i want to store that data into database so i can show it graphically thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies

10. Filesystems, Disks and Memory

cpu usage

hi, In response to your cpu usage answer I too read sys/sysinfo.h but , if we put these values to access the repective time fields in the array pst_cpu_time which is a member of the structure pst_dynamic values doesn't seem to match, why is like this? (0 Replies)
Discussion started by: sushaga
0 Replies
Login or Register to Ask a Question