Skip to content

Commit c3e7ff4

Browse files
committed
Adopt the measureme output naming strategy from rustc
1 parent 84f80f1 commit c3e7ff4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/tools/miri/src/machine.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
use std::borrow::Cow;
55
use std::cell::RefCell;
66
use std::fmt;
7+
use std::path::Path;
8+
use std::process;
79

810
use rand::rngs::StdRng;
911
use rand::SeedableRng;
@@ -498,7 +500,17 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
498500
let layouts =
499501
PrimitiveLayouts::new(layout_cx).expect("Couldn't get layouts of primitive types");
500502
let profiler = config.measureme_out.as_ref().map(|out| {
501-
measureme::Profiler::new(out).expect("Couldn't create `measureme` profiler")
503+
let crate_name = layout_cx
504+
.tcx
505+
.sess
506+
.opts
507+
.crate_name
508+
.clone()
509+
.unwrap_or_else(|| "unknown-crate".to_string());
510+
let pid = process::id();
511+
let filename = format!("{crate_name}-{pid:07}");
512+
let path = Path::new(out).join(filename);
513+
measureme::Profiler::new(path).expect("Couldn't create `measureme` profiler")
502514
});
503515
let rng = StdRng::seed_from_u64(config.seed.unwrap_or(0));
504516
let borrow_tracker = config.borrow_tracker.map(|bt| bt.instantiate_global_state(config));

0 commit comments

Comments
 (0)