profile
viewpoint
Wesley Wiser wesleywiser HighGear Maryland @rust-lang Compiler Team, Senior Software Enginer @SwiftSoftware-Inc

rust-lang/measureme 136

Support crate for rustc's self-profiling feature

wesleywiser/process_path 4

A Rust library to get the path of the currently executing process

JasonKleban/Unbounded 2

F# to T-SQL. Remote command execution and domain invariant enforcement

wesleywiser/Expert-System 1

An example expert system for CS 428

wesleywiser/FSharpSnippets 1

Snippets and modules of F# code.

wesleywiser/IronJS 1

IronJS - A JavaScript implementation for .NET written in F#

wesleywiser/jquery-mobile 1

jQuery Mobile Framework

wesleywiser/Reconnect-wifi-daemon 1

A simple daemon for Ubuntu which causes your computer to automatically reconnect to a specific wifi access point.

issue closedrust-lang/measureme

Cut new releases?

measureme itself is at 0.7.1, an entirely respectable version number. However, recent commits have grown its capabilities and updated its dependencies. It's been a while, so it should probably get to grow up to be 0.7.2 or 0.8.0, along with some of the other workspace members.

closed time in 10 hours

workingjubilee

issue commentrust-lang/measureme

Cut new releases?

We cut a new release and https://github.com/rust-lang/rust/pull/77398 landed so we can close this.

workingjubilee

comment created time in 10 hours

issue closedrust-lang/measureme

Could not find .mm_profdata file

I'm using for the first time measureme to profile the compilation time of a project which needs to be compiled with nightly-2020-09-30. I followed this guide and I'm getting the following error.

Error: "Could not find profiling data file `prusti_driver-32670.mm_profdata`.It looks like your profiling data has been generated by an out-dated version of measureme (0.7 or older)."

Is it because the measureme version that comes with nightly-2020-09-30 is out-dated? Do you know any workarounds?

closed time in 10 hours

fpoli

issue commentrust-lang/measureme

Could not find .mm_profdata file

Since https://github.com/rust-lang/rust/pull/77398 landed yesterday, this should be resolved.

fpoli

comment created time in 10 hours

Pull request review commentrust-lang/measureme

[WIP] summarize: add "aggregate" sub-command for analyzing sets of profiles.

+use std::error::Error;+use std::time::Instant;++// HACK(eddyb) this is semantically `warn!` but uses `error!` because+// that's the only log level enabled by default - see also+// https://github.com/rust-lang/rust/issues/76824+macro_rules! really_warn {+    ($msg:literal $($rest:tt)*) => {+        error!(concat!("[WARNING] ", $msg) $($rest)*)+    }+}++pub enum Counter {+    WallTime(WallTime),+    Instructions(Instructions),+    InstructionsMinusIrqs(InstructionsMinusIrqs),+    InstructionsMinusRaw0420(InstructionsMinusRaw0420),+}++impl Counter {+    pub fn by_name(name: &str) -> Result<Self, Box<dyn Error + Send + Sync>> {+        Ok(match name {+            WallTime::NAME => Counter::WallTime(WallTime::new()),+            Instructions::NAME => Counter::Instructions(Instructions::new()?),+            InstructionsMinusIrqs::NAME => {+                Counter::InstructionsMinusIrqs(InstructionsMinusIrqs::new()?)+            }+            InstructionsMinusRaw0420::NAME => {+                Counter::InstructionsMinusRaw0420(InstructionsMinusRaw0420::new()?)+            }+            _ => return Err(format!("{:?} is not a valid counter name", name).into()),+        })+    }++    pub(super) fn describe_as_json(&self) -> String {+        let (name, units) = match self {+            Counter::WallTime(_) => (+                WallTime::NAME,+                r#"[["ns", 1], ["μs", 1000], ["ms", 1000000], ["s", 1000000000]]"#,+            ),+            Counter::Instructions(_) => (Instructions::NAME, r#"[["instructions", 1]]"#),+            Counter::InstructionsMinusIrqs(_) => {+                (InstructionsMinusIrqs::NAME, r#"[["instructions", 1]]"#)+            }+            Counter::InstructionsMinusRaw0420(_) => {+                (InstructionsMinusRaw0420::NAME, r#"[["instructions", 1]]"#)+            }+        };+        format!(r#"{{ "name": "{}", "units": {} }}"#, name, units)+    }++    #[inline]+    pub(super) fn since_start(&self) -> u64 {+        match self {+            Counter::WallTime(counter) => counter.since_start(),+            Counter::Instructions(counter) => counter.since_start(),+            Counter::InstructionsMinusIrqs(counter) => counter.since_start(),+            Counter::InstructionsMinusRaw0420(counter) => counter.since_start(),+        }+    }+}++pub struct WallTime {+    start: Instant,+}++impl WallTime {+    const NAME: &'static str = "wall-time";++    pub fn new() -> Self {+        WallTime {+            start: Instant::now(),+        }+    }++    #[inline]+    fn since_start(&self) -> u64 {+        self.start.elapsed().as_nanos() as u64+    }+}++pub struct Instructions {+    instructions: hw::Counter,+    start: u64,+}++impl Instructions {+    const NAME: &'static str = "instructions:u";++    pub fn new() -> Result<Self, Box<dyn Error + Send + Sync>> {+        let model = hw::CpuModel::detect()?;+        let instructions = hw::Counter::new(&model, HwCounterType::Instructions)?;+        let start = instructions.read();+        Ok(Instructions {+            instructions,+            start,+        })+    }++    #[inline]+    fn since_start(&self) -> u64 {+        self.instructions.read().wrapping_sub(self.start)+    }+}++pub struct InstructionsMinusIrqs {+    instructions: hw::Counter,+    irqs: hw::Counter,+    start: u64,+}++impl InstructionsMinusIrqs {+    const NAME: &'static str = "instructions-minus-irqs:u";++    pub fn new() -> Result<Self, Box<dyn Error + Send + Sync>> {+        let model = hw::CpuModel::detect()?;+        let instructions = hw::Counter::new(&model, HwCounterType::Instructions)?;+        let irqs = hw::Counter::new(&model, HwCounterType::Irqs)?;+        let (start_instructions, start_irqs) = (&instructions, &irqs).read();+        let start = start_instructions.wrapping_sub(start_irqs);+        Ok(InstructionsMinusIrqs {+            instructions,+            irqs,+            start,+        })+    }++    #[inline]+    fn since_start(&self) -> u64 {+        let (instructions, irqs) = (&self.instructions, &self.irqs).read();+        instructions.wrapping_sub(irqs).wrapping_sub(self.start)+    }+}++// HACK(eddyb) this is a variant of `instructions-minus-irqs:u`, where `r0420`+// is subtracted, instead of the usual "hardware interrupts" (aka IRQs).+// `r0420` is an undocumented counter on AMD Zen CPUs which appears to count+// both hardware interrupts and exceptions (such as page faults), though+// it's unclear yet what exactly it's counting (could even be `iret`s).+pub struct InstructionsMinusRaw0420(InstructionsMinusIrqs);++impl InstructionsMinusRaw0420 {+    const NAME: &'static str = "instructions-minus-r0420:u";++    pub fn new() -> Result<Self, Box<dyn Error + Send + Sync>> {+        let model = hw::CpuModel::detect()?;+        let instructions = hw::Counter::new(&model, HwCounterType::Instructions)?;+        let irqs = hw::Counter::new(&model, HwCounterType::Raw0420)?;+        let (start_instructions, start_irqs) = (&instructions, &irqs).read();+        let start = start_instructions.wrapping_sub(start_irqs);+        Ok(InstructionsMinusRaw0420(InstructionsMinusIrqs {+            instructions,+            irqs,+            start,+        }))+    }++    #[inline]+    fn since_start(&self) -> u64 {+        self.0.since_start()+    }+}++trait HwCounterRead {+    type Output;+    fn read(&self) -> Self::Output;+}++enum HwCounterType {+    Instructions,+    Irqs,+    Raw0420,+}++const BUG_REPORT_MSG: &str =+    "please report this to https://github.com/rust-lang/measureme/issues/new";++/// Linux x86_64 implementation based on `perf_event_open` and `rdpmc`.+#[cfg(all(feature = "nightly", target_arch = "x86_64", target_os = "linux"))]+mod hw {+    use memmap::{Mmap, MmapOptions};+    use perf_event_open_sys::{bindings::*, perf_event_open};+    use std::convert::TryInto;+    use std::error::Error;+    use std::fs;+    use std::mem;+    use std::os::unix::io::FromRawFd;++    pub(super) struct Counter {+        mmap: Mmap,+        reg_idx: u32,+    }++    impl Counter {+        pub(super) fn new(+            model: &CpuModel,+            counter_type: super::HwCounterType,+        ) -> Result<Self, Box<dyn Error + Send + Sync>> {+            let (type_, hw_id) = match counter_type {+                super::HwCounterType::Instructions => (+                    perf_type_id_PERF_TYPE_HARDWARE,+                    perf_hw_id_PERF_COUNT_HW_INSTRUCTIONS,+                ),+                super::HwCounterType::Irqs => {+                    (perf_type_id_PERF_TYPE_RAW, model.irqs_counter_config()?)+                }+                super::HwCounterType::Raw0420 => {+                    match model {+                        CpuModel::Amd(AmdGen::Zen) => {}++                        _ => really_warn!(+                            "Counter::new: the undocumented `r0420` performance \+                             counter has only been observed on AMD Zen CPUs"+                        ),+                    }++                    (perf_type_id_PERF_TYPE_RAW, 0x04_20)+                }+            };+            Self::with_type_and_hw_id(type_, hw_id)+        }++        fn with_type_and_hw_id(+            type_: perf_type_id,+            hw_id: u32,+        ) -> Result<Self, Box<dyn Error + Send + Sync>> {+            let mut attrs = perf_event_attr {+                size: mem::size_of::<perf_event_attr>().try_into().unwrap(),+                type_,+                config: hw_id.into(),+                ..perf_event_attr::default()+            };++            // Only record same-thread, any CPUs, and only userspace (no kernel/hypervisor).+            // NOTE(eddyb) `pid = 0`, despite talking about "process id", means+            // "calling process/thread", *not* "any thread in the calling process"+            // (i.e. "process" is interchangeable with "main thread of the process")+            // FIXME(eddyb) introduce per-thread counters and/or use `inherit`+            // (and `inherit_stat`? though they might not be appropriate here)+            // to be able to read the counter on more than just the initial thread.+            let pid = 0;+            let cpu = -1;+            let group_fd = -1;+            attrs.set_exclude_kernel(1);+            attrs.set_exclude_hv(1);++            let file = unsafe {+                let fd =+                    perf_event_open(&mut attrs, pid, cpu, group_fd, PERF_FLAG_FD_CLOEXEC.into());+                if fd < 0 {+                    Err(std::io::Error::from_raw_os_error(-fd))+                } else {+                    Ok(fs::File::from_raw_fd(fd))+                }+            };+            let file = file.map_err(|e| format!("perf_event_open failed: {:?}", e))?;++            let mmap = unsafe {+                MmapOptions::new()+                    .len(mem::size_of::<perf_event_mmap_page>())+                    .map(&file)+            };+            let mmap = mmap.map_err(|e| format!("perf_event_mmap_page: mmap failed: {:?}", e))?;++            let mut counter = Counter { mmap, reg_idx: 0 };++            let (version, compat_version, caps, index, pmc_width) = counter+                .access_mmap_page_with_seqlock(|mp| {+                    (+                        mp.version,+                        mp.compat_version,+                        unsafe { mp.__bindgen_anon_1.__bindgen_anon_1 },+                        mp.index,+                        mp.pmc_width,+                    )+                });++            info!(+                "Counter::new: version={} compat_version={} index={:#x}",+                version, compat_version, index,+            );++            if caps.cap_user_rdpmc() == 0 {+                return Err(format!(+                    "perf_event_mmap_page: missing cap_user_rdpmc{}",+                    if caps.cap_bit0_is_deprecated() == 0 && caps.cap_bit0() == 1 {+                        " (ignoring legacy/broken rdpmc support)"+                    } else {+                        ""+                    }+                )+                .into());+            }++            if index == 0 {+                return Err(format!(+                    "perf_event_mmap_page: no allocated hardware register (ran out?)"+                )+                .into());+            }+            counter.reg_idx = index - 1;++            if (cfg!(not(accurate_seqlock_rdpmc)) || true) && pmc_width != 48 {+                return Err(format!(+                    "perf_event_mmap_page: {}-bit hardware counter found, only 48-bit supported",+                    pmc_width+                )+                .into());+            }++            Ok(counter)+        }++        /// Try to access the mmap page, retrying the `attempt` closure as long+        /// as the "seqlock" sequence number changes (which indicates the kernel+        /// has updated one or more fields within the mmap page).+        #[inline]+        fn access_mmap_page_with_seqlock<T>(+            &self,+            attempt: impl Fn(&perf_event_mmap_page) -> T,+        ) -> T {+            // FIXME(eddyb) it's probably UB to use regular reads, especially

Do you think this FIXME should be resolved before we merge or are we unlikely to be affected by this UB in practice?

eddyb

comment created time in a day

Pull request review commentrust-lang/measureme

[WIP] summarize: add "aggregate" sub-command for analyzing sets of profiles.

+use std::error::Error;+use std::time::Instant;++// HACK(eddyb) this is semantically `warn!` but uses `error!` because+// that's the only log level enabled by default - see also+// https://github.com/rust-lang/rust/issues/76824+macro_rules! really_warn {+    ($msg:literal $($rest:tt)*) => {+        error!(concat!("[WARNING] ", $msg) $($rest)*)+    }+}++pub enum Counter {+    WallTime(WallTime),+    Instructions(Instructions),+    InstructionsMinusIrqs(InstructionsMinusIrqs),+    InstructionsMinusRaw0420(InstructionsMinusRaw0420),+}++impl Counter {+    pub fn by_name(name: &str) -> Result<Self, Box<dyn Error + Send + Sync>> {+        Ok(match name {+            WallTime::NAME => Counter::WallTime(WallTime::new()),+            Instructions::NAME => Counter::Instructions(Instructions::new()?),+            InstructionsMinusIrqs::NAME => {+                Counter::InstructionsMinusIrqs(InstructionsMinusIrqs::new()?)+            }+            InstructionsMinusRaw0420::NAME => {+                Counter::InstructionsMinusRaw0420(InstructionsMinusRaw0420::new()?)+            }+            _ => return Err(format!("{:?} is not a valid counter name", name).into()),+        })+    }++    pub(super) fn describe_as_json(&self) -> String {+        let (name, units) = match self {+            Counter::WallTime(_) => (+                WallTime::NAME,+                r#"[["ns", 1], ["μs", 1000], ["ms", 1000000], ["s", 1000000000]]"#,+            ),+            Counter::Instructions(_) => (Instructions::NAME, r#"[["instructions", 1]]"#),+            Counter::InstructionsMinusIrqs(_) => {+                (InstructionsMinusIrqs::NAME, r#"[["instructions", 1]]"#)+            }+            Counter::InstructionsMinusRaw0420(_) => {+                (InstructionsMinusRaw0420::NAME, r#"[["instructions", 1]]"#)+            }+        };+        format!(r#"{{ "name": "{}", "units": {} }}"#, name, units)+    }++    #[inline]+    pub(super) fn since_start(&self) -> u64 {+        match self {+            Counter::WallTime(counter) => counter.since_start(),+            Counter::Instructions(counter) => counter.since_start(),+            Counter::InstructionsMinusIrqs(counter) => counter.since_start(),+            Counter::InstructionsMinusRaw0420(counter) => counter.since_start(),+        }+    }+}++pub struct WallTime {+    start: Instant,+}++impl WallTime {+    const NAME: &'static str = "wall-time";++    pub fn new() -> Self {+        WallTime {+            start: Instant::now(),+        }+    }++    #[inline]+    fn since_start(&self) -> u64 {+        self.start.elapsed().as_nanos() as u64+    }+}++pub struct Instructions {+    instructions: hw::Counter,+    start: u64,+}++impl Instructions {+    const NAME: &'static str = "instructions:u";++    pub fn new() -> Result<Self, Box<dyn Error + Send + Sync>> {+        let model = hw::CpuModel::detect()?;+        let instructions = hw::Counter::new(&model, HwCounterType::Instructions)?;+        let start = instructions.read();+        Ok(Instructions {+            instructions,+            start,+        })+    }++    #[inline]+    fn since_start(&self) -> u64 {+        self.instructions.read().wrapping_sub(self.start)+    }+}++pub struct InstructionsMinusIrqs {+    instructions: hw::Counter,+    irqs: hw::Counter,+    start: u64,+}++impl InstructionsMinusIrqs {+    const NAME: &'static str = "instructions-minus-irqs:u";++    pub fn new() -> Result<Self, Box<dyn Error + Send + Sync>> {+        let model = hw::CpuModel::detect()?;+        let instructions = hw::Counter::new(&model, HwCounterType::Instructions)?;+        let irqs = hw::Counter::new(&model, HwCounterType::Irqs)?;+        let (start_instructions, start_irqs) = (&instructions, &irqs).read();+        let start = start_instructions.wrapping_sub(start_irqs);+        Ok(InstructionsMinusIrqs {+            instructions,+            irqs,+            start,+        })+    }++    #[inline]+    fn since_start(&self) -> u64 {+        let (instructions, irqs) = (&self.instructions, &self.irqs).read();+        instructions.wrapping_sub(irqs).wrapping_sub(self.start)+    }+}++// HACK(eddyb) this is a variant of `instructions-minus-irqs:u`, where `r0420`+// is subtracted, instead of the usual "hardware interrupts" (aka IRQs).+// `r0420` is an undocumented counter on AMD Zen CPUs which appears to count+// both hardware interrupts and exceptions (such as page faults), though+// it's unclear yet what exactly it's counting (could even be `iret`s).+pub struct InstructionsMinusRaw0420(InstructionsMinusIrqs);++impl InstructionsMinusRaw0420 {+    const NAME: &'static str = "instructions-minus-r0420:u";++    pub fn new() -> Result<Self, Box<dyn Error + Send + Sync>> {+        let model = hw::CpuModel::detect()?;+        let instructions = hw::Counter::new(&model, HwCounterType::Instructions)?;+        let irqs = hw::Counter::new(&model, HwCounterType::Raw0420)?;+        let (start_instructions, start_irqs) = (&instructions, &irqs).read();+        let start = start_instructions.wrapping_sub(start_irqs);+        Ok(InstructionsMinusRaw0420(InstructionsMinusIrqs {+            instructions,+            irqs,+            start,+        }))+    }++    #[inline]+    fn since_start(&self) -> u64 {+        self.0.since_start()+    }+}++trait HwCounterRead {+    type Output;+    fn read(&self) -> Self::Output;+}++enum HwCounterType {+    Instructions,+    Irqs,+    Raw0420,+}++const BUG_REPORT_MSG: &str =+    "please report this to https://github.com/rust-lang/measureme/issues/new";++/// Linux x86_64 implementation based on `perf_event_open` and `rdpmc`.+#[cfg(all(feature = "nightly", target_arch = "x86_64", target_os = "linux"))]+mod hw {+    use memmap::{Mmap, MmapOptions};+    use perf_event_open_sys::{bindings::*, perf_event_open};+    use std::convert::TryInto;+    use std::error::Error;+    use std::fs;+    use std::mem;+    use std::os::unix::io::FromRawFd;++    pub(super) struct Counter {+        mmap: Mmap,+        reg_idx: u32,+    }++    impl Counter {+        pub(super) fn new(+            model: &CpuModel,+            counter_type: super::HwCounterType,+        ) -> Result<Self, Box<dyn Error + Send + Sync>> {+            let (type_, hw_id) = match counter_type {+                super::HwCounterType::Instructions => (+                    perf_type_id_PERF_TYPE_HARDWARE,+                    perf_hw_id_PERF_COUNT_HW_INSTRUCTIONS,+                ),+                super::HwCounterType::Irqs => {+                    (perf_type_id_PERF_TYPE_RAW, model.irqs_counter_config()?)+                }+                super::HwCounterType::Raw0420 => {+                    match model {+                        CpuModel::Amd(AmdGen::Zen) => {}++                        _ => really_warn!(+                            "Counter::new: the undocumented `r0420` performance \+                             counter has only been observed on AMD Zen CPUs"+                        ),+                    }++                    (perf_type_id_PERF_TYPE_RAW, 0x04_20)+                }+            };+            Self::with_type_and_hw_id(type_, hw_id)+        }++        fn with_type_and_hw_id(+            type_: perf_type_id,+            hw_id: u32,+        ) -> Result<Self, Box<dyn Error + Send + Sync>> {+            let mut attrs = perf_event_attr {+                size: mem::size_of::<perf_event_attr>().try_into().unwrap(),+                type_,+                config: hw_id.into(),+                ..perf_event_attr::default()+            };++            // Only record same-thread, any CPUs, and only userspace (no kernel/hypervisor).+            // NOTE(eddyb) `pid = 0`, despite talking about "process id", means+            // "calling process/thread", *not* "any thread in the calling process"+            // (i.e. "process" is interchangeable with "main thread of the process")+            // FIXME(eddyb) introduce per-thread counters and/or use `inherit`+            // (and `inherit_stat`? though they might not be appropriate here)+            // to be able to read the counter on more than just the initial thread.+            let pid = 0;+            let cpu = -1;+            let group_fd = -1;+            attrs.set_exclude_kernel(1);+            attrs.set_exclude_hv(1);++            let file = unsafe {+                let fd =+                    perf_event_open(&mut attrs, pid, cpu, group_fd, PERF_FLAG_FD_CLOEXEC.into());+                if fd < 0 {+                    Err(std::io::Error::from_raw_os_error(-fd))+                } else {+                    Ok(fs::File::from_raw_fd(fd))+                }+            };+            let file = file.map_err(|e| format!("perf_event_open failed: {:?}", e))?;++            let mmap = unsafe {+                MmapOptions::new()+                    .len(mem::size_of::<perf_event_mmap_page>())+                    .map(&file)+            };+            let mmap = mmap.map_err(|e| format!("perf_event_mmap_page: mmap failed: {:?}", e))?;++            let mut counter = Counter { mmap, reg_idx: 0 };++            let (version, compat_version, caps, index, pmc_width) = counter+                .access_mmap_page_with_seqlock(|mp| {+                    (+                        mp.version,+                        mp.compat_version,+                        unsafe { mp.__bindgen_anon_1.__bindgen_anon_1 },+                        mp.index,+                        mp.pmc_width,+                    )+                });++            info!(+                "Counter::new: version={} compat_version={} index={:#x}",+                version, compat_version, index,+            );++            if caps.cap_user_rdpmc() == 0 {+                return Err(format!(+                    "perf_event_mmap_page: missing cap_user_rdpmc{}",+                    if caps.cap_bit0_is_deprecated() == 0 && caps.cap_bit0() == 1 {+                        " (ignoring legacy/broken rdpmc support)"+                    } else {+                        ""+                    }+                )+                .into());+            }++            if index == 0 {+                return Err(format!(+                    "perf_event_mmap_page: no allocated hardware register (ran out?)"+                )+                .into());+            }+            counter.reg_idx = index - 1;++            if (cfg!(not(accurate_seqlock_rdpmc)) || true) && pmc_width != 48 {+                return Err(format!(+                    "perf_event_mmap_page: {}-bit hardware counter found, only 48-bit supported",+                    pmc_width+                )+                .into());+            }++            Ok(counter)+        }++        /// Try to access the mmap page, retrying the `attempt` closure as long+        /// as the "seqlock" sequence number changes (which indicates the kernel+        /// has updated one or more fields within the mmap page).+        #[inline]+        fn access_mmap_page_with_seqlock<T>(+            &self,+            attempt: impl Fn(&perf_event_mmap_page) -> T,+        ) -> T {+            // FIXME(eddyb) it's probably UB to use regular reads, especially+            // from behind `&T`, with the only synchronization being barriers.+            // Probably needs atomic reads, and stronger ones at that, for the+            // `lock` field, than the fields (which would be `Relaxed`?).+            let mmap_page = unsafe { &*(self.mmap.as_ptr() as *const perf_event_mmap_page) };+            let barrier = || std::sync::atomic::fence(std::sync::atomic::Ordering::Acquire);++            loop {+                // Grab the "seqlock" - the kernel will update this value when it+                // updates any of the other fields that may be read in `attempt`.+                let seq_lock = mmap_page.lock;+                barrier();++                let result = attempt(mmap_page);++                // If nothing has changed, we're done. Otherwise, keep retrying.+                barrier();+                if mmap_page.lock == seq_lock {+                    return result;+                }+            }+        }+    }++    impl super::HwCounterRead for Counter {+        type Output = u64;++        #[inline]+        fn read(&self) -> u64 {+            // HACK(eddyb) keep the accurate code around while not using it,+            // to minimize overhead without losing the more complex implementation.+            let (counter, offset, pmc_width) = if cfg!(accurate_seqlock_rdpmc) && false {+                self.access_mmap_page_with_seqlock(|mp| {+                    let caps = unsafe { mp.__bindgen_anon_1.__bindgen_anon_1 };+                    assert_ne!(caps.cap_user_rdpmc(), 0);++                    (+                        rdpmc(mp.index.checked_sub(1).unwrap()),+                        mp.offset,+                        mp.pmc_width,+                    )+                })+            } else {+                (rdpmc(self.reg_idx), 0, 48)+            };++            let counter = offset + (counter as i64);++            // Sign-extend the `pmc_width`-bit value to `i64`.+            (counter << (64 - pmc_width) >> (64 - pmc_width)) as u64+        }+    }++    impl super::HwCounterRead for (&Counter, &Counter) {+        type Output = (u64, u64);++        #[inline]+        fn read(&self) -> (u64, u64) {+            // HACK(eddyb) keep the accurate code around while not using it,+            // to minimize overhead without losing the more complex implementation.+            if (cfg!(accurate_seqlock_rdpmc) || cfg!(unserialized_rdpmc)) && false {+                return (self.0.read(), self.1.read());+            }++            let pmc_width = 48;++            let (a_counter, b_counter) = rdpmc_pair(self.0.reg_idx, self.1.reg_idx);++            // Sign-extend the `pmc_width`-bit values to `i64`.+            (+                ((a_counter as i64) << (64 - pmc_width) >> (64 - pmc_width)) as u64,+                ((b_counter as i64) << (64 - pmc_width) >> (64 - pmc_width)) as u64,+            )+        }+    }++    /// Read the hardware performance counter indicated by `reg_idx`.+    ///+    /// If the counter is signed, sign extension should be performed based on+    /// the width of the register (32 to 64 bits, e.g. 48-bit seems common).+    #[inline(always)]+    fn rdpmc(reg_idx: u32) -> u64 {+        let (lo, hi): (u32, u32);+        unsafe {+            // NOTE(eddyb) below comment is outdated (the other branch uses `cpuid`).+            if cfg!(unserialized_rdpmc) && false {+                // FIXME(eddyb) the Intel and AMD manuals warn about the need for+                // "serializing instructions" before/after `rdpmc`, if avoiding any+                // reordering is desired, but do not agree on the full set of usable+                // "serializing instructions" (e.g. `mfence` isn't listed in both).+                //+                // The only usable, and guaranteed to work, "serializing instruction"+                // appears to be `cpuid`, but it doesn't seem easy to use, especially+                // due to the overlap in registers with `rdpmc` itself, and it might+                // have too high of a cost, compared to serialization benefits (if any).+                asm!("rdpmc", in("ecx") reg_idx, out("eax") lo, out("edx") hi, options(nostack));+            } else {+                asm!(+                    // Dummy `cpuid(0)` to serialize instruction execution.+                    "xor eax, eax",+                    "cpuid",++                    "mov ecx, {rdpmc_ecx:e}",+                    "rdpmc",+                    rdpmc_ecx = in(reg) reg_idx,+                    out("eax") lo,+                    out("edx") hi,++                    // `cpuid` clobbers (not overwritten by `rdpmc`).+                    out("ebx") _,+                    out("ecx") _,++                    options(nostack),+                );+            }+        }+        lo as u64 | (hi as u64) << 32+    }++    /// Read two hardware performance counters at once (see `rdpmc`).+    ///+    /// Should be more efficient/accurate than two `rdpmc` calls, as it+    /// only requires one "serializing instruction", rather than two.+    #[inline(always)]+    fn rdpmc_pair(a_reg_idx: u32, b_reg_idx: u32) -> (u64, u64) {+        let (a_lo, a_hi): (u32, u32);+        let (b_lo, b_hi): (u32, u32);+        unsafe {+            asm!(+                // Dummy `cpuid(0)` to serialize instruction execution.+                "xor eax, eax",+                "cpuid",++                "mov ecx, {a_rdpmc_ecx:e}",+                "rdpmc",+                "mov {a_rdpmc_eax:e}, eax",+                "mov {a_rdpmc_edx:e}, edx",+                "mov ecx, {b_rdpmc_ecx:e}",+                "rdpmc",+                a_rdpmc_ecx = in(reg) a_reg_idx,+                a_rdpmc_eax = out(reg) a_lo,+                a_rdpmc_edx = out(reg) a_hi,+                b_rdpmc_ecx = in(reg) b_reg_idx,+                out("eax") b_lo,+                out("edx") b_hi,++                // `cpuid` clobbers (not overwritten by `rdpmc`).+                out("ebx") _,+                out("ecx") _,++                options(nostack),+            );+        }+        (+            a_lo as u64 | (a_hi as u64) << 32,+            b_lo as u64 | (b_hi as u64) << 32,+        )+    }++    /// Categorization of `x86_64` CPUs, primarily based on how they+    /// support for counting "hardware interrupts" (documented or not).+    pub(super) enum CpuModel {+        Amd(AmdGen),+        Intel(IntelGen),+    }++    pub(super) enum AmdGen {+        /// K8 (Hammer) to Jaguar / Puma.+        PreZen,++        /// Zen / Zen+ / Zen 2.+        Zen,++        /// Unknown AMD CPU, contemporary to/succeeding Zen/Zen+/Zen 2,+        /// but likely similar to them.+        UnknownMaybeZenLike,+    }++    pub(super) enum IntelGen {+        /// Intel CPU predating Sandy Bridge. These are the only CPUs we+        /// can't support (more) accurate instruction counting on, as they+        /// don't (appear to) have any way to count "hardware interrupts".+        PreBridge,++        /// Sandy Bridge / Ivy Bridge:+        /// * client: Sandy Bridge (M/H) / Ivy Bridge (M/H/Gladden)+        /// * server: Sandy Bridge (E/EN/EP) / Ivy Bridge (E/EN/EP/EX)+        ///+        /// Intel doesn't document support for counting "hardware interrupts"+        /// prior to Skylake, but testing found that `HW_INTERRUPTS.RECEIVED`+        /// from Skylake has existed, with the same config, as far back as+        /// "Sandy Bridge" (but before that it mapped to a different event).+        ///+        /// These are the (pre-Skylake) *Bridge CPU models confirmed so far:+        /// * Sandy Bridge (client) Family 6 Model 42+        ///     Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz (@alyssais)+        /// * Ivy Bridge (client) Family 6 Model 58+        ///     Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz (@eddyb)+        ///+        /// We later found this paper, which on page 5 lists 12 counters,+        /// for each of Nehalem/Westmere, Sandy Bridge and Ivy Bridge:+        /// http://web.eece.maine.edu/~vweaver/projects/deterministic/deterministic_counters.pdf+        /// It appears that both Sandy Bridge and Ivy Bridge used to have+        /// `HW_INTERRUPTS.RECEIVED` documented, before Intel removed every+        /// mention of the counter from newer versions of their manuals.+        Bridge,++        /// Haswell / Broadwell:+        /// * client: Haswell (S/ULT/GT3e) / Broadwell (U/Y/S/H/C/W)+        /// * server: Haswell (E/EP/EX) / Broadwell (E/EP/EX/DE/Hewitt Lake)+        ///+        /// Equally as undocumented as "Sandy Bridge / Ivy Bridge" (see above).+        ///+        /// These are the (pre-Skylake) *Well CPU models confirmed so far:+        /// * Haswell (client) Family 6 Model 60+        ///     Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz (@m-ou-se)+        /// * Haswell (server) Family 6 Model 63+        ///     Intel(R) Xeon(R) CPU E5-2697 v3 @ 2.60GHz (@cuviper)+        /// * Haswell (client + GT3e) Family 6 Model 70+        ///     Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz (@nagisa)+        ///     Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz (@m-ou-se)+        Well,++        /// Skylake / Skylake-derived:+        /// * client: Skylake (Y/U/DT/H/S) / Kaby Lake (Y/U/DT/H/S/X) / Coffee Lake (U/S/H/E)+        /// * server: Skylake (SP/X/DE/W) / Cascade Lake (SP/X/W)+        ///+        /// Both "client" and "server" product lines have documented support+        /// for counting "hardware interrupts" (`HW_INTERRUPTS.RECEIVED`).+        ///+        /// Intel does not make it clear that future product lines, such as+        /// "Ice Lake", will continue to support this (or with what config),+        /// and even "Comet Lake" (aka "10th gen") isn't explicitly listed.+        Lake,++        /// Unknown Intel CPU, contemporary to/succeeding *Bridge/*Well/*Lake,+        /// but likely similar to them.+        UnknownMaybeLakeLike,+    }++    impl CpuModel {+        /// Detect the model of the current CPU using `cpuid`.+        pub(super) fn detect() -> Result<Self, Box<dyn Error + Send + Sync>> {+            let cpuid0 = unsafe { std::arch::x86_64::__cpuid(0) };+            let cpuid1 = unsafe { std::arch::x86_64::__cpuid(1) };+            let mut vendor = [0; 12];+            vendor[0..4].copy_from_slice(&cpuid0.ebx.to_le_bytes());+            vendor[4..8].copy_from_slice(&cpuid0.edx.to_le_bytes());+            vendor[8..12].copy_from_slice(&cpuid0.ecx.to_le_bytes());++            let vendor = std::str::from_utf8(&vendor).map_err(|_| {+                format!(+                    "cpuid returned non-UTF-8 vendor name: cpuid(0)={:?} cpuid(1)={:?}",+                    cpuid0, cpuid1+                )+            })?;++            let version = cpuid1.eax;++            let mut family = (version >> 8) & 0xf;+            if family == 15 {+                // Extended family.+                family += (version >> 20) & 0xff;+            }++            let mut model = (version >> 4) & 0xf;+            if family >= 15 || vendor == "GenuineIntel" && family == 6 {+                // Extended model.+                model += ((version >> 16) & 0xf) << 4;+            }++            info!(+                "CpuModel::detect: vendor={:?} family={} model={}",+                vendor, family, model+            );++            match vendor {+                "AuthenticAMD" => {+                    use self::AmdGen::*;++                    let (gen, name) = match (family, model) {+                        (0..=14, _) | (19, _) => {+                            return Err(format!(+                                "impossible AMD64 CPU detected (Family {} Model {}); {}",+                                family,+                                model,+                                super::BUG_REPORT_MSG+                            )+                            .into());+                        }++                        (15, _) => (PreZen, "K8 (Hammer)"),+                        (16, _) => (PreZen, "K10 (Barcelona/Shanghai/Istanbul)"),+                        (17, _) => (PreZen, "K8+K10 hybrid (Turion X2 Ultra)"),+                        (18, _) => (PreZen, "Fusion"),+                        (20, _) => (PreZen, "Bobcat"),+                        (21, _) => (PreZen, "Bulldozer / Piledriver / Steamroller / Excavator"),+                        (22, _) => (PreZen, "Jaguar / Puma"),++                        (23, 1) => (Zen, "Zen (Naples/Whitehaven/Summit Ridge/Snowy Owl)"),+                        (23, 17) => (Zen, "Zen (Raven Ridge)"),+                        (23, 24) => (Zen, "Zen (Banded Kestrel/Dali) / Zen+ (Picasso)"),+                        (23, 8) => (Zen, "Zen+ (Pinnacle Ridge)"),+                        (23, 49) => (Zen, "Zen 2 (Rome/Castle Peak)"),+                        (23, 113) => (Zen, "Zen 2 (Matisse)"),++                        (23..=0xffff_ffff, _) => {+                            really_warn!(+                                "CpuModel::detect: unknown AMD CPU (Family {} Model {}), \+                                 assuming Zen-like; {}",+                                family,+                                model,+                                super::BUG_REPORT_MSG+                            );++                            (UnknownMaybeZenLike, "")+                        }+                    };++                    if !name.is_empty() {+                        info!("CpuModel::detect: known AMD CPU: {}", name);+                    }++                    // The `SpecLockMap` (speculative atomic aka `lock` instruction+                    // execution, unclear what "Map" refers to) feature in AMD Zen CPUs+                    // causes non-deterministic overcounting of atomic instructions,+                    // presumably whenever it has to roll back the speculation+                    // (as in, the performance counters aren't rolled back).+                    // Even this this may be rare when uncontended, it adds up.+                    //+                    // There is an MSR bit (`MSRC001_1020[54]`) that's not officially+                    // documented, but which several motherboards and profiling tools+                    // set whenever IBS (Instruction-Based Sampling) is in use, and+                    // it is sometimes referred to as "disabling `SpecLockMap`"+                    // (hence having a name for the feature that speculates `lock`s).+                    //+                    // One way we could detect that the bit has been set would be to+                    // parse `uname().release` (aka `uname -r`) and look for versions+                    // which are known to include the patch suggested in this thread:+                    // https://github.com/mozilla/rr/issues/2034#issuecomment-693761247+                    //+                    // However, one may set the bit using e.g. `wrmsr`, even on older+                    // kernels, so a more reliable approach is to execute some atomics+                    // and look at the `SpecLockMapCommit` (`r0825:u`) Zen counter,+                    // which only reliably remains `0` when `SpecLockMap` is disabled.+                    if matches!(gen, Zen | UnknownMaybeZenLike) {+                        if let Ok(spec_lock_map_commit) =+                            Counter::with_type_and_hw_id(perf_type_id_PERF_TYPE_RAW, 0x08_25)+                        {+                            use super::HwCounterRead;++                            let start_spec_lock_map_commit = spec_lock_map_commit.read();++                            // Execute an atomic (`lock`) instruction, which should+                            // start speculative execution for following instructions+                            // (as long as `SpecLockMap` isn't disabled).+                            let mut atomic: u64 = 0;+                            let mut _tmp: u64 = 0;+                            unsafe {+                                asm!(+                                    "lock xadd qword ptr [{atomic}], {tmp}",++                                    atomic = in(reg) &mut atomic,+                                    tmp = inout(reg) _tmp,+                                );+                            }++                            if spec_lock_map_commit.read() != start_spec_lock_map_commit {+                                really_warn!(+                                    "CpuModel::detect: SpecLockMap detected, in AMD {} CPU; \+                                     this may add some non-deterministic noise - \+                                     for information on disabling SpecLockMap, see \+                                     https://github.com/mozilla/rr/wiki/Zen",+                                    name+                                );+                            }+                        }+                    }++                    Ok(CpuModel::Amd(gen))+                }++                "GenuineIntel" => {+                    use self::IntelGen::*;++                    let (gen, name) = match (family, model) {+                        // No need to name these, they're unsupported anyway.+                        (0..=5, _) => (PreBridge, ""),+                        (15, _) => (PreBridge, "Netburst"),+                        (6, 0..=41) => (PreBridge, ""),++                        // Older Xeon Phi CPUs, misplaced in Family 6.+                        (6, 87) => (PreBridge, "Knights Landing"),+                        (6, 133) => (PreBridge, "Knights Mill"),++                        // Older Atom CPUs, interleaved with other CPUs.+                        // FIXME(eddyb) figure out if these are like *Bridge/*Well.+                        (6, 53) | (6, 54) => (PreBridge, "Saltwell"),+                        (6, 55) | (6, 74) | (6, 77) | (6, 90) | (6, 93) => {+                            (PreBridge, "Silvermont")+                        }+                        (6, 76) => (PreBridge, "Airmont (Cherry Trail/Braswell)"),++                        // Older server CPUs, numbered out of order.+                        (6, 44) => (PreBridge, "Westmere (Gulftown/EP)"),+                        (6, 46) => (PreBridge, "Nehalem (EX)"),+                        (6, 47) => (PreBridge, "Westmere (EX)"),++                        (6, 42) => (Bridge, "Sandy Bridge (M/H)"),+                        (6, 45) => (Bridge, "Sandy Bridge (E/EN/EP)"),+                        (6, 58) => (Bridge, "Ivy Bridge (M/H/Gladden)"),+                        (6, 62) => (Bridge, "Ivy Bridge (E/EN/EP/EX)"),++                        (6, 60) => (Well, "Haswell (S)"),+                        (6, 61) => (Well, "Broadwell (U/Y/S)"),+                        (6, 63) => (Well, "Haswell (E/EP/EX)"),+                        (6, 69) => (Well, "Haswell (ULT)"),+                        (6, 70) => (Well, "Haswell (GT3e)"),+                        (6, 71) => (Well, "Broadwell (H/C/W)"),+                        (6, 79) => (Well, "Broadwell (E/EP/EX)"),+                        (6, 86) => (Well, "Broadwell (DE/Hewitt Lake)"),++                        (6, 78) => (Lake, "Skylake (Y/U)"),+                        (6, 85) => (Lake, "Skylake (SP/X/DE/W) / Cascade Lake (SP/X/W)"),+                        (6, 94) => (Lake, "Skylake (DT/H/S)"),+                        (6, 142) => (Lake, "Kaby Lake (Y/U) / Coffee Lake (U)"),+                        (6, 158) => (Lake, "Kaby Lake (DT/H/S/X) / Coffee Lake (S/H/E)"),++                        (6..=14, _) | (16..=0xffff_ffff, _) => {+                            really_warn!(+                                "CpuModel::detect: unknown Intel CPU (Family {} Model {}), \+                                 assuming Skylake-like; {}",+                                family,+                                model,+                                super::BUG_REPORT_MSG+                            );++                            (UnknownMaybeLakeLike, "")+                        }+                    };++                    if !name.is_empty() {+                        info!("CpuModel::detect: known Intel CPU: {}", name);+                    }++                    Ok(CpuModel::Intel(gen))+                }++                _ => Err(format!(+                    "cpuid returned unknown CPU vendor {:?}; version={:#x}",+                    vendor, version+                )+                .into()),+            }+        }++        /// Return the hardware performance counter configuration for+        /// counting "hardware interrupts" (documented or not).+        fn irqs_counter_config(&self) -> Result<u32, Box<dyn Error + Send + Sync>> {+            match self {+                CpuModel::Amd(model) => match model {+                    AmdGen::PreZen => Ok(0x00_cf),+                    AmdGen::Zen | AmdGen::UnknownMaybeZenLike => Ok(0x00_2c),+                },+                CpuModel::Intel(model) => match model {+                    IntelGen::PreBridge => Err(format!(+                        "counting IRQs not yet supported on Intel CPUs \+                         predating Sandy Bridge; {}",+                        super::BUG_REPORT_MSG+                    )+                    .into()),+                    IntelGen::Bridge+                    | IntelGen::Well+                    | IntelGen::Lake+                    | IntelGen::UnknownMaybeLakeLike => Ok(0x01_cb),+                },+            }+        }+    }+}++#[cfg(not(all(feature = "nightly", target_arch = "x86_64", target_os = "linux")))]

Note to me: We should enable the nightly feature flag on our nightly toolchain CI build.

eddyb

comment created time in a day

Pull request review commentrust-lang/measureme

[WIP] summarize: add "aggregate" sub-command for analyzing sets of profiles.

+use std::error::Error;+use std::time::Instant;++// HACK(eddyb) this is semantically `warn!` but uses `error!` because+// that's the only log level enabled by default - see also+// https://github.com/rust-lang/rust/issues/76824+macro_rules! really_warn {+    ($msg:literal $($rest:tt)*) => {+        error!(concat!("[WARNING] ", $msg) $($rest)*)+    }+}++pub enum Counter {+    WallTime(WallTime),+    Instructions(Instructions),+    InstructionsMinusIrqs(InstructionsMinusIrqs),+    InstructionsMinusRaw0420(InstructionsMinusRaw0420),+}++impl Counter {+    pub fn by_name(name: &str) -> Result<Self, Box<dyn Error + Send + Sync>> {+        Ok(match name {+            WallTime::NAME => Counter::WallTime(WallTime::new()),+            Instructions::NAME => Counter::Instructions(Instructions::new()?),+            InstructionsMinusIrqs::NAME => {+                Counter::InstructionsMinusIrqs(InstructionsMinusIrqs::new()?)+            }+            InstructionsMinusRaw0420::NAME => {+                Counter::InstructionsMinusRaw0420(InstructionsMinusRaw0420::new()?)+            }+            _ => return Err(format!("{:?} is not a valid counter name", name).into()),+        })+    }++    pub(super) fn describe_as_json(&self) -> String {+        let (name, units) = match self {+            Counter::WallTime(_) => (+                WallTime::NAME,+                r#"[["ns", 1], ["μs", 1000], ["ms", 1000000], ["s", 1000000000]]"#,+            ),+            Counter::Instructions(_) => (Instructions::NAME, r#"[["instructions", 1]]"#),+            Counter::InstructionsMinusIrqs(_) => {+                (InstructionsMinusIrqs::NAME, r#"[["instructions", 1]]"#)+            }+            Counter::InstructionsMinusRaw0420(_) => {+                (InstructionsMinusRaw0420::NAME, r#"[["instructions", 1]]"#)+            }+        };+        format!(r#"{{ "name": "{}", "units": {} }}"#, name, units)+    }++    #[inline]+    pub(super) fn since_start(&self) -> u64 {+        match self {+            Counter::WallTime(counter) => counter.since_start(),+            Counter::Instructions(counter) => counter.since_start(),+            Counter::InstructionsMinusIrqs(counter) => counter.since_start(),+            Counter::InstructionsMinusRaw0420(counter) => counter.since_start(),+        }+    }+}++pub struct WallTime {+    start: Instant,+}++impl WallTime {+    const NAME: &'static str = "wall-time";++    pub fn new() -> Self {+        WallTime {+            start: Instant::now(),+        }+    }++    #[inline]+    fn since_start(&self) -> u64 {+        self.start.elapsed().as_nanos() as u64+    }+}++pub struct Instructions {+    instructions: hw::Counter,+    start: u64,+}++impl Instructions {+    const NAME: &'static str = "instructions:u";++    pub fn new() -> Result<Self, Box<dyn Error + Send + Sync>> {+        let model = hw::CpuModel::detect()?;+        let instructions = hw::Counter::new(&model, HwCounterType::Instructions)?;+        let start = instructions.read();+        Ok(Instructions {+            instructions,+            start,+        })+    }++    #[inline]+    fn since_start(&self) -> u64 {+        self.instructions.read().wrapping_sub(self.start)+    }+}++pub struct InstructionsMinusIrqs {+    instructions: hw::Counter,+    irqs: hw::Counter,+    start: u64,+}++impl InstructionsMinusIrqs {+    const NAME: &'static str = "instructions-minus-irqs:u";++    pub fn new() -> Result<Self, Box<dyn Error + Send + Sync>> {+        let model = hw::CpuModel::detect()?;+        let instructions = hw::Counter::new(&model, HwCounterType::Instructions)?;+        let irqs = hw::Counter::new(&model, HwCounterType::Irqs)?;+        let (start_instructions, start_irqs) = (&instructions, &irqs).read();+        let start = start_instructions.wrapping_sub(start_irqs);+        Ok(InstructionsMinusIrqs {+            instructions,+            irqs,+            start,+        })+    }++    #[inline]+    fn since_start(&self) -> u64 {+        let (instructions, irqs) = (&self.instructions, &self.irqs).read();+        instructions.wrapping_sub(irqs).wrapping_sub(self.start)+    }+}++// HACK(eddyb) this is a variant of `instructions-minus-irqs:u`, where `r0420`+// is subtracted, instead of the usual "hardware interrupts" (aka IRQs).+// `r0420` is an undocumented counter on AMD Zen CPUs which appears to count+// both hardware interrupts and exceptions (such as page faults), though+// it's unclear yet what exactly it's counting (could even be `iret`s).+pub struct InstructionsMinusRaw0420(InstructionsMinusIrqs);++impl InstructionsMinusRaw0420 {+    const NAME: &'static str = "instructions-minus-r0420:u";++    pub fn new() -> Result<Self, Box<dyn Error + Send + Sync>> {+        let model = hw::CpuModel::detect()?;+        let instructions = hw::Counter::new(&model, HwCounterType::Instructions)?;+        let irqs = hw::Counter::new(&model, HwCounterType::Raw0420)?;+        let (start_instructions, start_irqs) = (&instructions, &irqs).read();+        let start = start_instructions.wrapping_sub(start_irqs);+        Ok(InstructionsMinusRaw0420(InstructionsMinusIrqs {+            instructions,+            irqs,+            start,+        }))+    }++    #[inline]+    fn since_start(&self) -> u64 {+        self.0.since_start()+    }+}++trait HwCounterRead {+    type Output;+    fn read(&self) -> Self::Output;+}++enum HwCounterType {+    Instructions,+    Irqs,+    Raw0420,+}++const BUG_REPORT_MSG: &str =+    "please report this to https://github.com/rust-lang/measureme/issues/new";++/// Linux x86_64 implementation based on `perf_event_open` and `rdpmc`.+#[cfg(all(feature = "nightly", target_arch = "x86_64", target_os = "linux"))]+mod hw {+    use memmap::{Mmap, MmapOptions};+    use perf_event_open_sys::{bindings::*, perf_event_open};+    use std::convert::TryInto;+    use std::error::Error;+    use std::fs;+    use std::mem;+    use std::os::unix::io::FromRawFd;++    pub(super) struct Counter {+        mmap: Mmap,+        reg_idx: u32,+    }++    impl Counter {+        pub(super) fn new(+            model: &CpuModel,+            counter_type: super::HwCounterType,+        ) -> Result<Self, Box<dyn Error + Send + Sync>> {+            let (type_, hw_id) = match counter_type {+                super::HwCounterType::Instructions => (+                    perf_type_id_PERF_TYPE_HARDWARE,+                    perf_hw_id_PERF_COUNT_HW_INSTRUCTIONS,+                ),+                super::HwCounterType::Irqs => {+                    (perf_type_id_PERF_TYPE_RAW, model.irqs_counter_config()?)+                }+                super::HwCounterType::Raw0420 => {+                    match model {+                        CpuModel::Amd(AmdGen::Zen) => {}++                        _ => really_warn!(+                            "Counter::new: the undocumented `r0420` performance \+                             counter has only been observed on AMD Zen CPUs"+                        ),+                    }++                    (perf_type_id_PERF_TYPE_RAW, 0x04_20)+                }+            };+            Self::with_type_and_hw_id(type_, hw_id)+        }++        fn with_type_and_hw_id(+            type_: perf_type_id,+            hw_id: u32,+        ) -> Result<Self, Box<dyn Error + Send + Sync>> {+            let mut attrs = perf_event_attr {+                size: mem::size_of::<perf_event_attr>().try_into().unwrap(),+                type_,+                config: hw_id.into(),+                ..perf_event_attr::default()+            };++            // Only record same-thread, any CPUs, and only userspace (no kernel/hypervisor).+            // NOTE(eddyb) `pid = 0`, despite talking about "process id", means+            // "calling process/thread", *not* "any thread in the calling process"+            // (i.e. "process" is interchangeable with "main thread of the process")+            // FIXME(eddyb) introduce per-thread counters and/or use `inherit`+            // (and `inherit_stat`? though they might not be appropriate here)+            // to be able to read the counter on more than just the initial thread.+            let pid = 0;+            let cpu = -1;+            let group_fd = -1;+            attrs.set_exclude_kernel(1);+            attrs.set_exclude_hv(1);++            let file = unsafe {+                let fd =+                    perf_event_open(&mut attrs, pid, cpu, group_fd, PERF_FLAG_FD_CLOEXEC.into());+                if fd < 0 {+                    Err(std::io::Error::from_raw_os_error(-fd))+                } else {+                    Ok(fs::File::from_raw_fd(fd))+                }+            };+            let file = file.map_err(|e| format!("perf_event_open failed: {:?}", e))?;++            let mmap = unsafe {+                MmapOptions::new()+                    .len(mem::size_of::<perf_event_mmap_page>())+                    .map(&file)+            };+            let mmap = mmap.map_err(|e| format!("perf_event_mmap_page: mmap failed: {:?}", e))?;++            let mut counter = Counter { mmap, reg_idx: 0 };++            let (version, compat_version, caps, index, pmc_width) = counter+                .access_mmap_page_with_seqlock(|mp| {+                    (+                        mp.version,+                        mp.compat_version,+                        unsafe { mp.__bindgen_anon_1.__bindgen_anon_1 },+                        mp.index,+                        mp.pmc_width,+                    )+                });++            info!(+                "Counter::new: version={} compat_version={} index={:#x}",+                version, compat_version, index,+            );++            if caps.cap_user_rdpmc() == 0 {+                return Err(format!(+                    "perf_event_mmap_page: missing cap_user_rdpmc{}",+                    if caps.cap_bit0_is_deprecated() == 0 && caps.cap_bit0() == 1 {+                        " (ignoring legacy/broken rdpmc support)"+                    } else {+                        ""+                    }+                )+                .into());+            }++            if index == 0 {+                return Err(format!(+                    "perf_event_mmap_page: no allocated hardware register (ran out?)"+                )+                .into());+            }+            counter.reg_idx = index - 1;++            if (cfg!(not(accurate_seqlock_rdpmc)) || true) && pmc_width != 48 {

Is this right?

(cfg!(not(accurate_seqlock_rdpmc)) || true)

Isn't that just true?

eddyb

comment created time in a day

Pull request review commentrust-lang/measureme

[WIP] summarize: add "aggregate" sub-command for analyzing sets of profiles.

+use std::error::Error;+use std::time::Instant;++// HACK(eddyb) this is semantically `warn!` but uses `error!` because+// that's the only log level enabled by default - see also+// https://github.com/rust-lang/rust/issues/76824+macro_rules! really_warn {+    ($msg:literal $($rest:tt)*) => {+        error!(concat!("[WARNING] ", $msg) $($rest)*)+    }+}++pub enum Counter {+    WallTime(WallTime),+    Instructions(Instructions),+    InstructionsMinusIrqs(InstructionsMinusIrqs),+    InstructionsMinusRaw0420(InstructionsMinusRaw0420),

It would be good to have some doc comments about what these are. WallTime and Instructions are fairly self-evident but the other two are less so.

eddyb

comment created time in a day

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

Upgrade to measureme 9.0.0

@Mark-Simulacrum Thanks for getting the perf.rlo side of this working so we could land it!

wesleywiser

comment created time in 2 days

pull request commentrust-lang/rust

Upgrade to measureme 9.0.0

@bors r=Mark-Simulacrum

wesleywiser

comment created time in 2 days

push eventwesleywiser/rust

follower

commit sha a7bd6c449aef07dc8daa889f4ddbdda326593e32

Link to "Contributing to Rust" rather than "Getting Started". Change to link to "Contributing to Rust" chapter of `rustc` Dev Guide, primarily on the basis that the GitHub "first contribution" Issue "pop-up" says "Be sure to review the [contributing guidelines] and [code of conduct]" and links to this file. When/if the guide/"Getting Started" section gets revised to not be `rustc`-specific the linked section can be changed. In the meantime this prevents leading first time contributors into a confusing cul de sac.

view details

David Wood

commit sha 57e8fc56852e7728d7160242bf13c3ab6e066bd8

passes: `check_attr` on more targets This commit modifies `check_attr` so that: - Enum variants are now checked (some attributes would not have been prohibited on variants previously). - `check_expr_attributes` and `check_stmt_attributes` are removed as `check_attributes` can perform the same checks. Signed-off-by: David Wood <david@davidtw.co>

view details

Mara Bos

commit sha 81edbbc2bfacd29558a5020990d49fc07ed80ac7

Implement TryFrom between NonZero types.

view details

Dylan MacKenzie

commit sha 77e6c56ab6f108fdbb8acbd176497be9f074af9a

Unify `&mut` and `&raw mut` const-checking errors

view details

Dylan MacKenzie

commit sha c1494d60dbad39c218e7b0825bfe590cc22bf2fa

Bless tests

view details

Francesca Lovebloom

commit sha 16e10bf81ee73f61cf813acef3d5dbbce4f66da2

Revert "Allow dynamic linking for iOS/tvOS targets." This reverts commit 56e115a2627ba8bdd2e66c759457af96b2b0286a.

view details

Mara Bos

commit sha 64839ee00ab4076d797901ddea55f2613c5b75b5

Add Pin::new_static.

view details

Mara Bos

commit sha 390883e888c580d054ab4a2584c851aba50865e9

Make Pin::new_static const.

view details

Stefan Lankes

commit sha 16d65d04322de4a00327dfe26b4af6bd3e4187c8

revise Hermit's mutex interface to support the behaviour of StaticMutex rust-lang/rust#77147 simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. To support the behavior of StaticMutex, we move part of the mutex implementation into libstd.

view details

Stefan Lankes

commit sha 98fcc3fbc7b2f3420d393b8916746002d501401c

using the latest version of libhermit-rs

view details

Stefan Lankes

commit sha d560b50d87c05ea5a8e6186c05a50ecd828eaaae

revise code to pass the format check

view details

Stefan Lankes

commit sha 986c1fc053828a051c9fd888cbf49393f276f4f5

revise comments and descriptions of the helper functions

view details

Stefan Lankes

commit sha d6e955f3bfd0a47240879549dc2fb3284dfe08e4

fix typos in new method

view details

Stefan Lankes

commit sha 530f5754664699dee29bde6cfa99aaf861499544

revise code to pass the format check

view details

Stefan Lankes

commit sha 8d8a290c691db7a8ee566edbd485a729eb41d4ba

add hermit to the list of omit OS

view details

Stefan Lankes

commit sha 33fd08b61f57cde81bf01964b2fc4d2dca0e4d3f

remove obsolete function diverge

view details

Stefan Lankes

commit sha 30c3dadb4da44c950f79e9772b36bbaf2660bb0e

reuse implementation of the system provider "unsupported"

view details

Stefan Lankes

commit sha 1741e5b8f581960a6e9cb9f0b8261b5f0c26e92d

define required type 'MovableMutex'

view details

Julian Wollersberger

commit sha 39b0e7928579c4ce3a42e849695f9380b7869d62

Remove generic argument from `QueryConfig`.

view details

Mara Bos

commit sha 104c0f0194177442ff16cf14907a96d2f8d200dd

Rename Pin::new_static to Pin::static_ref.

view details

push time in 2 days

Pull request review commentrust-lang/rust

Remove unused set-discriminant statements and assignments regardless of rvalue

 impl<'tcx> MirPass<'tcx> for SimplifyLocals { /// Construct the mapping while swapping out unused stuff out from the `vec`. fn make_local_map<V>(     local_decls: &mut IndexVec<Local, V>,-    used_locals: IndexVec<Local, u32>,-    arg_count: usize,+    used_locals: &UsedLocals, ) -> IndexVec<Local, Option<Local>> {     let mut map: IndexVec<Local, Option<Local>> = IndexVec::from_elem(None, &*local_decls);     let mut used = Local::new(0);-    for (alive_index, count) in used_locals.iter_enumerated() {-        // The `RETURN_PLACE` and arguments are always live.-        if alive_index.as_usize() > arg_count && *count == 0 {++    for alive_index in local_decls.indices() {+        // The `RETURN_PLACE` and arguments are always used.

Nit: Maybe update this comment to something like "is_used treats RETURN_PLACE and arguments as always used"?

tmiasko

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

MIR validation should check `SwitchInt` values are valid for the type

@bors r=oli-obk

wesleywiser

comment created time in 2 days

push eventwesleywiser/rust

Mark Rousskov

commit sha 05c9c0ee5dcd935f518db151bee2dc88380fb92f

Modify executable checking to be more universal This uses a dummy file to check if the filesystem being used supports the executable bit in general.

view details

dylni

commit sha 1ff7da6551a7cdf6ace2a9d00e92bbab550334ee

Move `slice::check_range` to `RangeBounds`

view details

dylni

commit sha 1095dcab96d524e700b11edf366d45a0fd173fa0

Fix links

view details

dylni

commit sha eb63168e007058dad4af758faf1dca449c049777

Fix doctests

view details

dylni

commit sha f055b0bb0847ecf08fe452a270faae8324b55b05

Rename method to `assert_len`

view details

Bastian Kauschke

commit sha fd22e87afc9082522bc7b52e32d25d43c64594e6

fix flag computation for `ExistentialPredicate::Projection`

view details

Bastian Kauschke

commit sha 7652b4b1d9cec0ad22f529a4335d05f7d7792521

guard against `skip_binder` errors during FlagComputation

view details

follower

commit sha a7bd6c449aef07dc8daa889f4ddbdda326593e32

Link to "Contributing to Rust" rather than "Getting Started". Change to link to "Contributing to Rust" chapter of `rustc` Dev Guide, primarily on the basis that the GitHub "first contribution" Issue "pop-up" says "Be sure to review the [contributing guidelines] and [code of conduct]" and links to this file. When/if the guide/"Getting Started" section gets revised to not be `rustc`-specific the linked section can be changed. In the meantime this prevents leading first time contributors into a confusing cul de sac.

view details

Camelid

commit sha 549f861f7d53811521cf929cf58fb6828a2a88d9

Use correct article in help message for conversion or cast Before it always used `an`; now it uses the correct article for the type.

view details

David Wood

commit sha 57e8fc56852e7728d7160242bf13c3ab6e066bd8

passes: `check_attr` on more targets This commit modifies `check_attr` so that: - Enum variants are now checked (some attributes would not have been prohibited on variants previously). - `check_expr_attributes` and `check_stmt_attributes` are removed as `check_attributes` can perform the same checks. Signed-off-by: David Wood <david@davidtw.co>

view details

Mara Bos

commit sha 81edbbc2bfacd29558a5020990d49fc07ed80ac7

Implement TryFrom between NonZero types.

view details

Camelid

commit sha 094f14c554c3a1f103a5d6778d4b4e131c297f11

Add article after "to" Also added missing backtick in "you can cast" message.

view details

Camelid

commit sha 8a6831a7fd3fc624643b50f494212e0ceaad3c28

Say "doesn't" instead of "wouldn't" in convert message

view details

Dylan MacKenzie

commit sha 77e6c56ab6f108fdbb8acbd176497be9f074af9a

Unify `&mut` and `&raw mut` const-checking errors

view details

Dylan MacKenzie

commit sha c1494d60dbad39c218e7b0825bfe590cc22bf2fa

Bless tests

view details

Bastian Kauschke

commit sha 9c302f55bd07a04305dfa2bd815d2559deb8468f

normalize in codegen_fulfill_obligations

view details

Bastian Kauschke

commit sha f0487cee7439f3a4b4c7daec0e7f2a0ccc21053c

normalize substs during inlining

view details

Bastian Kauschke

commit sha 32739a2ff1b7b6e5c1b475341b01f4a499830a84

add regression test

view details

Bastian Kauschke

commit sha ac893b8a02788eec6f6fad0cc89de0177b0c0a50

add test for should_inline incorrect param_env

view details

Francesca Lovebloom

commit sha 16e10bf81ee73f61cf813acef3d5dbbce4f66da2

Revert "Allow dynamic linking for iOS/tvOS targets." This reverts commit 56e115a2627ba8bdd2e66c759457af96b2b0286a.

view details

push time in 2 days

pull request commentrust-lang/rust

Make codegen coverage_context optional, and check

@bors r+ rollup

richkadel

comment created time in 3 days

issue commentrust-lang/rust

Our last ICE before we get coverage working

@richkadel Yep, totally fine!

gilescope

comment created time in 3 days

Pull request review commentrust-lang/rust

Make codegen coverage_context optional, and check

 use tracing::debug; /// undocumented details in Clang's implementation (that may or may not be important) were also /// replicated for Rust's Coverage Map. pub fn finalize<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {-    let function_coverage_map = cx.coverage_context().take_function_coverage_map();+    if cx.coverage_context().is_none() {+        return;+    }+    let function_coverage_map = cx.coverage_context().unwrap().take_function_coverage_map();

Nit: Something like this might be a little better style-wise.

    let function_coverage_map = match cx.coverage_context() {
        Some(ctx) => ctx.take_function_coverage_map(),
        None => return,
    };
richkadel

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

Upgrade to measureme 9.0.0

Looks like a network related failure. Maybe spurious?

Step 10/20 : RUN curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04-core-armhf.tar.gz |       tar xzf - -C rootfs/ubuntu &&       cd rootfs && mkdir proc sys dev etc etc/init.d
 ---> Running in 29c053275c54
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   280  100   280    0     0   1868      0 --:--:-- --:--:-- --:--:--  1866

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
The command '/bin/sh -c curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04-core-armhf.tar.gz |       tar xzf - -C rootfs/ubuntu &&       cd rootfs && mkdir proc sys dev etc etc/init.d' returned a non-zero code: 2

@bors retry

wesleywiser

comment created time in 3 days

pull request commentrust-lang/rust

Do not make local copies of inline fns in debug mode

Has there been a change that fixes that which has landed since we ran this yesterday? (Ie, why would rerunning bors work now?)

spastorino

comment created time in 3 days

push eventrust-lang/measureme

Mark Rousskov

commit sha c7ac3b8873e76a6808fa4d34b669856a842adc09

Decode paged buffers from memory

view details

Wesley Wiser

commit sha 2c45b109a98ff143be39bc0c14ae2153fa0ca8ca

Merge pull request #142 from Mark-Simulacrum/from-memory Decode paged buffers from memory

view details

push time in 3 days

PR merged rust-lang/measureme

Decode paged buffers from memory

Do we expect to keep the compatibility for deserializing 0.7 (i.e., older) profile data for some time with newer analyzeme as well? That would be great from perf.rlo's side but we can depend on an older version too if needed.

r? @wesleywiser

+12 -0

6 comments

1 changed file

Mark-Simulacrum

pr closed time in 3 days

PullRequestReviewEvent

pull request commentrust-lang/measureme

Decode paged buffers from memory

Ah ok got it. No, I don't think that will work even if we bypassed the version check because we changed how strings get stored which fixed a failed assertion if you tried to profile really large crates like rustc_middle.

Mark-Simulacrum

comment created time in 3 days

pull request commentrust-lang/measureme

Decode paged buffers from memory

Looks like it won't panic, but it will return an error since the file format versions don't match. Were you going to pipe 0.7 data into this function?

https://github.com/rust-lang/measureme/blob/28b1eea82d7ed583f21193446b141a3052e816ec/measureme/src/file_header.rs#L66-L76

Mark-Simulacrum

comment created time in 3 days

pull request commentrust-lang/measureme

Decode paged buffers from memory

Do we expect to keep the compatibility for deserializing 0.7 (i.e., older) profile data for some time with newer analyzeme as well? That would be great from perf.rlo's side but we can depend on an older version too if needed.

I don't think we have that compatibility currently since we've been bumping the CURRENT_FILE_FORMAT_VERSION number so I think analyzeme will panic if it tries to read old files.

Mark-Simulacrum

comment created time in 3 days

pull request commentrust-lang/rust

Do not make local copies of inline fns in debug mode

Failure doesn't look spurious:

failures:

---- [incremental] incremental/hygiene/load_cached_hygiene.rs stdout ----

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error in revision `rpass2`: compilation failed!
status: exit code: 1
command: "/checkout/obj/build/i686-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/hygiene/load_cached_hygiene.rs" "-Zthreads=1" "--target=i686-unknown-linux-gnu" "--cfg" "rpass2" "-C" "incremental=/checkout/obj/build/i686-unknown-linux-gnu/test/incremental/hygiene/load_cached_hygiene/load_cached_hygiene.inc" "-Z" "incremental-verify-ich" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/i686-unknown-linux-gnu/test/incremental/hygiene/load_cached_hygiene/a" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/i686-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-L" "/checkout/obj/build/i686-unknown-linux-gnu/test/incremental/hygiene/load_cached_hygiene/auxiliary"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: CGU-reuse for `load_cached_hygiene-call_changed_function` is `PostLto` but should be `No`
  --> /checkout/src/test/incremental/hygiene/load_cached_hygiene.rs:27:1
   |
LL | #![rustc_partition_codegened(module="load_cached_hygiene-call_changed_function", cfg="rpass2")]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error


------------------------------------------


---- [incremental] incremental/remapped_paths_cc/main.rs stdout ----

error in revision `rpass3`: compilation failed!
status: exit code: 1
command: "/checkout/obj/build/i686-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/remapped_paths_cc/main.rs" "-Zthreads=1" "--target=i686-unknown-linux-gnu" "--cfg" "rpass3" "-C" "incremental=/checkout/obj/build/i686-unknown-linux-gnu/test/incremental/remapped_paths_cc/main/main.inc" "-Z" "incremental-verify-ich" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/i686-unknown-linux-gnu/test/incremental/remapped_paths_cc/main/a" "-Crpath" "-Zunstable-options" "-Lnative=/checkout/obj/build/i686-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-g" "-L" "/checkout/obj/build/i686-unknown-linux-gnu/test/incremental/remapped_paths_cc/main/auxiliary"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: CGU-reuse for `main-some_mod` is `PostLto` but should be `No`
  --> /checkout/src/test/incremental/remapped_paths_cc/main.rs:14:1
   |
LL | #![rustc_partition_codegened(module="main-some_mod", cfg="rpass3")]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error


------------------------------------------



failures:
    [incremental] incremental/hygiene/load_cached_hygiene.rs
    [incremental] incremental/remapped_paths_cc/main.rs

test result: FAILED. 121 passed; 2 failed; 1 ignored; 0 measured; 0 filtered out

I'm not sure why only that i686 builder is failing off hand though.

spastorino

comment created time in 4 days

pull request commentrust-lang/rust

Upgrade to measureme 9.0.0

I've pushed the rebase and I'll start a try build just in case that has some effect.

@bors try

wesleywiser

comment created time in 5 days

push eventwesleywiser/rust

Mateusz Mikuła

commit sha 0ad3da06843089c0bf10d6caa3fbbc72fa67787a

Enable ASLR for windows-gnu

view details

Mark Rousskov

commit sha e023158145ece18176a2e93420600ccda0d0bc58

Permit uninhabited enums to cast into ints This essentially reverts part of #6204.

view details

Mark Rousskov

commit sha 990a39596cf3b33e550f2045f78a62970f8d78f8

Prevent ICE on uninhabited MIR interpretation

view details

Tim Nielens

commit sha 390a13b06c79d4177b829097b06453e38188081f

needless-lifetime - fix nested elision site FPs

view details

Tim Nielens

commit sha a60e5de90c7370d4fb3e6561d3cb55495cda2e2a

needless-lifetime / nested elision sites / PR remarks

view details

Tim Nielens

commit sha c8e9e52303da6dff4bc5cc4db3021d608fca6c70

needless-lifetime / add test cases for nested elision sites

view details

Takayuki Nakata

commit sha 1778a1ec4615a42a8ba9497006b07859186c08a1

Restrict `same_item_push` to suppress false positives It emits a lint when the pushed item is a literal, a constant and an immutable binding that are initialized with those.

view details

Takayuki Nakata

commit sha 0117ea2b016133145f9e02e27421ac3672b42f57

Refactoring: use inner function

view details

Takayuki Nakata

commit sha b80576fba633e1fc214c9f6900d7ca3424bda6d0

Some refactoring

view details

Takayuki Nakata

commit sha 14faebe20ea82392f393c3ff5efaab7250e51989

Add some tests to `same_item_push` Add tests in which the variable is initialized with a match expression and function call

view details

Takayuki Nakata

commit sha 2972ad3ef661071531a61ec8999b668a6b734b74

Refactoring: tests in `same_item_push`

view details

Takayuki Nakata

commit sha 730ca457f580247667ed0cd5965bc08752ebc0b3

Address `items_after_statement`

view details

Nathan West

commit sha a02014280586b53997622c501db00398376967a8

Refactor io/buffered.rs into submodules

view details

Nathan West

commit sha 96229f02402e82914ec6100b28ad2cbdd273a0d4

move buffered.rs to mod.rs

view details

Dylan MacKenzie

commit sha 72b402ed38f0c71461038aef8a49a02e49280788

Add pass names to some common dataflow analyses

view details

Nathan West

commit sha 6d75cdfc9ed9e6987bd23add6cf3954d2499dce2

Added updated compiler diagnostic

view details

Amjad Alsharafi

commit sha da700cba08a2b194d19e63d3c51ebadce96fe46b

Stabilize move_ref_pattern

view details

Amjad Alsharafi

commit sha afb9eeb1b9ea16ca65e38673a0ef3e7be81d7252

Disabled error `E0007` from rustc_error_codes

view details

Mark Rousskov

commit sha 05c9c0ee5dcd935f518db151bee2dc88380fb92f

Modify executable checking to be more universal This uses a dummy file to check if the filesystem being used supports the executable bit in general.

view details

Nathan West

commit sha c4280af8285c61b367a87c8f6eef9876011a8150

Retry fix error reporting suggestions

view details

push time in 5 days

pull request commentrust-lang/rust

Upgrade to measureme 9.0.0

So, if I try this locally with this branch, I get a ~72kb t-19629.json file next to the t-19629.mm_profdata file.

I did rebase this branch just to avoid rebuilding LLVM on my local checkout but I don't think that would change the behavior.

wesleywiser

comment created time in 5 days

PR opened rust-lang/compiler-team

Add wg-incr-comp to the checkin schedule

cc @pnkfelix @spastorino

Related to #299

+2 -1

0 comment

1 changed file

pr created time in 5 days

create barnchrust-lang/compiler-team

branch : wesleywiser-patch-1

created branch time in 5 days

pull request commentrust-lang/rust

Do not make local copies of inline fns in debug mode

A note to the perf triage team

We (the incremental compilation working group) would like to go ahead and land this PR even though there are some regressions. We believe the improvements out-weight the regressions because the improvements are to real world crates while most of the regressions are to synthetic benchmarks or a result of other issues with CGU partitioning not caused by this PR.

I've written a much more through analysis of the perf results here. Please take a look if you'd like more information!

spastorino

comment created time in 5 days

pull request commentrust-lang/rust

Do not make local copies of inline fns in debug mode

@bors r+

spastorino

comment created time in 5 days

Pull request review commentrust-lang/rust

Miri engine: entirely skip interning of ZST, and improve some comments

 impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx>> ValueVisitor<'mir             }         } -        // ZSTs do not need validation unless they're uninhabited-        if mplace.layout.is_zst() && !mplace.layout.abi.is_uninhabited() {+        // ZSTs cannot contain pointers, so we can skip them.+        if mplace.layout.is_zst() {

Thanks @RalfJung! I was about to make this change tonight.

RalfJung

comment created time in 5 days

PullRequestReviewEvent

push eventwesleywiser/rust

Wesley Wiser

commit sha 3adac0391b543b8563298242aeeba6ade8f72944

Add test case for #77062 Closes #77062

view details

push time in 6 days

push eventwesleywiser/rust

Jubilee Young

commit sha 4e973966b95e5157754f91216456a3c37a1472b2

Remove unnecessary mod-cfg

view details

bors

commit sha 8876ffc9235dade728e1fbc4be4c85415fdd0bcd

Auto merge of #77462 - jonas-schievink:rollup-m0rqdh5, r=jonas-schievink Rollup of 12 pull requests Successful merges: - #76101 (Update RELEASES.md for 1.47.0) - #76739 (resolve: prohibit anon const non-static lifetimes) - #76811 (Doc alias name restriction) - #77405 (Add tracking issue of iter_advance_by feature) - #77409 (Add example for iter chain struct) - #77415 (Better error message for `async` blocks in a const-context) - #77423 (Add `-Zprecise-enum-drop-elaboration`) - #77432 (Use posix_spawn on musl targets) - #77441 (Fix AVR stack corruption bug) - #77442 (Clean up on example doc fixes for ptr::copy) - #77444 (Fix span for incorrect pattern field and add label) - #77453 (Stop running macOS builds on Azure Pipelines) Failed merges: r? `@ghost`

view details

Jake Vossen

commit sha 3ea96b86ab8f2afec172bc7452876540388e4df9

made multiline macro calls into single line

view details

Long Louis Bui

commit sha 8b8c63f568bc838aa7997a6933a40c3ab7b91a5d

changed non_copy_const lints to warn by default

view details

bors

commit sha a1a7f20b4c5edff108a7c46e8641580bbf862362

Auto merge of #6098 - longlb:interior_mut_const, r=ebroto Downgrade interior_mutable_const lints to warn by default This change updates the two lints in the file non_copy_const.rs to be warn by default rather than deny by default. It also updates the known problems for declare_interior_mutable_const to mention some issues that are affected by the lints. This is a repeat pull request since I botched the first one (#6012). Apart from my messing up the commits of that one, I also had a problem where the stderr of the tests didn't change despite me changing both lints to warn by default. Is this normal behaviour for some lints or do I need to adjust the tests to accommodate the change? fixes #5863 changelog: none

view details

Camelid

commit sha 4c9bcf3b39faa07afb40a79b0d932a4accaeb82b

Fix test name Remove trailing `-`.

view details

Camelid

commit sha 87f3f81451f72fc7b5acb4a569bb79a51a8604c3

Improve rustdoc error for failed intra-doc link resolution The previous error was confusing since it made it sound like you can't link to items that are defined outside the current module. Also suggested importing the item.

view details

Camelid

commit sha 0193a8871cc2c2cca2de03243097519ce6c910ce

Remove unhelpful help message

view details

Dániel Buga

commit sha 998bd3b6b4d168099346e460ae42897dc3667882

Rename lint to invisible_characters

view details

Dániel Buga

commit sha 572e4c4837e5f955cdc3751b9ad63f0bfb86beac

Add WJ

view details

bors

commit sha 9408c68c1da55f8a47cb21e761953db30aea3d39

Auto merge of #6105 - bugadani:sus-char, r=ebroto Lint for invisible Unicode characters other than ZWSP This PR extends the existing `zero_width_space` lint to look for other invisible characters as well (in this case, `\\u{ad}` soft hyphen. I feel like this lint is the logical place to add the check, but I also realize the lint name is not particularly flexible, but I also understand that it shouldn't be renamed for compatibility reasons. Open questions: - What other characters should trigger the lint? - What should be done with the lint name? - How to indicate the change in functionality? Motivation behind this PR: https://github.com/rust-lang/rust/issues/77417 - I managed to shoot myself in the foot by an invisible character pasted into my test case. changelog: rename [`zero_width_space`] to [`invisible_characters`] and add SHY and WJ to the list.

view details

Jonas Schievink

commit sha 1118ab99301025f371f03c1345a5212c3068cf56

Rollup merge of #75377 - canova:map_debug_impl, r=dtolnay Fix Debug implementations of some of the HashMap and BTreeMap iterator types HashMap's `ValuesMut`, BTreeMaps `ValuesMut`, IntoValues and `IntoKeys` structs were printing both keys and values on their Debug implementations. But they are iterators over either keys or values. Irrelevant values should not be visible. With this PR, they only show relevant fields. This fixes #75297. [Here's an example code.](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0c79356ed860e347a0c1a205616f93b7) This prints this on nightly: ``` ValuesMut { inner: IterMut { range: [(1, "hello"), (2, "goodbye")], length: 2 } } IntoKeys { inner: [(1, "hello"), (2, "goodbye")] } IntoValues { inner: [(1, "hello"), (2, "goodbye")] } [(2, "goodbye"), (1, "hello")] ``` After the patch this example prints these instead: ``` ["hello", "goodbye"] ["hello", "goodbye"] [1, 2] ["hello", "goodbye"] ``` I didn't add test cases for them, since I couldn't see any tests for Debug implementations anywhere. But please let me know if I should add it to a specific place. r? @dtolnay

view details

Jonas Schievink

commit sha ca0ff934e939969e09abcc2d17f0cff89b8147ee

Rollup merge of #76107 - integer32llc:manifest-alias, r=pietroalbini Write manifest for MAJOR.MINOR channel to enable rustup convenience This connects to https://github.com/rust-lang/rustup/issues/794. It's hard to remember if there have been patch releases for old versions when you'd like to install the latest in a MAJOR.MINOR series. When we're doing a stable release, we write duplicate manifests to `stable`. With this change, only when we're doing a stable release, also write duplicate manifests to `MAJOR.MINOR` to eventually enable rustup (and any other tooling that builds Rust release URLs) to request, say, `1.45` and get `1.45.2` (assuming `1.45.2` is the latest available `1.45` and assuming that we never publish patch releases out of order). I tested the best I could; it's a bit hard to get everything set up right to be able to run the build-manifest tool. But I was able to run it with a release of "1.45.2" and in addition to the files like `channel-rust-1.45.2.toml` and `channel-rust-stable.toml` (and other manifests) that I got before this change, I now get `channel-rust-1.45.toml`. I believe this change to be safe to deploy as it does not change or remove anything about manifests, just adds more. The actions in rust-central-station that interact with manifests appear to use wildcards in such a way that it will pick up these files without any problems. There will need to be changes to `rustup` before `rustup install 1.45` will work, but we can wait for a stable release and stable patch releases to happen with this change before making the `rustup` changes, so that we're not committing to anything before we know it works.

view details

Jonas Schievink

commit sha 389f7cf7d6c333b490e208bcbda3406b9e0ef437

Rollup merge of #76745 - workingjubilee:move-wrapping-tests, r=matklad Move Wrapping<T> ui tests into library Part of #76268 r? @matklad

view details

Jonas Schievink

commit sha ccc020ab42b4209940b821ba4fd0e1240d3f7561

Rollup merge of #77182 - GuillaumeGomez:missing-examples-fd-traits, r=pickfire Add missing examples for Fd traits Not sure what happened here... This is a reopening of #77142 r? @Dylan-DPC

view details

Jonas Schievink

commit sha 65228686649c68f491d3b763e9dde52c23fea9d7

Rollup merge of #77251 - dtolnay:drop, r=Aaron1011 Bypass const_item_mutation if const's type has Drop impl Follow-up to #75573. This PR disables the const_item_mutation lint in cases that the const has a Drop impl which observes the mutation. ```rust struct Log { msg: &'static str } const LOG: Log = Log { msg: "" }; impl Drop for Log { fn drop(&mut self) { println!("{}", self.msg); } } LOG.msg = "wow"; // prints "wow" ``` r? @Aaron1011

view details

Jonas Schievink

commit sha 01ca8299d48df39a1567ec39f9768d8fcb69ce7f

Rollup merge of #77264 - fusion-engineering-forks:skip-local-stdio, r=dtolnay Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used. The thread local `LOCAL_STDOUT` and `LOCAL_STDERR` are only used by the `test` crate to capture output from tests when running them in the same process in differen threads. However, every program will check these variables on every print, even outside of testing. This involves allocating a thread local key, and registering a thread local destructor. This can be somewhat expensive. This change keeps a global flag (`LOCAL_STREAMS`) which will be set to `true` when either of these local streams is used. (So, effectively only in test and benchmark runs.) When this flag is off, these thread locals are not even looked at and therefore will not be initialized on the first output on every thread, which also means no thread local destructors will be registered. --- Together with https://github.com/rust-lang/rust/pull/77154, this should make output a little bit more efficient.

view details

Jonas Schievink

commit sha 23408de992598d89bf6ed697b4b86bbefc0f2df0

Rollup merge of #77421 - petrochenkov:globtravel, r=nagisa Revert "resolve: Avoid "self-confirming" import resolutions in one more case" And remove the assert that https://github.com/rust-lang/rust/pull/70236 tried to avoid instead. Closes https://github.com/rust-lang/rust/issues/74556.

view details

Jonas Schievink

commit sha eff63980142872227dcd66bf429f7337b1b68c31

Rollup merge of #77452 - Mark-Simulacrum:fix-symbol-v0, r=eddyb Permit ty::Bool in const generics for v0 mangling This should unbreak using new-symbol-mangling = true in config.toml (once it lands in beta anyway). Fixes #76365 (well, it will, but seems fine to close as soon as we have support) r? @eddyb (for mangling) but I'm okay with some other reviewer too :)

view details

bors

commit sha 6ebad43c255e63ac0734646fe817de5780d76b45

Auto merge of #77470 - jonas-schievink:rollup-9a2hulp, r=jonas-schievink Rollup of 8 pull requests Successful merges: - #75377 (Fix Debug implementations of some of the HashMap and BTreeMap iterator types) - #76107 (Write manifest for MAJOR.MINOR channel to enable rustup convenience) - #76745 (Move Wrapping<T> ui tests into library) - #77182 (Add missing examples for Fd traits) - #77251 (Bypass const_item_mutation if const's type has Drop impl) - #77264 (Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used. ) - #77421 (Revert "resolve: Avoid "self-confirming" import resolutions in one more case") - #77452 (Permit ty::Bool in const generics for v0 mangling) Failed merges: r? `@ghost`

view details

push time in 6 days

PR opened rust-lang/rust

Add test case for #77062

Closes #77062

+6 -0

0 comment

1 changed file

pr created time in 6 days

create barnchwesleywiser/rust

branch : close_77062

created branch time in 6 days

issue commentrust-lang/rust

Slow compile times for promotion of `[(); usize::MAX]`

Fixed in #78061.

carbotaniuman

comment created time in 6 days

pull request commentrust-lang/rust

Optimize const value interning for ZST types

Good call! That's fixed too. I'll open another PR with the test case added.

wesleywiser

comment created time in 6 days

pull request commentrust-lang/rust

Disable MatchBranchSimplification

I'm not sure if we need to wait for bors to fail before re-approving, but I'll go ahead and approve in case that works.

@bors r+

tmiasko

comment created time in 6 days

pull request commentrust-lang/rust

Disable MatchBranchSimplification

I think the 64-bit tests need to be blessed as well. (I only see a change to src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff)

tmiasko

comment created time in 6 days

push eventrust-lang/compiler-team

Jonas Schievink

commit sha f2fb663c29c95799cdc0f6f9d50fd0ad5c5ec021

Add myself to the experts map

view details

Wesley Wiser

commit sha ce433755b0a378e090cb95e90187d254b8561d03

Merge pull request #373 from jonas-schievink/patch-1 Add myself to the experts map

view details

push time in 7 days

PR merged rust-lang/compiler-team

Add myself to the experts map

Not sure if this is still used, but it doesn't hurt to keep it updated

+3 -3

0 comment

1 changed file

jonas-schievink

pr closed time in 7 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

[WIP] Do not make local copies of inline fns in debug mode

 impl<'tcx> MonoItem<'tcx> {                 // inlined function. If we're inlining into all CGUs then we'll                 // be creating a local copy per CGU.                 if generate_cgu_internal_copies {-                    return InstantiationMode::LocalCopy;-                }--                // Finally, if this is `#[inline(always)]` we're sure to respect-                // that with an inline copy per CGU, but otherwise we'll be-                // creating one copy of this `#[inline]` function which may-                // conflict with upstream crates as it could be an exported-                // symbol.-                match tcx.codegen_fn_attrs(instance.def_id()).inline {-                    InlineAttr::Always => InstantiationMode::LocalCopy,-                    _ => InstantiationMode::GloballyShared { may_conflict: true },+                    InstantiationMode::LocalCopy+                } else {+                    // Finally, if this is `#[inline(always)]` or `#[inline]` and+                    // OptLevel is not No, we're sure to respect that with an inline+                    // copy per CGU, but otherwise we'll be creating one copy of+                    // this `#[inline]` function which may conflict with upstream+                    // crates as it could be an exported symbol.

Nit: Suggested rewrite for this comment. Please tweak as you see fit :)

                    // Finally, if we've reached this point, then we know that OptLevel = No
                    // so we should optimize for compilation speed. In that regard, we will
                    // ignore any `#[inline]` annotations on the function and simply codegen
                    // it as usual. This could conflict with upstream crates as it could be an exported
                    // symbol.
spastorino

comment created time in 7 days

PullRequestReviewEvent

create barnchwesleywiser/rust

branch : mir_validation_switch_int

created branch time in 8 days

pull request commentrust-lang/rust

always try inlining functions which do not call other functions

I ran into the same thing with deeply-nested the last time I tried enabling the MIR inliner. This Zulip message had most of my findings at that time.

lcnr

comment created time in 9 days

pull request commentrust-lang/rust

Optimize const value interning for ZST types

@bors try @rust-timer queue

wesleywiser

comment created time in 9 days

PR opened rust-lang/rust

Optimize const value interning for ZST types

Interning can skip any inhabited ZST type in general.

Fixes #68010

r? @oli-obk

+11 -0

0 comment

2 changed files

pr created time in 9 days

push eventwesleywiser/rust

Wesley Wiser

commit sha 1d07d696d22a6d5a1ea1a41e0408ea5e990b25ae

Optimize const value interning for ZST types Interning can skip any inhabited ZST type in general.

view details

push time in 9 days

create barnchwesleywiser/rust

branch : opt_zst_const_interning

created branch time in 9 days

pull request commentrust-lang/rust

instrument-coverage: try our best to not ICE

r? @wesleywiser

@bors r+ rollup

Thanks @nagisa!

nagisa

comment created time in 10 days

pull request commentrust-lang/rust

Implement lazy decoding of DefPathTable during incremental compilation

@Aaron1011 I took a look at it yesterday and the code seems fine to me but I don't think I have a complete understanding of this part of the incremental system so I shouldn't sign off on it. @pnkfelix said he would do the review and sign off.

Aaron1011

comment created time in 10 days

pull request commentrust-lang/rust

instrument-coverage: try our best to not ICE

cc @richkadel

nagisa

comment created time in 10 days

Pull request review commentrust-lang/rust

Collect statistics about MIR optimizations

+//! # Support for collecting simple statistics+//!+//! Statistics are useful for collecting metrics from optimization passes, like+//! the number of simplifications performed. To avoid introducing overhead, the+//! collection of statistics is enabled only when rustc is compiled with+//! debug-assertions.+//!+//! Statistics are static variables defined in the module they are used, and+//! lazy registered in the global collector on the first use. Once registered,+//! the collector will obtain their values at the end of compilation process+//! when requested with -Zmir-opt-stats option.++use parking_lot::{const_mutex, Mutex};+use std::fmt::Write as _;+use std::io::{self, Write as _};+use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};++static COLLECTOR: Collector = Collector::new();

I agree with @bjorn3. We've tried pretty hard to move these sorts of things into Session and TyCtxt to allow running multiple sessions in the same process (both for RLS and eventually for one rustc process compiling multiple crates simultaneously).

Since this is essentially unstable, diagnostic data and doesn't effect the compilation artifacts, it may be worth bending that rule because, as you point out, having the counters defined in their MIR passes is quite nice. I don't personally feel comfortable approving that since this is a cross-cutting concern for the compiler as a whole and there may be others on the compiler team that have strong opinions about breaking that rule.

tmiasko

comment created time in 11 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Don't allocate DepNode if anonymous

@arora-aman Don't we still need to do this? https://github.com/rust-lang/rust/issues/45408#issuecomment-365656548

I tried building locally and the incremental cache seems to be the same size before and after this change. I would assume we should see some kind of change if the nodes are no longer being allocated.

arora-aman

comment created time in 12 days

PR closed rust-lang/rust

[WIP] Test removing anon queries

r? @ghost

+1 -60

6 comments

5 changed files

wesleywiser

pr closed time in 12 days

pull request commentrust-lang/rust

[WIP] Test removing anon queries

@bors try @rust-timer queue

wesleywiser

comment created time in 13 days

PR opened rust-lang/rust

[WIP] Test removing anon queries

r? @ghost

+1 -60

0 comment

5 changed files

pr created time in 13 days

create barnchwesleywiser/rust

branch : test_rm_anon_queries

created branch time in 13 days

issue commentboa-dev/boa

Profiler no longer works with measureme 9.0.0

@jasonwilliams It should be pretty easy. Here's the PR I opened up upgrade rustc: https://github.com/rust-lang/rust/pull/77398

neeldug

comment created time in 16 days

pull request commentrust-lang/rust

Remove SimplifyBranchSame MIR optimization

Sure!

@bors try @rust-timer queue

tmiasko

comment created time in 17 days

pull request commentrust-lang/rust

Add a MIR pass manager

I didn't give high level feedback with my review comments but I really like the direction of this PR in general and I'd be happy to r+ it once the review feedback is resolved!

ecstatic-morse

comment created time in 17 days

pull request commentrust-lang/rust

Remove SimplifyBranchSame MIR optimization

I find it really concerning that the criterion for introducing and enabling MIR optimizations is having no performance impact, without having to demonstrate a positive impact (performance or otherwise).

We do have policy in this regard: https://github.com/rust-lang/compiler-team/issues/319. Per that, to be enabled at mir-opt-level=1, the optimization must improve compilation time (by how much or in what situations is unspecified) and must not hurt debugability. We definitely are not enforcing this policy as strictly as we should be, I would say.

The SimplifyBranchSame pass was written specifically to work in conjunction with the SimplifyArmIdentity pass. When we disabled that pass a few months ago because of bugs, the performance regression was enough that the weekly perf triage caught it unsolicited. Whether a 3% improvement on real world crates is enough to justify being enabled by default is debatable but I would say "yes".

We should probably set up a sync mir-opt meeting and talk about that.

Yes, I agree. In particular, I would like to see us draft some policy around how optimizations are taken from experimental/unsound status to run by default.

tmiasko

comment created time in 17 days

issue commentrust-lang/rust

I don't understand nightly-2020-10-08

If you installed Rust via rustup, then rustc and cargo are links to a wrapper program that inspects the current working directory, decides which toolchain to invoke and then invokes that toolchain forwarding the arguments along. As such, this looks like some kind of issue with rustup and not rustc.

leonardo-m

comment created time in 17 days

pull request commentrust-lang/rust

Remove SimplifyBranchSame MIR optimization

I don't think we should remove this pass at this time. This pass is a pretty important part of the set of passes which try to optimize out no-op matches. Eventually, that will be used to remove the costs currently associated with the ? operator once we have inlining working and on by default. Most of the recent bugs with this pass have been due to recent work on the pass; they are not longstanding structural issues.

I'm eager to hear what @oli-obk thinks though.

tmiasko

comment created time in 18 days

Pull request review commentrust-lang/rust

Add a MIR pass manager

 fn test_debugging_options_tracking_hash() {     tracked!(link_only, true);     tracked!(merge_functions, Some(MergeFunctions::Disabled));     tracked!(mir_emit_retag, true);+    tracked!(mir_opt_skip_pass, vec!["ConstProp".to_owned()]);

I think you want

    tracked!(mir_opt_skip_pass, vec![]);
ecstatic-morse

comment created time in 19 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Add a MIR pass manager

 const MAX_BLOCKS: usize = 250; pub struct DestinationPropagation;  impl<'tcx> MirPass<'tcx> for DestinationPropagation {-    fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {-        // Only run at mir-opt-level=2 or higher for now (we don't fix up debuginfo and remove-        // storage statements at the moment).

I think it would be good to retain this comment explaining why this optimization is gated on mir-opt-level=2

ecstatic-morse

comment created time in 19 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Add a MIR pass manager

+use std::borrow::Cow;++use rustc_middle::mir::{Body, MirPhase};+use rustc_middle::ty::TyCtxt;++use super::{dump_mir, validate};++/// A streamlined trait that you can implement to create a pass; the+/// pass will be named after the type, and it will consist of a main+/// loop that goes over each available MIR and applies `run_pass`.+pub trait MirPass<'tcx> {+    const LEVEL: OptLevel;++    fn name(&self) -> Cow<'_, str> {+        let name = std::any::type_name::<Self>();+        name.rsplit(':').next().unwrap().into()+    }++    fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>);+}++const UNSOUND_MIR_OPT_LEVEL: u8 = 2;++pub enum OptLevel {+    /// Passes that will run at `-Zmir-opt-level=N` or higher.+    N(u8),++    /// Passes that are known or suspected to cause miscompilations.+    ///+    /// These passes only run if `-Zunsound-mir-opts` is enabled and we are at `mir-opt-level=2` or+    /// above.+    Unsound,

I think the original idea was that unsound-mir-opts would be completely orthogonal to the optimization level. I could imagine us having an optimization that's buggy (thus unsound) but improves compilation performance quite a bit so we'd eventually want it to run at the default opt level.

I'm not sure this matters in practice though and it would probably complicate things a bit more to make the code support that when we don't currently need it.

ecstatic-morse

comment created time in 19 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Upgrade to measureme 9.0.0

This is ready for review.

Just switch perf.rlo to using .8 for the UI rendering and don't worry about breaking it for older commits

That seems ok to me. We typically don't make that many breaking changes to the on-disk format anymore. I think the last one was about 9 months ago.

wesleywiser

comment created time in 19 days

push eventwesleywiser/rust

Nazım Can Altınova

commit sha a313abe3ba989ba4b6c041627c903488886f8559

Manually implement Debug for BTreeMap::{IntoKeys,IntoValues} structs

view details

Nazım Can Altınova

commit sha 456738e3d1ad7dadffaed287d3055ca38b5fa375

Only print values in the Debug of HashMap::ValuesMut struct

view details

Nazım Can Altınova

commit sha c346e89db8a57e15111daa35685a2542d3be7c77

Manually implement Debug for BTreeMap::ValuesMut struct Deriving debug prints all the values including keys. But ValuesMut struct should only print the values.

view details

Nazım Can Altınova

commit sha 8faf550e5f7211188bc9560ae459c155fb1aafdf

Remove the unused bounds from Debug impl of HashMap::{IntoKeys,IntoValues}

view details

Matt Brubeck

commit sha b4b383981abac7ca8aa180c7ae3e28876615b887

Add PartialEq impls for Vec <-> slice

view details

kadmin

commit sha 8894b366fdb976a703fe76010f6e56c591cada1f

Remove error message in specific case In the case that a trait is not implemented for an ADT with type errors, cancel the error.

view details

Cassandra Fridkin

commit sha a009e2838b25df2761093d727d322a59f69d8f68

There isn't a way to pass --remove yet, but you can rm if u like

view details

Alexis Bourget

commit sha 492826ac144666c75d68bc0a0121453ecc08561f

Add a note about the panic behavior of math operations on time objects

view details

CAD97

commit sha 728938346b02a9688c44253c19b15baa7551fd80

Adjust rc::Weak::from_raw to support unsized T

view details

CAD97

commit sha 0c61ce2cf0560577923abafab2e5bfce14516525

?Sized bounds for rc::Weak::as_ptr and friends

view details

CAD97

commit sha 5e7406c9569dce75a042ce079918cf03cfca842a

Adjust sync::Weak::from_raw to support unsized T

view details

CAD97

commit sha 9d9903c5a50bb1f5b5fc3045b86172279eff7d30

Allow Weak::as_ptr and friends for unsized T

view details

CAD97

commit sha 3d07108d3600dff50e564f57dd390337dbe14d55

Add tests for weak into/from raw

view details

Jubilee Young

commit sha 247b73939a619ea4dcb2affbe1c285d20d93a0b8

Move Wrapping<T> ui tests into library

view details

Jubilee Young

commit sha 797cb9526a627c37b9bb9f6be6d3b54789b67c26

Fix to libstd test

view details

Jubilee Young

commit sha ac96f5b39ca7d9fad8571595c476c2db0bce8438

Test and reject out-of-bounds shuffle vectors

view details

Mara Bos

commit sha 84ef603c8400db203fefd714de963c88e5523424

Fix 'FIXME' about using NonZeroU32 instead of u32. It was blocked by #58732 (const fn NonZeroU32::new), which is fixed now.

view details

Without Boats

commit sha 82f5928ca68acceb1d1bd9e2b09554744e4a1dfe

Make RawFd implement the RawFd traits

view details

Without Boats

commit sha acc136ce0a665a32ddf1a16544b6f6d7a7153c30

fix typos

view details

Without Boats

commit sha 3fe279fc658450a3e3140f014554139493674217

spend another CI build to delete a double newline

view details

push time in 19 days

push eventwesleywiser/rust

Wesley Wiser

commit sha 567c575440e61cbe59d8e08ae04a8f673821b1be

Upgrade to measureme 9.0.0

view details

push time in 19 days

created tagrust-lang/measureme

tag9.0.0

Support crate for rustc's self-profiling feature

created time in 19 days

release rust-lang/measureme

9.0.0

released time in 19 days

delete branch wesleywiser/measureme

delete branch : update_versions

delete time in 19 days

push eventrust-lang/measureme

Wesley Wiser

commit sha 9ca58dd016d8c6ac7368128ae4a9fdb4055839d5

Update versions to 9.0

view details

Wesley Wiser

commit sha 28b1eea82d7ed583f21193446b141a3052e816ec

Merge pull request #140 from wesleywiser/update_versions Update versions to 9.0

view details

push time in 19 days

PR opened rust-lang/measureme

Update versions to 9.0
+8 -8

0 comment

8 changed files

pr created time in 19 days

create barnchwesleywiser/measureme

branch : update_versions

created branch time in 19 days

delete branch wesleywiser/measureme

delete branch : update_changelog

delete time in 19 days

push eventrust-lang/measureme

Wesley Wiser

commit sha f10b3f169aef45c8e2fd5e63fa9eddef372b3ebd

Update changelog for 9.0 release

view details

Wesley Wiser

commit sha 460e6c6ccd7c7f54c750e8a110f48487587d8f90

Merge pull request #139 from wesleywiser/update_changelog Update changelog for 9.0 release

view details

push time in 19 days

push eventwesleywiser/measureme

Wesley Wiser

commit sha f10b3f169aef45c8e2fd5e63fa9eddef372b3ebd

Update changelog for 9.0 release

view details

push time in 19 days

more