Return to BSD News archive
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!gatech!newsxfer.itd.umich.edu!zip.eecs.umich.edu!yeshua.marcam.com!news.kei.com!travelers.mail.cornell.edu!newsstand.cit.cornell.edu!news.graphics.cornell.edu!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: 1 Aug 1994 12:13:10 GMT
Organization: Pavia University
Lines: 88
Message-ID: <31iosm$ao3@mirage.unipv.it>
NNTP-Posting-Host: gilda.unipv.it
X-Newsreader: TIN [version 1.2 PL2]
I am a student of Performance Evaluation Laboratory at 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 with
Prof. M. Calzarossa.
One of our major objectives is to get the largest amount of information as
possible about process resource usage with the minimum overhead.
At the beginning we were not concerned with directly reading the kernel
data structure in order to get resource usage; rather we preferrred,
for simplicity, to employ the "getrusage" system call.
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".
Such a system call succeed in getting the resource usage of all terminated
child at any level (nephew, child of a child of a child, and so on) but
it is able to display the resource usage of a nephew only if the first level
child, which is father of it, is already terminated.
In my program I attempt to get such an information when the first level
child has not yet terminated.
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.
Such a system call returns the following structure:
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
int ru_maxrss;
int ru_ixrss; /* integral shared text size */
int ru_ismrss /* integral shared memory size */
int ru_idrss; /* integral unshared data size */
int ru_isrss; /* integral unshared stack size */
int ru_minflt; /* page reclaims */
int ru_majflt; /* page faults */
int ru_nswap; /* swaps */
int ru_inblock; /* block input operations */
int ru_oublock; /* block output operations */
int ru_msgsnd; /* messages sent */
int ru_msgrcv; /* messages received */
int ru_nsignals; /* signals received */
int ru_nvcsw; /* voluntary context switches */
int ru_nivcsw; /* involuntary context switches */
};
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 display):
_avenrun
_ccpu
_cp_time
_mpid
_proc
In this way I should be able to get the same information about process
resources usage as with the "getrusage" system call.
Another question is about the behaviour of the "getrusage" system call
if it is due to its implementation or to the way the kernel itself updates
its internal variable.
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)
Phone: (+39) 382 505369
Fax: (+39) 382 505373