mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
[self-profiler] Clean up EventFilter
This commit is contained in:
parent
ea42b1c5b8
commit
2acf5a30ba
@ -128,17 +128,13 @@ bitflags::bitflags! {
|
|||||||
Self::QUERY_PROVIDERS.bits |
|
Self::QUERY_PROVIDERS.bits |
|
||||||
Self::QUERY_BLOCKED.bits |
|
Self::QUERY_BLOCKED.bits |
|
||||||
Self::INCR_CACHE_LOADS.bits;
|
Self::INCR_CACHE_LOADS.bits;
|
||||||
|
|
||||||
// empty() and none() aren't const-fns unfortunately
|
|
||||||
const NONE = 0;
|
|
||||||
const ALL = !Self::NONE.bits;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep this in sync with the `-Z self-profile-events` help message in librustc_session/options.rs
|
// keep this in sync with the `-Z self-profile-events` help message in librustc_session/options.rs
|
||||||
const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
|
const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
|
||||||
("none", EventFilter::NONE),
|
("none", EventFilter::empty()),
|
||||||
("all", EventFilter::ALL),
|
("all", EventFilter::all()),
|
||||||
("default", EventFilter::DEFAULT),
|
("default", EventFilter::DEFAULT),
|
||||||
("generic-activity", EventFilter::GENERIC_ACTIVITIES),
|
("generic-activity", EventFilter::GENERIC_ACTIVITIES),
|
||||||
("query-provider", EventFilter::QUERY_PROVIDERS),
|
("query-provider", EventFilter::QUERY_PROVIDERS),
|
||||||
@ -180,7 +176,7 @@ impl SelfProfilerRef {
|
|||||||
// If there is no SelfProfiler then the filter mask is set to NONE,
|
// If there is no SelfProfiler then the filter mask is set to NONE,
|
||||||
// ensuring that nothing ever tries to actually access it.
|
// ensuring that nothing ever tries to actually access it.
|
||||||
let event_filter_mask =
|
let event_filter_mask =
|
||||||
profiler.as_ref().map(|p| p.event_filter_mask).unwrap_or(EventFilter::NONE);
|
profiler.as_ref().map(|p| p.event_filter_mask).unwrap_or(EventFilter::empty());
|
||||||
|
|
||||||
SelfProfilerRef {
|
SelfProfilerRef {
|
||||||
profiler,
|
profiler,
|
||||||
|
Loading…
Reference in New Issue
Block a user