File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
rustc_data_structures/src
rustc_query_system/src/dep_graph Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ impl SelfProfilerRef {
255255 /// Start profiling with some event filter for a given event. Profiling continues until the
256256 /// TimingGuard returned from this call is dropped.
257257 #[inline(always)]
258- pub fn generic_activity_with_event (&self, event_id: EventId) -> TimingGuard<'_> {
258+ pub fn generic_activity_with_event_id (&self, event_id: EventId) -> TimingGuard<'_> {
259259 self.exec(EventFilter::GENERIC_ACTIVITIES, |profiler| {
260260 TimingGuard::start(profiler, profiler.generic_activity_event_kind, event_id)
261261 })
@@ -390,7 +390,11 @@ impl SelfProfilerRef {
390390 }
391391 }
392392
393- pub fn get_or_alloc_cached_string(&self, s: &'static str) -> Option<StringId> {
393+ /// Gets a `StringId` for the given string. This method makes sure that
394+ /// any strings going through it will only be allocated once in the
395+ /// profiling data.
396+ /// Returns `None` if the self-profiling is not enabled.
397+ pub fn get_or_alloc_cached_string(&self, s: &str) -> Option<StringId> {
394398 self.profiler.as_ref().map(|p| p.get_or_alloc_cached_string(s))
395399 }
396400
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ pub struct DepGraph<K: DepKind> {
3939 /// The cached event id for profiling node interning. This saves us
4040 /// from having to look up the event id every time we intern a node
4141 /// which may incur too much overhead.
42+ /// This will be None if self-profiling is disabled.
4243 node_intern_event_id: Option<EventId>,
4344}
4445
@@ -265,7 +266,7 @@ impl<K: DepKind> DepGraph<K> {
265266 // Get timer for profiling `DepNode` interning
266267 let node_intern_timer = self
267268 .node_intern_event_id
268- .map(|eid| dcx.profiler().generic_activity_with_event (eid));
269+ .map(|eid| dcx.profiler().generic_activity_with_event_id (eid));
269270 // Intern the new `DepNode`.
270271 let (dep_node_index, prev_and_color) = data.current.intern_node(
271272 dcx.profiler(),
You can’t perform that action at this time.
0 commit comments