Register queries with self profiler in rustc_interface
This commit is contained in:
parent
f696b21c5f
commit
2fd545485a
4 changed files with 13 additions and 2 deletions
|
@ -1099,7 +1099,6 @@ fn build_session_(
|
||||||
);
|
);
|
||||||
match profiler {
|
match profiler {
|
||||||
Ok(profiler) => {
|
Ok(profiler) => {
|
||||||
crate::ty::query::QueryName::register_with_profiler(&profiler);
|
|
||||||
Some(Arc::new(profiler))
|
Some(Arc::new(profiler))
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
|
@ -827,7 +827,9 @@ macro_rules! define_queries_inner {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl QueryName {
|
impl QueryName {
|
||||||
pub fn register_with_profiler(profiler: &rustc_data_structures::profiling::SelfProfiler) {
|
pub fn register_with_profiler(
|
||||||
|
profiler: &rustc_data_structures::profiling::SelfProfiler,
|
||||||
|
) {
|
||||||
$(profiler.register_query_name(QueryName::$name);)*
|
$(profiler.register_query_name(QueryName::$name);)*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,12 @@ impl SelfProfilerRef {
|
||||||
TimingGuard::none()
|
TimingGuard::none()
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn register_queries(&self, f: impl FnOnce(&SelfProfiler)) {
|
||||||
|
if let Some(profiler) = &self.profiler {
|
||||||
|
f(&profiler)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SelfProfiler {
|
pub struct SelfProfiler {
|
||||||
|
|
|
@ -108,6 +108,10 @@ pub fn create_session(
|
||||||
process_configure_mod,
|
process_configure_mod,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sess.prof.register_queries(|profiler| {
|
||||||
|
rustc::ty::query::QueryName::register_with_profiler(&profiler);
|
||||||
|
});
|
||||||
|
|
||||||
let codegen_backend = get_codegen_backend(&sess);
|
let codegen_backend = get_codegen_backend(&sess);
|
||||||
|
|
||||||
let mut cfg = config::build_configuration(&sess, config::to_crate_config(cfg));
|
let mut cfg = config::build_configuration(&sess, config::to_crate_config(cfg));
|
||||||
|
|
Loading…
Add table
Reference in a new issue