Skip to content

Commit 2fd5454

Browse files
Register queries with self profiler in rustc_interface
1 parent f696b21 commit 2fd5454

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

src/librustc/session/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,6 @@ fn build_session_(
10991099
);
11001100
match profiler {
11011101
Ok(profiler) => {
1102-
crate::ty::query::QueryName::register_with_profiler(&profiler);
11031102
Some(Arc::new(profiler))
11041103
},
11051104
Err(e) => {

src/librustc/ty/query/plumbing.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,9 @@ macro_rules! define_queries_inner {
827827
}
828828

829829
impl QueryName {
830-
pub fn register_with_profiler(profiler: &rustc_data_structures::profiling::SelfProfiler) {
830+
pub fn register_with_profiler(
831+
profiler: &rustc_data_structures::profiling::SelfProfiler,
832+
) {
831833
$(profiler.register_query_name(QueryName::$name);)*
832834
}
833835

src/librustc_data_structures/profiling.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ impl SelfProfilerRef {
205205
TimingGuard::none()
206206
}));
207207
}
208+
209+
pub fn register_queries(&self, f: impl FnOnce(&SelfProfiler)) {
210+
if let Some(profiler) = &self.profiler {
211+
f(&profiler)
212+
}
213+
}
208214
}
209215

210216
pub struct SelfProfiler {

src/librustc_interface/util.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ pub fn create_session(
108108
process_configure_mod,
109109
);
110110

111+
sess.prof.register_queries(|profiler| {
112+
rustc::ty::query::QueryName::register_with_profiler(&profiler);
113+
});
114+
111115
let codegen_backend = get_codegen_backend(&sess);
112116

113117
let mut cfg = config::build_configuration(&sess, config::to_crate_config(cfg));

0 commit comments

Comments
 (0)