Skip to content

Commit

Permalink
Add #[inline] annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleywiser committed Feb 7, 2019
1 parent 5bb96ed commit a568e7e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/librustc/util/profiling.rs
Expand Up @@ -169,20 +169,23 @@ impl SelfProfiler {
profiler
}

#[inline]
pub fn start_activity(&mut self, category: ProfileCategory) {
self.record(ProfilerEvent::GenericActivityStart {
category,
time: Instant::now(),
})
}

#[inline]
pub fn end_activity(&mut self, category: ProfileCategory) {
self.record(ProfilerEvent::GenericActivityEnd {
category,
time: Instant::now(),
})
}

#[inline]
pub fn record_computed_queries(
&mut self,
query_name: &'static str,
Expand All @@ -196,13 +199,15 @@ impl SelfProfiler {
})
}

#[inline]
pub fn record_query_hit(&mut self, query_name: &'static str, category: ProfileCategory) {
self.record(ProfilerEvent::QueryCacheHit {
query_name,
category,
})
}

#[inline]
pub fn start_query(&mut self, query_name: &'static str, category: ProfileCategory) {
self.record(ProfilerEvent::QueryStart {
query_name,
Expand All @@ -211,6 +216,7 @@ impl SelfProfiler {
});
}

#[inline]
pub fn end_query(&mut self, query_name: &'static str, category: ProfileCategory) {
self.record(ProfilerEvent::QueryEnd {
query_name,
Expand All @@ -219,6 +225,7 @@ impl SelfProfiler {
})
}

#[inline]
fn record(&mut self, event: ProfilerEvent) {
let thread_id = std::thread::current().id();
let events = self.events.entry(thread_id).or_default();
Expand Down

0 comments on commit a568e7e

Please sign in to comment.