about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorAndreas Jonson <andjo403@users.noreply.github.com>2020-02-11 22:37:16 +0100
committerAndreas Jonson <andjo403@users.noreply.github.com>2020-02-13 08:02:18 +0100
commitcec0ed0219c4e4961b9e7a33419d716a5ddf0e5d (patch)
tree392f88ed9b79248cd49a71737e3691d322888932 /src/librustc_data_structures
parentba18875557aabffe386a2534a1aa6118efb6ab88 (diff)
add selfprofiling for new llvm passmanager
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/profiling.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/librustc_data_structures/profiling.rs b/src/librustc_data_structures/profiling.rs
index debda9f0a0a..1d0ac4f4907 100644
--- a/src/librustc_data_structures/profiling.rs
+++ b/src/librustc_data_structures/profiling.rs
@@ -127,6 +127,7 @@ bitflags::bitflags! {
 
         const QUERY_KEYS         = 1 << 5;
         const FUNCTION_ARGS      = 1 << 6;
+        const LLVM               = 1 << 7;
 
         const DEFAULT = Self::GENERIC_ACTIVITIES.bits |
                         Self::QUERY_PROVIDERS.bits |
@@ -150,6 +151,7 @@ const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
     ("query-keys", EventFilter::QUERY_KEYS),
     ("function-args", EventFilter::FUNCTION_ARGS),
     ("args", EventFilter::ARGS),
+    ("llvm", EventFilter::LLVM),
 ];
 
 /// Something that uniquely identifies a query invocation.
@@ -364,6 +366,15 @@ impl SelfProfilerRef {
     pub fn enabled(&self) -> bool {
         self.profiler.is_some()
     }
+
+    #[inline]
+    pub fn llvm_recording_enabled(&self) -> bool {
+        self.event_filter_mask.contains(EventFilter::LLVM)
+    }
+    #[inline]
+    pub fn get_self_profiler(&self) -> Option<Arc<SelfProfiler>> {
+        self.profiler.clone()
+    }
 }
 
 pub struct SelfProfiler {