Reporting resource usage - getrusage

Mathew BM LIM mbl900 at anusf.anu.edu.au
Tue May 28 13:01:35 AEST 1991


Hi,
	I am trying to write a login shell "wraparound"
which returns the total resource usage for the login session
including cpu time, swaps, io's, etc. I call it "rash"
for Resource Accounting SHell. I am developing this under SunOS4.1
but will eventually be porting it to SysVR4.
	Basically, rash works like this. I replace the user's
login shell with rash. When rash fires up, it forks
and the child execve's an interactive shell. The parent then
waits for the child process to die and makes a getrusage
system call to get the resource usages. But I have just realised
that :

1)	getrusage only returns the usage for IMMEDIATE
	children, so any processes started by the shell
	and put into the background will not show up.
	( By the was, rash will kill any background
	processes started by the shell when it exits -
	users are not allowed to leave any running, we
	have a batch system, NQS, for running long background
	jobs )
2)	getrusage is not mentioned in any of my SysVR4
	manuals, so presumably is not part of SysVR4.
	( I do not have a live SysVR4 system to work on yet )

So my questions are :

1)	can getrusage or something similar be made to 
	report on ALL decendents instead of just 
	immediate children processes?
2)	is there an equivalent SysVR4 system call?

Thanks





-- 
Mathew Lim, Unix Systems Programmer, ANU Supercomputer Facility,	
Australian National University,	GPO Box 4, Canberra City, ACT, Australia 2601.
Telephone : +61 6 249 2750 	| ACSnet    : Mathew.BM.Lim at anu.oz
Fax       : +61 6 247 3425	| Internet  : Mathew.BM.Lim at anu.edu.au



More information about the Comp.unix.programmer mailing list