diff options
Diffstat (limited to 'compiler/rustc_data_structures')
| -rw-r--r-- | compiler/rustc_data_structures/src/flock.rs | 25 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/profiling.rs | 63 |
2 files changed, 0 insertions, 88 deletions
diff --git a/compiler/rustc_data_structures/src/flock.rs b/compiler/rustc_data_structures/src/flock.rs index 292a33d5646..d423d8acefd 100644 --- a/compiler/rustc_data_structures/src/flock.rs +++ b/compiler/rustc_data_structures/src/flock.rs @@ -4,31 +4,6 @@ //! green/native threading. This is just a bare-bones enough solution for //! librustdoc, it is not production quality at all. -#[cfg(bootstrap)] -cfg_match! { - cfg(target_os = "linux") => { - mod linux; - use linux as imp; - } - cfg(target_os = "redox") => { - mod linux; - use linux as imp; - } - cfg(unix) => { - mod unix; - use unix as imp; - } - cfg(windows) => { - mod windows; - use self::windows as imp; - } - _ => { - mod unsupported; - use unsupported as imp; - } -} - -#[cfg(not(bootstrap))] cfg_match! { target_os = "linux" => { mod linux; diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index 18e98e6c39f..39db551adfb 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -860,69 +860,6 @@ fn get_thread_id() -> u32 { } // Memory reporting -#[cfg(bootstrap)] -cfg_match! { - cfg(windows) => { - pub fn get_resident_set_size() -> Option<usize> { - use std::mem; - - use windows::{ - Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS}, - Win32::System::Threading::GetCurrentProcess, - }; - - let mut pmc = PROCESS_MEMORY_COUNTERS::default(); - let pmc_size = mem::size_of_val(&pmc); - unsafe { - K32GetProcessMemoryInfo( - GetCurrentProcess(), - &mut pmc, - pmc_size as u32, - ) - } - .ok() - .ok()?; - - Some(pmc.WorkingSetSize) - } - } - 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_TASKINFO_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_TASKINFO_SIZE); - if ret == PROC_TASKINFO_SIZE { - Some(info.pti_resident_size as usize) - } else { - None - } - } - } - } - cfg(unix) => { - pub fn get_resident_set_size() -> Option<usize> { - let field = 1; - let contents = fs::read("/proc/self/statm").ok()?; - let contents = String::from_utf8(contents).ok()?; - let s = contents.split_whitespace().nth(field)?; - let npages = s.parse::<usize>().ok()?; - Some(npages * 4096) - } - } - _ => { - pub fn get_resident_set_size() -> Option<usize> { - None - } - } -} - -#[cfg(not(bootstrap))] cfg_match! { windows => { pub fn get_resident_set_size() -> Option<usize> { |
