diff options
| author | Ryan Levick <me@ryanlevick.com> | 2021-07-07 11:13:46 +0200 | 
|---|---|---|
| committer | Ryan Levick <me@ryanlevick.com> | 2021-07-07 11:14:14 +0200 | 
| commit | b5bec171841ef35d9f29a58ec567c734348118d0 (patch) | |
| tree | ad245cd99a81a3bb139c05fe9c78b327603e7cbd /compiler/rustc_data_structures | |
| parent | 6e33dce9c2d549f0c32f7940ffccd0f0de8af74e (diff) | |
| download | rust-b5bec171841ef35d9f29a58ec567c734348118d0.tar.gz rust-b5bec171841ef35d9f29a58ec567c734348118d0.zip | |
Add docs to new methods
Diffstat (limited to 'compiler/rustc_data_structures')
| -rw-r--r-- | compiler/rustc_data_structures/src/profiling.rs | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index 531214bc40e..ef101c56ab5 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -255,7 +255,7 @@ impl SelfProfilerRef { /// Start profiling with some event filter for a given event. Profiling continues until the /// TimingGuard returned from this call is dropped. #[inline(always)] - pub fn generic_activity_with_event(&self, event_id: EventId) -> TimingGuard<'_> { + pub fn generic_activity_with_event_id(&self, event_id: EventId) -> TimingGuard<'_> { self.exec(EventFilter::GENERIC_ACTIVITIES, |profiler| { TimingGuard::start(profiler, profiler.generic_activity_event_kind, event_id) }) @@ -390,7 +390,11 @@ impl SelfProfilerRef { } } - pub fn get_or_alloc_cached_string(&self, s: &'static str) -> Option<StringId> { + /// Gets a `StringId` for the given string. This method makes sure that + /// any strings going through it will only be allocated once in the + /// profiling data. + /// Returns `None` if the self-profiling is not enabled. + pub fn get_or_alloc_cached_string(&self, s: &str) -> Option<StringId> { self.profiler.as_ref().map(|p| p.get_or_alloc_cached_string(s)) } | 
