Support plugging external profilers into the Cranelift timing infrastructure (#5749)
* Remove no-std code for cranelift_codegen::timings no-std mode isn't supported by Cranelift anymore * Simplify define_passes macro * Add egraph opt timings * Replace the add_to_current api with PassTimes::add * Omit a couple of unused time measurements * Reduce divergence between run and run_passes a bit * Introduce a Profiler trait This allows plugging in external profilers into the Cranelift profiling framework. * Add Pass::description method * Remove duplicate usage of the compile pass timing * Rustfmt
This commit is contained in:
@@ -82,14 +82,16 @@ impl ConcurrentRunner {
|
||||
|
||||
/// Join all the worker threads.
|
||||
/// Transfer pass timings from the worker threads to the current thread.
|
||||
pub fn join(&mut self) {
|
||||
pub fn join(&mut self) -> timing::PassTimes {
|
||||
assert!(self.request_tx.is_none(), "must shutdown before join");
|
||||
let mut pass_times = timing::PassTimes::default();
|
||||
for h in self.handles.drain(..) {
|
||||
match h.join() {
|
||||
Ok(t) => timing::add_to_current(&t),
|
||||
Ok(t) => pass_times.add(&t),
|
||||
Err(e) => println!("worker panicked: {:?}", e),
|
||||
}
|
||||
}
|
||||
pass_times
|
||||
}
|
||||
|
||||
/// Add a new job to the queues.
|
||||
|
||||
Reference in New Issue
Block a user