diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-09-13 13:12:51 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-09-13 13:41:19 +0200 |
| commit | c64e15e817abbe4a2be0143a10c7c4334fa3bdd8 (patch) | |
| tree | 0dc018d698b9ccfdbfa480571e2a2211cdefbcc6 /compiler/rustc_data_structures/src | |
| parent | 9624c30965d768527efd3ca5f52904fb5e763587 (diff) | |
| download | rust-c64e15e817abbe4a2be0143a10c7c4334fa3bdd8.tar.gz rust-c64e15e817abbe4a2be0143a10c7c4334fa3bdd8.zip | |
Bring back `verbose_generic_activity_with_arg`
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/profiling.rs | 19 |
1 files changed, 19 insertions, 0 deletions
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<A>( + &self, + event_label: &'static str, + event_arg: A, + ) -> VerboseTimingGuard<'_> + where + A: Borrow<str> + Into<String>, + { + 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)] |
