Skip to content

Commit c64e15e

Browse files
committed
Bring back verbose_generic_activity_with_arg
1 parent 9624c30 commit c64e15e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

compiler/rustc_data_structures/src/profiling.rs

+19
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,25 @@ 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+
226245
/// Start profiling a generic activity. Profiling continues until the
227246
/// TimingGuard returned from this call is dropped.
228247
#[inline(always)]

0 commit comments

Comments
 (0)