// on_frame_presented() tells us how the previous set of presents worked out, so here we can
// track how successful our frame scheduling is.
on_frame_presented() tells us how the previous set of presents worked out, so here we can
track how successful our frame scheduling is.
on_frame_presented () tells us how the previous set of presents worked out so here we can track how successful our frame scheduling is .
fn on_frame_presented(
        &self,
        actual_presentation_time: zx::Time,
        presented_infos: Vec<PresentedInfo>,
    ) {
        let num_produced = presented_infos.len() as u64;
        let num_squashed = num_produced - 1;
        let presented_frame = self
            .previous_frames
            .borrow()
            .iter()
            .skip(num_squashed as usize)
            .next()
            .unwrap()
            .clone();
        // Updates present totals.
        self.total_produced.set(self.total_produced.get() + num_produced);
        self.total_presented.set(self.total_presented.get() + 1);
        self.total_dropped.set(self.total_dropped.get() + num_squashed);
        // Track if the current frame was shown later than expected. If so then it was "delayed", as
        // opposed to squashed presents, which are never shown and therefore "dropped".
        if actual_presentation_time
            > presented_frame.expected_presentation_time + self.half_frame_time.get()
        {
            self.total_delayed.set(self.total_delayed.get() + 1);
        }
        // Update the latency histogram with the presented frame.
        let latency = actual_presentation_time - presented_frame.frame_start;
        self.total_latency.set(self.total_latency.get() + latency);
        *self.latency_histogram.borrow_mut().entry(latency).or_insert(0) += 1;
        let previous_frames = &mut self.previous_frames.borrow_mut();
        for PresentedInfo { present_received_time: _, actual_latch_point } in presented_infos.iter()
        {
            let frame = previous_frames.pop_front().unwrap();
            if actual_latch_point > &(frame.expected_latch_point + self.half_frame_time.get()) {
                self.total_missed_latch_points.set(self.total_missed_latch_points.get() + 1);
            }
        }
        self.scheduler.on_frame_presented(actual_presentation_time, presented_infos)
    }
fn on_frame_presented ( & self , actual_presentation_time : zx :: Time , presented_infos : Vec < PresentedInfo > , ) { let num_produced = presented_infos . len ( ) as u64 ; let num_squashed = num_produced - 1 ; let presented_frame = self . previous_frames . borrow ( ) . iter ( ) . skip ( num_squashed as usize ) . next ( ) . unwrap ( ) . clone ( ) ; // Updates present totals. self . total_produced . set ( self . total_produced . get ( ) + num_produced ) ; self . total_presented . set ( self . total_presented . get ( ) + 1 ) ; self . total_dropped . set ( self . total_dropped . get ( ) + num_squashed ) ; // Track if the current frame was shown later than expected. If so then it was "delayed", as // opposed to squashed presents, which are never shown and therefore "dropped". if actual_presentation_time > presented_frame . expected_presentation_time + self . half_frame_time . get ( ) { self . total_delayed . set ( self . total_delayed . get ( ) + 1 ) ; } // Update the latency histogram with the presented frame. let latency = actual_presentation_time - presented_frame . frame_start ; self . total_latency . set ( self . total_latency . get ( ) + latency ) ; * self . latency_histogram . borrow_mut ( ) . entry ( latency ) . or_insert ( 0 ) += 1 ; let previous_frames = & mut self . previous_frames . borrow_mut ( ) ; for PresentedInfo { present_received_time : _ , actual_latch_point } in presented_infos . iter ( ) { let frame = previous_frames . pop_front ( ) . unwrap ( ) ; if actual_latch_point > & ( frame . expected_latch_point + self . half_frame_time . get ( ) ) { self . total_missed_latch_points . set ( self . total_missed_latch_points . get ( ) + 1 ) ; } } self . scheduler . on_frame_presented ( actual_presentation_time , presented_infos ) }
on_frame_presented() tells us how the previous set of presents worked out, so here we can
track how successful our frame scheduling is.
on_frame_presented () tells us how the previous set of presents worked out so here we can track how successful our frame scheduling is .
&self
actual_presentation_time
zx::Time
presented_infos
Vec<PresentedInfo>