memory usage statistics

Rusty Wright rusty at sdccsu3.UUCP
Thu Aug 9 09:51:21 AEST 1984


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.



More information about the Comp.unix.wizards mailing list