summaryrefslogtreecommitdiff
path: root/src/tools/miri/src/machine.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/miri/src/machine.rs')
-rw-r--r--src/tools/miri/src/machine.rs32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs
index ecb3e13dd54..32717a0d28b 100644
--- a/src/tools/miri/src/machine.rs
+++ b/src/tools/miri/src/machine.rs
@@ -4,6 +4,8 @@
use std::borrow::Cow;
use std::cell::RefCell;
use std::fmt;
+use std::path::Path;
+use std::process;
use rand::rngs::StdRng;
use rand::SeedableRng;
@@ -32,8 +34,14 @@ use crate::{
*,
};
-/// The number of the available real-time signal with the lowest priority.
-/// Dummy constant related to epoll, must be between 32 and 64.
+/// First real-time signal.
+/// `signal(7)` says this must be between 32 and 64 and specifies 34 or 35
+/// as typical values.
+pub const SIGRTMIN: i32 = 34;
+
+/// Last real-time signal.
+/// `signal(7)` says it must be between 32 and 64 and specifies
+/// `SIGRTMAX` - `SIGRTMIN` >= 8 (which is the value of `_POSIX_RTSIG_MAX`)
pub const SIGRTMAX: i32 = 42;
/// Extra data stored with each stack frame
@@ -492,12 +500,26 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
let layouts =
PrimitiveLayouts::new(layout_cx).expect("Couldn't get layouts of primitive types");
let profiler = config.measureme_out.as_ref().map(|out| {
- measureme::Profiler::new(out).expect("Couldn't create `measureme` profiler")
+ let crate_name = layout_cx
+ .tcx
+ .sess
+ .opts
+ .crate_name
+ .clone()
+ .unwrap_or_else(|| "unknown-crate".to_string());
+ let pid = process::id();
+ // We adopt the same naming scheme for the profiler output that rustc uses. In rustc,
+ // the PID is padded so that the nondeterministic value of the PID does not spread
+ // nondeterminisim to the allocator. In Miri we are not aiming for such performance
+ // control, we just pad for consistency with rustc.
+ let filename = format!("{crate_name}-{pid:07}");
+ let path = Path::new(out).join(filename);
+ measureme::Profiler::new(path).expect("Couldn't create `measureme` profiler")
});
let rng = StdRng::seed_from_u64(config.seed.unwrap_or(0));
- let borrow_tracker = config.borrow_tracker.map(|bt| bt.instanciate_global_state(config));
+ let borrow_tracker = config.borrow_tracker.map(|bt| bt.instantiate_global_state(config));
let data_race = config.data_race_detector.then(|| data_race::GlobalState::new(config));
- // Determinine page size, stack address, and stack size.
+ // Determine page size, stack address, and stack size.
// These values are mostly meaningless, but the stack address is also where we start
// allocating physical integer addresses for all allocations.
let page_size = if let Some(page_size) = config.page_size {