Re: rusage::ru_maxrss in bytes or kilobytes
Re: rusage::ru_maxrss in bytes or kilobytes
- Subject: Re: rusage::ru_maxrss in bytes or kilobytes
- From: Terry Lambert <email@hidden>
- Date: Mon, 2 Mar 2009 13:35:41 -0800
The man page is wrong. Please file a documentation bug to get the man
page corrected.
The reported size is in bytes. POSIX only dictates that the rusage
fields ru_utime and ru_stime be defined; everything else is
implementation defined. We define it as bytes, since 1K blocks are
rather arbitrary and assume page sizes of 1K or larger on power of two
multiple boundaries. As an implementation detail, current page sizes
are 4K, but there's no promise not to change this at some point.
Realize, however, that given that POSIX only mandates those two
fields, so long as we leave them along, we may change what's provided
in terms of resource accounting at any point in the future without
impacting POSIX compliance.
Note: we also define this byte count as a long, which is size-variant
between 32 and 64 bit platforms.
-- Terry
On Mar 1, 2009, at 4:21 PM, Xi Wang wrote:
Hi,
According to the man page on Mac OS X (and the BSD convention),
ru_maxrss of struct rusage represents `the maximum resident set size
utilized (in kilobytes)'.
$ /usr/bin/time -l uname -v
Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008;
root:xnu-1228.9.59~1/RELEASE_I386
0.00 real 0.00 user 0.00 sys
385024 maximum resident set size
...
However, the reported number 385024 seems to be in bytes rather than
in kilobytes, because `uname' is a simple program and unlikely to take
376 MB memory. So are the results returned by syscalls getrusage and
wait4.
Here is the code.
kern_exit.c
612 p->p_ru->ru_maxrss = tinfo.resident_size;
task.c
1205 if (flavor == TASK_BASIC2_INFO_32) {
...
1210 basic_info->resident_size = pmap_resident_max(...);
1211 } else {
1212 basic_info->resident_size = pmap_resident_count(...);
1213 }
1214 basic_info->resident_size *= PAGE_SIZE;
Should there be something like `/ 1024' ? Thanks.
- xi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden