File tree 2 files changed +8
-3
lines changed
rustc_data_structures/src
rustc_query_system/src/dep_graph
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ impl SelfProfilerRef {
255
255
/// Start profiling with some event filter for a given event. Profiling continues until the
256
256
/// TimingGuard returned from this call is dropped.
257
257
#[ 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 < ' _ > {
259
259
self . exec ( EventFilter :: GENERIC_ACTIVITIES , |profiler| {
260
260
TimingGuard :: start ( profiler, profiler. generic_activity_event_kind , event_id)
261
261
} )
@@ -390,7 +390,11 @@ impl SelfProfilerRef {
390
390
}
391
391
}
392
392
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 > {
394
398
self . profiler . as_ref ( ) . map ( |p| p. get_or_alloc_cached_string ( s) )
395
399
}
396
400
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ pub struct DepGraph<K: DepKind> {
39
39
/// The cached event id for profiling node interning. This saves us
40
40
/// from having to look up the event id every time we intern a node
41
41
/// which may incur too much overhead.
42
+ /// This will be None if self-profiling is disabled.
42
43
node_intern_event_id : Option < EventId > ,
43
44
}
44
45
@@ -265,7 +266,7 @@ impl<K: DepKind> DepGraph<K> {
265
266
// Get timer for profiling `DepNode` interning
266
267
let node_intern_timer = self
267
268
. 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) ) ;
269
270
// Intern the new `DepNode`.
270
271
let ( dep_node_index, prev_and_color) = data. current . intern_node (
271
272
dcx. profiler ( ) ,
You can’t perform that action at this time.
0 commit comments