@@ -515,7 +515,7 @@ void PowerAdvisor::setRequiresRenderEngine(DisplayId displayId, bool requiresRen
515515}
516516
517517void PowerAdvisor::setExpectedPresentTime (TimePoint expectedPresentTime) {
518- mExpectedPresentTimes .append (expectedPresentTime) ;
518+ mExpectedPresentTimes .next () = expectedPresentTime ;
519519}
520520
521521void PowerAdvisor::setSfPresentTiming (TimePoint presentFenceTime, TimePoint presentEndTime) {
@@ -532,7 +532,7 @@ void PowerAdvisor::setHwcPresentDelayedTime(DisplayId displayId, TimePoint earli
532532}
533533
534534void PowerAdvisor::setCommitStart (TimePoint commitStartTime) {
535- mCommitStartTimes .append (commitStartTime) ;
535+ mCommitStartTimes .next () = commitStartTime ;
536536}
537537
538538void PowerAdvisor::setCompositeEnd (TimePoint compositeEndTime) {
@@ -579,7 +579,7 @@ std::optional<hal::WorkDuration> PowerAdvisor::estimateWorkDuration() {
579579 }
580580
581581 // Tracks when we finish presenting to hwc
582- TimePoint estimatedHwcEndTime = mCommitStartTimes [ 0 ] ;
582+ TimePoint estimatedHwcEndTime = mCommitStartTimes . back () ;
583583
584584 // How long we spent this frame not doing anything, waiting for fences or vsync
585585 Duration idleDuration = 0ns;
@@ -643,13 +643,13 @@ std::optional<hal::WorkDuration> PowerAdvisor::estimateWorkDuration() {
643643 // Also add the frame delay duration since the target did not move while we were delayed
644644 Duration totalDuration = mFrameDelayDuration +
645645 std::max (estimatedHwcEndTime, estimatedGpuEndTime.value_or (TimePoint{0ns})) -
646- mCommitStartTimes [ 0 ] ;
646+ mCommitStartTimes . back () ;
647647 Duration totalDurationWithoutGpu =
648- mFrameDelayDuration + estimatedHwcEndTime - mCommitStartTimes [ 0 ] ;
648+ mFrameDelayDuration + estimatedHwcEndTime - mCommitStartTimes . back () ;
649649
650650 // We finish SurfaceFlinger when post-composition finishes, so add that in here
651651 Duration flingerDuration =
652- estimatedFlingerEndTime + mLastPostcompDuration - mCommitStartTimes [ 0 ] ;
652+ estimatedFlingerEndTime + mLastPostcompDuration - mCommitStartTimes . back () ;
653653 Duration estimatedGpuDuration = firstGpuTimeline.has_value ()
654654 ? estimatedGpuEndTime.value_or (TimePoint{0ns}) - firstGpuTimeline->startTime
655655 : Duration::fromNs (0 );
@@ -661,7 +661,7 @@ std::optional<hal::WorkDuration> PowerAdvisor::estimateWorkDuration() {
661661 hal::WorkDuration duration{
662662 .timeStampNanos = TimePoint::now ().ns (),
663663 .durationNanos = combinedDuration.ns (),
664- .workPeriodStartTimestampNanos = mCommitStartTimes [ 0 ] .ns (),
664+ .workPeriodStartTimestampNanos = mCommitStartTimes . back () .ns (),
665665 .cpuDurationNanos = supportsGpuReporting () ? cpuDuration.ns () : 0 ,
666666 .gpuDurationNanos = supportsGpuReporting () ? estimatedGpuDuration.ns () : 0 ,
667667 };
0 commit comments