diff options
| author | Cameron Taggart <cameron.taggart@gmail.com> | 2020-04-20 18:09:11 -0600 |
|---|---|---|
| committer | Cameron Taggart <cameron.taggart@gmail.com> | 2020-04-20 18:09:11 -0600 |
| commit | df3776bc0f7f250a7650fcaea67ac4a869cbcb80 (patch) | |
| tree | ea27d38314e13e88c10104fc3291d1d485cd7e6a | |
| parent | 20fc02f836f3035b86b56a7cedb97c5cd4ed9612 (diff) | |
| download | rust-df3776bc0f7f250a7650fcaea67ac4a869cbcb80.tar.gz rust-df3776bc0f7f250a7650fcaea67ac4a869cbcb80.zip | |
allow wasm32 compilation of librustc_data_structures/profiling.rs
| -rw-r--r-- | src/librustc_data_structures/profiling.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/librustc_data_structures/profiling.rs b/src/librustc_data_structures/profiling.rs index 23f3558cbdf..7377b7a6c8b 100644 --- a/src/librustc_data_structures/profiling.rs +++ b/src/librustc_data_structures/profiling.rs @@ -99,10 +99,12 @@ use parking_lot::RwLock; /// MmapSerializatioSink is faster on macOS and Linux /// but FileSerializationSink is faster on Windows -#[cfg(not(windows))] +#[cfg(all(not(windows),not(target_arch="wasm32")))] type SerializationSink = measureme::MmapSerializationSink; -#[cfg(windows)] +#[cfg(all(windows,not(target_arch="wasm32")))] type SerializationSink = measureme::FileSerializationSink; +#[cfg(target_arch="wasm32")] +type SerializationSink = measureme::ByteVecSink; type Profiler = measureme::Profiler<SerializationSink>; @@ -602,7 +604,7 @@ pub fn duration_to_secs_str(dur: std::time::Duration) -> String { } // Memory reporting -#[cfg(unix)] +#[cfg(all(unix,not(target_arch="wasm32")))] fn get_resident() -> Option<usize> { let field = 1; let contents = fs::read("/proc/self/statm").ok()?; @@ -612,7 +614,7 @@ fn get_resident() -> Option<usize> { Some(npages * 4096) } -#[cfg(windows)] +#[cfg(all(windows,not(target_arch="wasm32")))] fn get_resident() -> Option<usize> { use std::mem::{self, MaybeUninit}; use winapi::shared::minwindef::DWORD; @@ -630,3 +632,8 @@ fn get_resident() -> Option<usize> { } } } + +#[cfg(target_arch="wasm32")] +fn get_resident() -> Option<usize> { + None +} |
