Skip to content

Commit f742d88

Browse files
committed
Remove verbose_generic_activity_with_arg
1 parent 01ce2d0 commit f742d88

File tree

5 files changed

+21
-49
lines changed

5 files changed

+21
-49
lines changed

compiler/rustc_codegen_cranelift/src/driver/aot.rs

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ fn module_codegen(
269269
),
270270
) -> OngoingModuleCodegen {
271271
let (cgu_name, mut cx, mut module, codegened_functions) =
272-
tcx.prof.verbose_generic_activity_with_arg("codegen cgu", cgu_name.as_str()).run(|| {
272+
tcx.prof.generic_activity_with_arg("codegen cgu", cgu_name.as_str()).run(|| {
273273
let cgu = tcx.codegen_unit(cgu_name);
274274
let mono_items = cgu.items_in_deterministic_order(tcx);
275275

@@ -322,35 +322,24 @@ fn module_codegen(
322322
});
323323

324324
OngoingModuleCodegen::Async(std::thread::spawn(move || {
325-
cx.profiler.clone().verbose_generic_activity_with_arg("compile functions", &*cgu_name).run(
326-
|| {
327-
cranelift_codegen::timing::set_thread_profiler(Box::new(super::MeasuremeProfiler(
328-
cx.profiler.clone(),
329-
)));
330-
331-
let mut cached_context = Context::new();
332-
for codegened_func in codegened_functions {
333-
crate::base::compile_fn(
334-
&mut cx,
335-
&mut cached_context,
336-
&mut module,
337-
codegened_func,
338-
);
339-
}
340-
},
341-
);
325+
cx.profiler.clone().generic_activity_with_arg("compile functions", &*cgu_name).run(|| {
326+
cranelift_codegen::timing::set_thread_profiler(Box::new(super::MeasuremeProfiler(
327+
cx.profiler.clone(),
328+
)));
329+
330+
let mut cached_context = Context::new();
331+
for codegened_func in codegened_functions {
332+
crate::base::compile_fn(&mut cx, &mut cached_context, &mut module, codegened_func);
333+
}
334+
});
342335

343-
let global_asm_object_file = cx
344-
.profiler
345-
.verbose_generic_activity_with_arg("compile assembly", &*cgu_name)
346-
.run(|| {
336+
let global_asm_object_file =
337+
cx.profiler.generic_activity_with_arg("compile assembly", &*cgu_name).run(|| {
347338
crate::global_asm::compile_global_asm(&global_asm_config, &cgu_name, &cx.global_asm)
348339
})?;
349340

350-
let codegen_result = cx
351-
.profiler
352-
.verbose_generic_activity_with_arg("write object file", &*cgu_name)
353-
.run(|| {
341+
let codegen_result =
342+
cx.profiler.generic_activity_with_arg("write object file", &*cgu_name).run(|| {
354343
emit_cgu(
355344
&global_asm_config.output_filenames,
356345
&cx.profiler,

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ pub(crate) fn run_pass_manager(
605605
module: &mut ModuleCodegen<ModuleLlvm>,
606606
thin: bool,
607607
) -> Result<(), FatalError> {
608-
let _timer = cgcx.prof.verbose_generic_activity_with_arg("LLVM_lto_optimize", &*module.name);
608+
let _timer = cgcx.prof.generic_activity_with_arg("LLVM_lto_optimize", &*module.name);
609609
let config = cgcx.config(module.kind);
610610

611611
// Now we have one massive module inside of llmod. Time to run the

compiler/rustc_data_structures/src/profiling.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -223,25 +223,6 @@ impl SelfProfilerRef {
223223
VerboseTimingGuard::start(message_and_format, self.generic_activity(event_label))
224224
}
225225

226-
/// Like `verbose_generic_activity`, but with an extra arg.
227-
pub fn verbose_generic_activity_with_arg<A>(
228-
&self,
229-
event_label: &'static str,
230-
event_arg: A,
231-
) -> VerboseTimingGuard<'_>
232-
where
233-
A: Borrow<str> + Into<String>,
234-
{
235-
let message_and_format = self
236-
.print_verbose_generic_activities
237-
.map(|format| (format!("{}({})", event_label, event_arg.borrow()), format));
238-
239-
VerboseTimingGuard::start(
240-
message_and_format,
241-
self.generic_activity_with_arg(event_label, event_arg),
242-
)
243-
}
244-
245226
/// Start profiling a generic activity. Profiling continues until the
246227
/// TimingGuard returned from this call is dropped.
247228
#[inline(always)]

compiler/rustc_mir_transform/src/pass_manager.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ fn run_passes_inner<'tcx>(
121121
validate_body(tcx, body, format!("before pass {name}"));
122122
}
123123

124-
tcx.sess.time(name, || pass.run_pass(tcx, body));
124+
tcx.sess
125+
.prof
126+
.generic_activity_with_arg("mir_pass", name)
127+
.run(|| pass.run_pass(tcx, body));
125128

126129
if dump_enabled {
127130
dump_mir_for_pass(tcx, body, &name, true);

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,7 @@ pub(crate) fn encode_query_results<'a, 'tcx, Q>(
348348
Q: super::QueryConfigRestored<'tcx>,
349349
Q::RestoredValue: Encodable<CacheEncoder<'a, 'tcx>>,
350350
{
351-
let _timer =
352-
qcx.profiler().verbose_generic_activity_with_arg("encode_query_results_for", query.name());
351+
let _timer = qcx.profiler().generic_activity_with_arg("encode_query_results_for", query.name());
353352

354353
assert!(query.query_state(qcx).all_inactive());
355354
let cache = query.query_cache(qcx);

0 commit comments

Comments
 (0)