Skip to content

Commit

Permalink
Bring back verbose_generic_activity_with_arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Sep 13, 2023
1 parent 9624c30 commit c64e15e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions compiler/rustc_data_structures/src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit c64e15e

Please sign in to comment.