//!
//! [mm]: https://github.com/rust-lang/measureme/
+use crate::cold_path;
use crate::fx::FxHashMap;
use std::borrow::Borrow;
const QUERY_KEYS = 1 << 5;
const FUNCTION_ARGS = 1 << 6;
+ const LLVM = 1 << 7;
const DEFAULT = Self::GENERIC_ACTIVITIES.bits |
Self::QUERY_PROVIDERS.bits |
("query-keys", EventFilter::QUERY_KEYS),
("function-args", EventFilter::FUNCTION_ARGS),
("args", EventFilter::ARGS),
+ ("llvm", EventFilter::LLVM),
];
/// Something that uniquely identifies a query invocation.
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 {
#[inline]
pub fn finish_with_query_invocation_id(self, query_invocation_id: QueryInvocationId) {
if let Some(guard) = self.0 {
- let event_id = StringId::new_virtual(query_invocation_id.0);
- let event_id = EventId::from_virtual(event_id);
- guard.finish_with_override_event_id(event_id);
+ cold_path(|| {
+ let event_id = StringId::new_virtual(query_invocation_id.0);
+ let event_id = EventId::from_virtual(event_id);
+ guard.finish_with_override_event_id(event_id);
+ });
}
}