From 1b7184f8d206505804042833a3825a3b8a9649dc Mon Sep 17 00:00:00 2001 From: John Reck Date: Mon, 27 Mar 2017 14:47:46 -0700 Subject: Add a few asserts for possible corruption cases Bug: 36502346 Test: builds & boots Change-Id: Id96a26a30e4a8c6f51a68bf07cfe6bd6d07c244e --- libs/hwui/JankTracker.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libs/hwui/JankTracker.cpp') diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp index 7be71eec4f76..8126d57a3a79 100644 --- a/libs/hwui/JankTracker.cpp +++ b/libs/hwui/JankTracker.cpp @@ -264,10 +264,15 @@ void JankTracker::addFrame(const FrameInfo& frame) { // the actual time spent blocked. nsecs_t forgiveAmount = std::min(expectedDequeueDuration, frame[FrameInfoIndex::DequeueBufferDuration]); + LOG_ALWAYS_FATAL_IF(forgiveAmount >= totalDuration, + "Impossible dequeue duration! dequeue duration reported %" PRId64 + ", total duration %" PRId64, forgiveAmount, totalDuration); totalDuration -= forgiveAmount; } } + LOG_ALWAYS_FATAL_IF(totalDuration <= 0, "Impossible totalDuration %" PRId64, totalDuration); uint32_t framebucket = frameCountIndexForFrameTime(totalDuration); + LOG_ALWAYS_FATAL_IF(framebucket < 0, "framebucket < 0 (%u)", framebucket); // Keep the fast path as fast as possible. if (CC_LIKELY(totalDuration < mFrameInterval)) { mData->frameCounts[framebucket]++; -- cgit v1.2.3-59-g8ed1b