Created
May 21, 2021 14:46
-
-
Save pnkfelix/cb3834a051279514979ca85ec45cdbe7 to your computer and use it in GitHub Desktop.
fix maxrss compute for mac in print_step_rusage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| commit 7126619a396191a8789367458ca9d4273f458672 (HEAD -> fix-max-rss-division-on-mac) | |
| Author: Felix Klock <[email protected]> | |
| Date: Fri May 21 10:31:39 2021 -0400 | |
| facepalm: operator precedence fail on my part. | |
| This bug was only visible on mac. Also, print_step_rusage is a | |
| relatively new internal feature, that is not heavily used, and has no | |
| tests. All of these factors contributed to how this went uncaught this | |
| long. Thanks to Josh Triplett for pointing it out! | |
| diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs | |
| index d462dc4d116..4b98abfb308 100644 | |
| --- a/src/bootstrap/bin/rustc.rs | |
| +++ b/src/bootstrap/bin/rustc.rs | |
| @@ -305,7 +305,7 @@ fn format_rusage_data(_child: Child) -> Option<String> { | |
| }; | |
| // Mac OS X reports the maxrss in bytes, not kb. | |
| let divisor = if env::consts::OS == "macos" { 1024 } else { 1 }; | |
| - let maxrss = rusage.ru_maxrss + (divisor - 1) / divisor; | |
| + let maxrss = (rusage.ru_maxrss + (divisor - 1)) / divisor; | |
| let mut init_str = format!( | |
| "user: {USER_SEC}.{USER_USEC:03} \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment