Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site sdccsu3.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!cornell!uw-beaver!tektronix!hplabs!sdcrdcf!sdcsvax!sdccsu3!rusty
From: rusty@sdccsu3.UUCP (Rusty Wright)
Newsgroups: net.unix-wizards
Subject: memory usage statistics
Message-ID: <2169@sdccsu3.UUCP>
Date: Wed, 8-Aug-84 19:51:21 EDT
Article-I.D.: sdccsu3.2169
Posted: Wed Aug  8 19:51:21 1984
Date-Received: Fri, 10-Aug-84 02:37:49 EDT
Organization: U.C. San Diego, Computer Center
Lines: 24

does anybody know how a program can find out how much memory
it is using? it looks like i should use getrusage(2) and use
the ru_ixrss, ru_idrss, and ru_isrss fields but they continuously
grow. the manual page says:

	"This value is expressed in units of kilobytes *
	seconds-of-execution and is calculated by summing
	the number of memory pages in use each time the
	internal system clock ticks and then averaging over
	1 second intervals."

the bit about "averaging" would make you think that you would get
an average, but if you write a program that runs forever sleeping
for a second and then printing out ru_ixrss, the number printed
gets larger and larger.

in hardclock() in sys/kern_clock.c it says something to the effect
of

		u.u_ru.ru_idrss += u.u_procp->p_rssize;

nowhere can i find any averaging done on ru_idrss, except if the
kernel supports the 4.1 system calls the system call for vtimes
does.