Stream: t-compiler/shrinkmem-sprint

Topic: getrusage mac os x weirdness


view this post on Zulip pnkfelix (Feb 23 2021 at 21:55):

I’m now wondering if RUSAGE_CHILDREN is just broken, at least for maxrss, on Mac OS X.

view this post on Zulip pnkfelix (Feb 23 2021 at 21:56):

Like, my code seems to do the right thing on Linux, but even after correcting for the bytes/kb confusion on mac os x, I still see output like this:

[RUSTC-TIMING] crossbeam_utils test:false 1.490 user: 1.415677 sys: 0.70062 max rss (kb): 111239168 page reclaims: 29329 page faults: 0 voluntary ctxt switches: 12 involuntary ctxt switches: 810

view this post on Zulip pnkfelix (Feb 23 2021 at 21:58):

Or this one

[RUSTC-TIMING] core test:false 36.903 user: 35.842394 sys: 1.361294 max rss (kb): 1230303232 page reclaims: 434827 page faults: 0 voluntary ctxt switches: 265 involuntary ctxt switches: 42471

view this post on Zulip pnkfelix (Feb 23 2021 at 22:02):

at some point i’m going to have to give up and resort to sampling rss via ps -o rss

view this post on Zulip Wesley Wiser (Feb 23 2021 at 22:34):

macOS time seems to use proc_pid_rusage instead of getrusage https://opensource.apple.com/source/shell_cmds/shell_cmds-216.60.1/time/time.c.auto.html

view this post on Zulip pnkfelix (Feb 24 2021 at 00:25):

I really should, at the very least, add a getrusage(RUSAGE_SELF, …) call to the rustc binary itself, and compare the numbers it yields to what the rustc shim is producing for getrusage(RUSAGE_CHILDREN, …)

view this post on Zulip pnkfelix (Mar 01 2021 at 13:00):

pnkfelix said:

I really should, at the very least, add a getrusage(RUSAGE_SELF, …) call to the rustc binary itself, and compare the numbers it yields to what the rustc shim is producing for getrusage(RUSAGE_CHILDREN, …)

I did this experiment, and I believe I disconfirmed the above hypothesis that the broken-ness is contained to RUSAGE_CHILDREN. That is: I saw similar weirdness when using RUSAGE_SELF just on the rustc binary.


Last updated: Oct 21 2021 at 21:02 UTC