Skip to content

Commit

Permalink
Allow for setting a new event_id right before recording an event.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Dec 11, 2019
1 parent 47ca752 commit f37ced9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions measureme/src/profiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,15 @@ impl<'a, S: SerializationSink> Drop for TimingGuard<'a, S> {
self.profiler.record_raw_event(&raw_event);
}
}

impl<'a, S: SerializationSink> TimingGuard<'a, S> {

/// This method set a new `event_id` right before actually recording the
/// event.
#[inline]
pub fn finish_with_override_event_id(mut self, event_id: StringId) {
self.event_id = event_id;
// Let's be explicit about it: Dropping the guard will record the event.
drop(self)
}
}

0 comments on commit f37ced9

Please sign in to comment.