From c64e15e817abbe4a2be0143a10c7c4334fa3bdd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Wed, 13 Sep 2023 13:12:51 +0200 Subject: [PATCH] Bring back `verbose_generic_activity_with_arg` --- .../rustc_data_structures/src/profiling.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index 321812fa93a..3c76c2b7991 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -223,6 +223,25 @@ impl SelfProfilerRef { VerboseTimingGuard::start(message_and_format, self.generic_activity(event_label)) } + /// Like `verbose_generic_activity`, but with an extra arg. + pub fn verbose_generic_activity_with_arg( + &self, + event_label: &'static str, + event_arg: A, + ) -> VerboseTimingGuard<'_> + where + A: Borrow + Into, + { + let message_and_format = self + .print_verbose_generic_activities + .map(|format| (format!("{}({})", event_label, event_arg.borrow()), format)); + + VerboseTimingGuard::start( + message_and_format, + self.generic_activity_with_arg(event_label, event_arg), + ) + } + /// Start profiling a generic activity. Profiling continues until the /// TimingGuard returned from this call is dropped. #[inline(always)]