current_timer: Instant,
}
-pub struct ProfilerActivity<'a>(ProfileCategory, &'a mut SelfProfiler);
-
-impl<'a> Drop for ProfilerActivity<'a> {
- fn drop(&mut self) {
- let ProfilerActivity (category, profiler) = self;
-
- profiler.end_activity(*category);
- }
-}
-
impl SelfProfiler {
pub fn new() -> SelfProfiler {
let mut profiler = SelfProfiler {
fs::write("self_profiler_results.json", json).unwrap();
}
-
- pub fn record_activity<'a>(&'a mut self, category: ProfileCategory) -> ProfilerActivity<'a> {
- self.start_activity(category);
-
- ProfilerActivity(category, self)
- }
-}
\ No newline at end of file
+}