Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions summarize/src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ struct SamplePoints<'a> {
/// so we just have to find the *only* thread's ID and require there is no other.
expected_thread_id: u32,

/// Reversed events that do not contain integer payloads
rev_events: std::iter::Peekable<Box<dyn Iterator<Item = Event<'a>> + 'a>>,
stack: Vec<Event<'a>>,
}
Expand Down Expand Up @@ -165,7 +166,11 @@ impl<'a> BackwardsIterator for SamplePoints<'a> {
type Item = SamplePoint<WithParent<Event<'a>>>;
fn next_back(&mut self) -> Option<Self::Item> {
let sample_point = match self.rev_events.peek() {
Some(peeked_event) if !peeked_event.payload.is_integer() => {
Some(peeked_event) => {
assert!(
!peeked_event.payload.is_integer(),
"Integer events accidentally included in `SamplePoints` events"
);
assert_eq!(
peeked_event.thread_id, self.expected_thread_id,
"more than one thread is not supported in `summarize aggregate`"
Expand All @@ -177,8 +182,6 @@ impl<'a> BackwardsIterator for SamplePoints<'a> {
Some(top_event) if !top_event.contains(peeked_event) => {
SamplePoint::Start(self.stack.pop().unwrap())
}
Some(_) => unreachable!(),

_ => {
let event = self.rev_events.next().unwrap();
match event.payload {
Expand All @@ -198,7 +201,6 @@ impl<'a> BackwardsIterator for SamplePoints<'a> {
}
}
}
Some(_) => unreachable!(),

// Ran out of events, but we might still have stack entries to leave.
None => SamplePoint::Start(self.stack.pop()?),
Expand Down