Sponsored Content
Full Discussion: on hpunix cpu usage fields
Operating Systems HP-UX on hpunix cpu usage fields Post 19426 by vish_shan on Thursday 11th of April 2002 09:13:21 AM
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..
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
nlist(3)						     Library Functions Manual							  nlist(3)

NAME
nlist - Gets entries from name list. SYNOPSIS
#include <nlist.h> nlist(filename, nl) char *filename; struct nlist nl[]; cc ... -lmld DESCRIPTION
NOTE: The nlist subroutine has moved from the standard C library to the libmld.a library due to the difference in the object file format. Programs that need to use nlist must be linked with the -lmld flag. The nlist subroutine examines the name list in the given executable output file and selectively extracts a list of values. The name list consists of an array of structures containing names, types and values. The list is terminated with a null name. Each name is looked up in the name list of the file. If the name is found, the type and value of the name are inserted in the next two fields. If the name is not found, both entries are set to 0. For BSD compatibility, the nlist subroutine allows symbol names to be preceded by an underscore. If it does not find a symbol that matches the name as specified, nlist attempts to locate the symbol name with the leading underscore removed. For the structure declaration, see /usr/include/nlist.h. To obtain up-to-date system addresses from the system name list kept in the file /vmunix, use the knlist subroutine. Alternatively, use the getsysinfo function to obtain the name of the file from which the kernel was booted, prepend a slash character ("/") to this name, and supply the prepended name to the nlist subroutine. Do not specify /vmunix as the filename to the nlist subroutine; nlist may return invalid symbol addresses. ERRORS
If the file cannot be found or if it is not a valid namelist, -1 is returned; otherwise, the number of unfound namelist entries is returned. The type entry is set to 0 if the symbol is not found. RELATED INFORMATION
getsysinfo(2), knlist(3), a.out(4) delim off nlist(3)
All times are GMT -4. The time now is 08:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy