*BSD News Article 35332


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!ghost.dsi.unimi.it!mirage.unipv.it!gilda!gallo
From: gallo@unipv.it (Piera Gallo)
Newsgroups: comp.unix.bsd
Subject: help needed on kmem
Date: 2 Sep 1994 16:30:08 GMT
Organization: Pavia University
Lines: 52
Message-ID: <347jug$5jb@mirage.unipv.it>
NNTP-Posting-Host: gilda.unipv.it
X-Newsreader: TIN [version 1.2 PL2]


Hi to everybody!

I am a graduating student at the University of Pavia, Italy.
Currently I am working at the realization of a software tool for emulating
system load and for benchmarking of UNIX based distributed systems.
One of our major objectives is to get the largest amount of information as 
possible about process resource usage with the minimum overhead.
Unfortunately the "getrusage" as it is, is of no help for me.
I need to get the resource usage of a process, which is a nephew
(child of a child) of the process where I am calling the "getrusage".
So I am compelled to find an alternative solution and the best way to do it 
is to read directly the kernel data structure.
Throught the nlist function is possible to examine the symbol table of the
kernel executable file /vmunix, in order to find the offset of the kernel 
variables in the /dev/kmem special file.
Unfortunately I do not know the names and the meaning of kernel variables 
and then I am not able to get any information.
I am interested to get the same information as the getrusage system call.

The first question is to get a list (with explanation) of the kernel
variables (that are system dependent) like that used in TOP (a pubblic
domain user/process UNIX/ULTRIX/HP--UX display):
	_avenrun
	_ccpu
	_cp_time
	_mpid
        _proc

I have seen in the include file proc.h that the "struct proc" has a field
struct rusage *p_ru and I have seen that the "getrusage" BSD implementation
reads such a field to get the information about process resources usage.
The question is if it is possible to get access to the process table in the
same way as for the other kernel variable and, if it is not, in which way 
is possible to do it.

If you have something interesting for our  work, or some paper (or book)
about this topic, it would be very nice of you if you will
send it to me. 
Thank you in advance for the attention you will give to me.

Best regards,

	Piera Gallo
	University of Pavia
	Dept. of Computer Science
	Via Abbiategrasso, 209
	I-27100 Pavia (Italy)

        E-mail: gallo@gilda.unipv.it
	Phone: (+39) 382 505369
	Fax:   (+39) 382 505373