Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory profiling on macOS #98164

Closed
wants to merge 25 commits into from
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ef85aac
Fixed
rdzhaafar Jun 16, 2022
a737258
docs: clean up trait docs for tuples
notriddle Jun 7, 2022
c86c12f
rustdoc: show auto/blanket docs for tuple and unit
notriddle Jun 7, 2022
2f3b46d
docs: show Clone and Copy on () doc pages
notriddle Jun 7, 2022
1ae6443
rustdoc: show tuple impls as `impl Trait for (T, ...)`
notriddle Jun 9, 2022
090dc21
rustdoc: fixed messed-up rustdoc auto trait impls
notriddle Jun 9, 2022
fce5c03
Fix bootstrap attr
notriddle Jun 9, 2022
08f27b9
Fix incorrectly spelled "variadic"
notriddle Jun 11, 2022
770ae5c
Use relative path for addressing things in rust-lang/rust
notriddle Jun 11, 2022
81b66ef
Re-add explicit list of traits to tuple docs, with limit notes
notriddle Jun 11, 2022
9ed1930
Add test case for #trait-implementations-1 link
notriddle Jun 11, 2022
7fcdede
Fix broken test case
notriddle Jun 11, 2022
fe2f55f
docs: make all the variadic impls use `(T, ...)` exactly
notriddle Jun 11, 2022
09988fd
Update library/std/src/primitive_docs.rs
notriddle Jun 12, 2022
caabb73
Update library/core/src/primitive_docs.rs
notriddle Jun 12, 2022
994d1ad
Add docs to `maybe_tuple_doc!`
notriddle Jun 12, 2022
120ebf1
rustdoc: change error message for invalid `#[doc(tuple_variadic)]`
notriddle Jun 12, 2022
0d64915
rustdoc: add missing article
notriddle Jun 13, 2022
e609665
rustdoc: change "variadic tuple" notation to look less like real syntax
notriddle Jun 14, 2022
04beef9
rustdoc: add test case for "variadic tuple" search notation
notriddle Jun 14, 2022
c1d1ea9
Merge branch 'rust-lang:master' into master
rdzhaafar Jun 17, 2022
694b49c
Re-wrote the PR using definitions from libc
rdzhaafar Jun 17, 2022
e204c84
Merge branch 'rust-lang:master' into master
rdzhaafar Jun 20, 2022
c74bd52
Merge remote-tracking branch 'upstream/master'
rdzhaafar Jun 21, 2022
041459d
Merge branch 'rust-lang:master' into master
rdzhaafar Jun 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions compiler/rustc_data_structures/src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,24 @@ cfg_if! {
}
}
}
} else if #[cfg(target_os = "macos")] {
pub fn get_resident_set_size() -> Option<usize> {
use libc::{c_int, c_void, getpid, proc_pidinfo, proc_taskinfo, PROC_PIDTASKINFO};
use std::mem;
const PROC_PIDTASKINFO_SIZE: c_int = mem::size_of::<proc_taskinfo>() as c_int;

unsafe {
let mut info: proc_taskinfo = mem::zeroed();
let info_ptr = &mut info as *mut proc_taskinfo as *mut c_void;
let pid = getpid() as c_int;
let ret = proc_pidinfo(pid, PROC_PIDTASKINFO, 0, info_ptr, PROC_PIDTASKINFO_SIZE);
if ret == PROC_PIDTASKINFO_SIZE {
Some(info.pti_resident_size as usize)
} else {
None
}
}
}
} else if #[cfg(unix)] {
pub fn get_resident_set_size() -> Option<usize> {
let field = 1;
Expand Down