diff options
| author | bors <bors@rust-lang.org> | 2020-11-17 15:27:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-11-17 15:27:29 +0000 |
| commit | c919f490bbcd2b29b74016101f7ec71aaa24bdbb (patch) | |
| tree | ce8406ee4a726bc8db7c864518f3d8ea16ea8c6e /compiler/rustc_data_structures | |
| parent | e0ef0fc392963438af5f0343bf7caa46fb9c3ec3 (diff) | |
| parent | f698505177eb1853b3d905bbe1005140acd50d53 (diff) | |
| download | rust-c919f490bbcd2b29b74016101f7ec71aaa24bdbb.tar.gz rust-c919f490bbcd2b29b74016101f7ec71aaa24bdbb.zip | |
Auto merge of #79138 - m-ou-se:rollup-owel5ld, r=m-ou-se
Rollup of 8 pull requests
Successful merges:
- #74293 (Rustdoc test compiler output color)
- #78702 ([self-profiling] Include the estimated size of each cgu in the profile)
- #79069 (Get rid of `highlight::Class::None`)
- #79072 (Fix exhaustiveness in case a byte string literal is used at slice type)
- #79120 (update rustfmt to v1.4.27)
- #79125 (Get rid of clean::{Method, TyMethod})
- #79126 (Remove duplicate `Trait::auto` field)
- #79130 (extend macro braces test)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_data_structures')
| -rw-r--r-- | compiler/rustc_data_structures/src/profiling.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index e598d7a683d..5d13b7f27c7 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -272,6 +272,28 @@ impl SelfProfilerRef { }) } + #[inline(always)] + pub fn generic_activity_with_args( + &self, + event_label: &'static str, + event_args: &[String], + ) -> TimingGuard<'_> { + self.exec(EventFilter::GENERIC_ACTIVITIES, |profiler| { + let builder = EventIdBuilder::new(&profiler.profiler); + let event_label = profiler.get_or_alloc_cached_string(event_label); + let event_id = if profiler.event_filter_mask.contains(EventFilter::FUNCTION_ARGS) { + let event_args: Vec<_> = event_args + .iter() + .map(|s| profiler.get_or_alloc_cached_string(&s[..])) + .collect(); + builder.from_label_and_args(event_label, &event_args) + } else { + builder.from_label(event_label) + }; + TimingGuard::start(profiler, profiler.generic_activity_event_kind, event_id) + }) + } + /// Start profiling a query provider. Profiling continues until the /// TimingGuard returned from this call is dropped. #[inline(always)] |
