Skip to content

Commit

Permalink
[self-profiler] Clean up EventFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleywiser committed Jan 25, 2020
1 parent ea42b1c commit 2acf5a3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/librustc_data_structures/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,13 @@ bitflags::bitflags! {
Self::QUERY_PROVIDERS.bits |
Self::QUERY_BLOCKED.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
const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
("none", EventFilter::NONE),
("all", EventFilter::ALL),
("none", EventFilter::empty()),
("all", EventFilter::all()),
("default", EventFilter::DEFAULT),
("generic-activity", EventFilter::GENERIC_ACTIVITIES),
("query-provider", EventFilter::QUERY_PROVIDERS),
Expand Down Expand Up @@ -180,7 +176,7 @@ impl SelfProfilerRef {
// If there is no SelfProfiler then the filter mask is set to NONE,
// ensuring that nothing ever tries to actually access it.
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 {
profiler,
Expand Down

0 comments on commit 2acf5a3

Please sign in to comment.