John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Mark Salyzyn | 96bf598 | 2016-09-28 16:15:30 -0700 | [diff] [blame] | 16 | |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 17 | #include "JankTracker.h" |
| 18 | |
Alec Mouri | 22d753f | 2019-09-05 17:11:45 -0700 | [diff] [blame] | 19 | #include <cutils/ashmem.h> |
John Reck | edc524c | 2015-03-18 15:24:33 -0700 | [diff] [blame] | 20 | #include <errno.h> |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 21 | #include <inttypes.h> |
Alec Mouri | 22d753f | 2019-09-05 17:11:45 -0700 | [diff] [blame] | 22 | #include <log/log.h> |
Yangster-mac | ba5bf0d | 2018-10-09 20:48:23 -0700 | [diff] [blame] | 23 | #include <statslog.h> |
Mark Salyzyn | 96bf598 | 2016-09-28 16:15:30 -0700 | [diff] [blame] | 24 | #include <sys/mman.h> |
Mark Salyzyn | 52eb4e0 | 2016-09-28 16:15:30 -0700 | [diff] [blame] | 25 | |
| 26 | #include <algorithm> |
John Reck | 5ed587f | 2016-03-24 15:57:01 -0700 | [diff] [blame] | 27 | #include <cmath> |
Mark Salyzyn | 52eb4e0 | 2016-09-28 16:15:30 -0700 | [diff] [blame] | 28 | #include <cstdio> |
| 29 | #include <limits> |
John Reck | 0e89ca2 | 2017-12-15 16:00:48 -0800 | [diff] [blame] | 30 | #include <sstream> |
Mark Salyzyn | 52eb4e0 | 2016-09-28 16:15:30 -0700 | [diff] [blame] | 31 | |
Alec Mouri | 22d753f | 2019-09-05 17:11:45 -0700 | [diff] [blame] | 32 | #include "DeviceInfo.h" |
Mark Salyzyn | 52eb4e0 | 2016-09-28 16:15:30 -0700 | [diff] [blame] | 33 | #include "Properties.h" |
| 34 | #include "utils/TimeUtils.h" |
John Reck | 0e89ca2 | 2017-12-15 16:00:48 -0800 | [diff] [blame] | 35 | #include "utils/Trace.h" |
Mark Salyzyn | 52eb4e0 | 2016-09-28 16:15:30 -0700 | [diff] [blame] | 36 | |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 37 | namespace android { |
| 38 | namespace uirenderer { |
| 39 | |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 40 | struct Comparison { |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 41 | JankType type; |
| 42 | std::function<int64_t(nsecs_t)> computeThreadshold; |
John Reck | c87be99 | 2015-02-20 10:57:22 -0800 | [diff] [blame] | 43 | FrameInfoIndex start; |
| 44 | FrameInfoIndex end; |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 45 | }; |
| 46 | |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 47 | static const std::array<Comparison, 4> COMPARISONS{ |
| 48 | Comparison{JankType::kMissedVsync, [](nsecs_t) { return 1; }, FrameInfoIndex::IntendedVsync, |
| 49 | FrameInfoIndex::Vsync}, |
| 50 | |
| 51 | Comparison{JankType::kSlowUI, |
| 52 | [](nsecs_t frameInterval) { return static_cast<int64_t>(.5 * frameInterval); }, |
| 53 | FrameInfoIndex::Vsync, FrameInfoIndex::SyncStart}, |
| 54 | |
| 55 | Comparison{JankType::kSlowSync, |
| 56 | [](nsecs_t frameInterval) { return static_cast<int64_t>(.2 * frameInterval); }, |
| 57 | FrameInfoIndex::SyncStart, FrameInfoIndex::IssueDrawCommandsStart}, |
| 58 | |
| 59 | Comparison{JankType::kSlowRT, |
| 60 | [](nsecs_t frameInterval) { return static_cast<int64_t>(.75 * frameInterval); }, |
| 61 | FrameInfoIndex::IssueDrawCommandsStart, FrameInfoIndex::FrameCompleted}, |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | // If the event exceeds 10 seconds throw it away, this isn't a jank event |
| 65 | // it's an ANR and will be handled as such |
| 66 | static const int64_t IGNORE_EXCEEDING = seconds_to_nanoseconds(10); |
| 67 | |
| 68 | /* |
John Reck | 6601080 | 2016-03-30 14:19:44 -0700 | [diff] [blame] | 69 | * We don't track direct-drawing via Surface:lockHardwareCanvas() |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 70 | * for now |
| 71 | * |
| 72 | * TODO: kSurfaceCanvas can negatively impact other drawing by using up |
| 73 | * time on the RenderThread, figure out how to attribute that as a jank-causer |
| 74 | */ |
John Reck | 6601080 | 2016-03-30 14:19:44 -0700 | [diff] [blame] | 75 | static const int64_t EXEMPT_FRAMES_FLAGS = FrameInfoFlags::SurfaceCanvas; |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 76 | |
John Reck | c7cd9cf | 2016-03-28 10:38:19 -0700 | [diff] [blame] | 77 | // For testing purposes to try and eliminate test infra overhead we will |
| 78 | // consider any unknown delay of frame start as part of the test infrastructure |
| 79 | // and filter it out of the frame profile data |
| 80 | static FrameInfoIndex sFrameStart = FrameInfoIndex::IntendedVsync; |
| 81 | |
Jorim Jaggi | 71db889 | 2021-02-03 23:19:29 +0100 | [diff] [blame] | 82 | JankTracker::JankTracker(ProfileDataContainer* globalData) |
| 83 | : mData(globalData->getDataMutex()) |
| 84 | , mDataMutex(globalData->getDataMutex()) { |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 85 | mGlobalData = globalData; |
Alec Mouri | 4a818f1 | 2019-11-19 16:17:53 -0800 | [diff] [blame] | 86 | nsecs_t frameIntervalNanos = DeviceInfo::getVsyncPeriod(); |
Alec Mouri | 22d753f | 2019-09-05 17:11:45 -0700 | [diff] [blame] | 87 | nsecs_t sfOffset = DeviceInfo::getCompositorOffset(); |
| 88 | nsecs_t offsetDelta = sfOffset - DeviceInfo::getAppOffset(); |
John Reck | 2d5b8d7 | 2016-07-28 15:36:11 -0700 | [diff] [blame] | 89 | // There are two different offset cases. If the offsetDelta is positive |
| 90 | // and small, then the intention is to give apps extra time by leveraging |
| 91 | // pipelining between the UI & RT threads. If the offsetDelta is large or |
| 92 | // negative, the intention is to subtract time from the total duration |
| 93 | // in which case we can't afford to wait for dequeueBuffer blockage. |
| 94 | if (offsetDelta <= 4_ms && offsetDelta >= 0) { |
| 95 | // SF will begin composition at VSYNC-app + offsetDelta. If we are triple |
| 96 | // buffered, this is the expected time at which dequeueBuffer will |
| 97 | // return due to the staggering of VSYNC-app & VSYNC-sf. |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 98 | mDequeueTimeForgivenessLegacy = offsetDelta + 4_ms; |
John Reck | 2d5b8d7 | 2016-07-28 15:36:11 -0700 | [diff] [blame] | 99 | } |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 100 | mFrameIntervalLegacy = frameIntervalNanos; |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 101 | } |
| 102 | |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 103 | void JankTracker::calculateLegacyJank(FrameInfo& frame) { |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 104 | // Fast-path for jank-free frames |
Jorim Jaggi | 0ac066d | 2021-02-24 16:28:47 +0100 | [diff] [blame] | 105 | int64_t totalDuration = frame.duration(sFrameStart, FrameInfoIndex::SwapBuffersCompleted); |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 106 | if (mDequeueTimeForgivenessLegacy && frame[FrameInfoIndex::DequeueBufferDuration] > 500_us) { |
| 107 | nsecs_t expectedDequeueDuration = mDequeueTimeForgivenessLegacy |
| 108 | + frame[FrameInfoIndex::Vsync] |
| 109 | - frame[FrameInfoIndex::IssueDrawCommandsStart]; |
John Reck | 2d5b8d7 | 2016-07-28 15:36:11 -0700 | [diff] [blame] | 110 | if (expectedDequeueDuration > 0) { |
| 111 | // Forgive only up to the expected amount, but not more than |
| 112 | // the actual time spent blocked. |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 113 | nsecs_t forgiveAmount = |
| 114 | std::min(expectedDequeueDuration, frame[FrameInfoIndex::DequeueBufferDuration]); |
John Reck | 1b7184f | 2017-03-27 14:47:46 -0700 | [diff] [blame] | 115 | LOG_ALWAYS_FATAL_IF(forgiveAmount >= totalDuration, |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 116 | "Impossible dequeue duration! dequeue duration reported %" PRId64 |
| 117 | ", total duration %" PRId64, |
| 118 | forgiveAmount, totalDuration); |
John Reck | 2d5b8d7 | 2016-07-28 15:36:11 -0700 | [diff] [blame] | 119 | totalDuration -= forgiveAmount; |
| 120 | } |
| 121 | } |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 122 | |
Jorim Jaggi | 71db889 | 2021-02-03 23:19:29 +0100 | [diff] [blame] | 123 | LOG_ALWAYS_FATAL_IF(totalDuration <= 0, "Impossible totalDuration %" PRId64 " start=%" PRIi64 |
| 124 | " gpuComplete=%" PRIi64, totalDuration, |
| 125 | frame[FrameInfoIndex::IntendedVsync], |
| 126 | frame[FrameInfoIndex::GpuCompleted]); |
| 127 | |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 128 | |
| 129 | // Only things like Surface.lockHardwareCanvas() are exempt from tracking |
| 130 | if (CC_UNLIKELY(frame[FrameInfoIndex::Flags] & EXEMPT_FRAMES_FLAGS)) { |
| 131 | return; |
| 132 | } |
| 133 | |
| 134 | if (totalDuration > mFrameIntervalLegacy) { |
| 135 | mData->reportJankLegacy(); |
| 136 | (*mGlobalData)->reportJankLegacy(); |
| 137 | } |
| 138 | |
| 139 | if (mSwapDeadlineLegacy < 0) { |
| 140 | mSwapDeadlineLegacy = frame[FrameInfoIndex::IntendedVsync] + mFrameIntervalLegacy; |
| 141 | } |
| 142 | bool isTripleBuffered = (mSwapDeadlineLegacy - frame[FrameInfoIndex::IntendedVsync]) |
| 143 | > (mFrameIntervalLegacy * 0.1); |
| 144 | |
| 145 | mSwapDeadlineLegacy = std::max(mSwapDeadlineLegacy + mFrameIntervalLegacy, |
| 146 | frame[FrameInfoIndex::IntendedVsync] + mFrameIntervalLegacy); |
| 147 | |
| 148 | // If we hit the deadline, cool! |
| 149 | if (frame[FrameInfoIndex::FrameCompleted] < mSwapDeadlineLegacy |
| 150 | || totalDuration < mFrameIntervalLegacy) { |
| 151 | if (isTripleBuffered) { |
| 152 | mData->reportJankType(JankType::kHighInputLatency); |
| 153 | (*mGlobalData)->reportJankType(JankType::kHighInputLatency); |
| 154 | } |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | mData->reportJankType(JankType::kMissedDeadlineLegacy); |
| 159 | (*mGlobalData)->reportJankType(JankType::kMissedDeadlineLegacy); |
| 160 | |
| 161 | // Janked, reset the swap deadline |
| 162 | nsecs_t jitterNanos = frame[FrameInfoIndex::FrameCompleted] - frame[FrameInfoIndex::Vsync]; |
| 163 | nsecs_t lastFrameOffset = jitterNanos % mFrameIntervalLegacy; |
| 164 | mSwapDeadlineLegacy = frame[FrameInfoIndex::FrameCompleted] |
| 165 | - lastFrameOffset + mFrameIntervalLegacy; |
| 166 | } |
| 167 | |
| 168 | void JankTracker::finishFrame(FrameInfo& frame, std::unique_ptr<FrameMetricsReporter>& reporter) { |
| 169 | std::lock_guard lock(mDataMutex); |
| 170 | |
| 171 | calculateLegacyJank(frame); |
| 172 | |
| 173 | // Fast-path for jank-free frames |
| 174 | int64_t totalDuration = frame.duration(FrameInfoIndex::IntendedVsync, |
| 175 | FrameInfoIndex::FrameCompleted); |
| 176 | |
| 177 | LOG_ALWAYS_FATAL_IF(totalDuration <= 0, "Impossible totalDuration %" PRId64, totalDuration); |
John Reck | 7075c79 | 2017-07-05 14:03:43 -0700 | [diff] [blame] | 178 | mData->reportFrame(totalDuration); |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 179 | (*mGlobalData)->reportFrame(totalDuration); |
John Reck | 7075c79 | 2017-07-05 14:03:43 -0700 | [diff] [blame] | 180 | |
John Reck | 6601080 | 2016-03-30 14:19:44 -0700 | [diff] [blame] | 181 | // Only things like Surface.lockHardwareCanvas() are exempt from tracking |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 182 | if (CC_UNLIKELY(frame[FrameInfoIndex::Flags] & EXEMPT_FRAMES_FLAGS)) { |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 183 | return; |
| 184 | } |
| 185 | |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 186 | int64_t frameInterval = frame[FrameInfoIndex::FrameInterval]; |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 187 | |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 188 | // If we starter earlier than the intended frame start assuming an unstuffed scenario, it means |
| 189 | // that we are in a triple buffering situation. |
| 190 | bool isTripleBuffered = (mNextFrameStartUnstuffed - frame[FrameInfoIndex::IntendedVsync]) |
| 191 | > (frameInterval * 0.1); |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 192 | |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 193 | int64_t deadline = frame[FrameInfoIndex::FrameDeadline]; |
| 194 | |
| 195 | // If we are in triple buffering, we have enough buffers in queue to sustain a single frame |
| 196 | // drop without jank, so adjust the frame interval to the deadline. |
| 197 | if (isTripleBuffered) { |
| 198 | deadline += frameInterval; |
| 199 | frame.set(FrameInfoIndex::FrameDeadline) += frameInterval; |
| 200 | } |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 201 | |
| 202 | // If we hit the deadline, cool! |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 203 | if (frame[FrameInfoIndex::GpuCompleted] < deadline) { |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 204 | if (isTripleBuffered) { |
| 205 | mData->reportJankType(JankType::kHighInputLatency); |
| 206 | (*mGlobalData)->reportJankType(JankType::kHighInputLatency); |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 207 | |
| 208 | // Buffer stuffing state gets carried over to next frame, unless there is a "pause" |
| 209 | mNextFrameStartUnstuffed += frameInterval; |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 210 | } |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 211 | } else { |
| 212 | mData->reportJankType(JankType::kMissedDeadline); |
| 213 | (*mGlobalData)->reportJankType(JankType::kMissedDeadline); |
| 214 | mData->reportJank(); |
| 215 | (*mGlobalData)->reportJank(); |
| 216 | |
| 217 | // Janked, store the adjust deadline to detect triple buffering in next frame correctly. |
| 218 | nsecs_t jitterNanos = frame[FrameInfoIndex::GpuCompleted] |
| 219 | - frame[FrameInfoIndex::Vsync]; |
| 220 | nsecs_t lastFrameOffset = jitterNanos % frameInterval; |
| 221 | |
| 222 | // Note the time when the next frame would start in an unstuffed situation. If it starts |
| 223 | // earlier, we are in a stuffed situation. |
| 224 | mNextFrameStartUnstuffed = frame[FrameInfoIndex::GpuCompleted] |
| 225 | - lastFrameOffset + frameInterval; |
| 226 | |
| 227 | recomputeThresholds(frameInterval); |
| 228 | for (auto& comparison : COMPARISONS) { |
| 229 | int64_t delta = frame.duration(comparison.start, comparison.end); |
| 230 | if (delta >= mThresholds[comparison.type] && delta < IGNORE_EXCEEDING) { |
| 231 | mData->reportJankType(comparison.type); |
| 232 | (*mGlobalData)->reportJankType(comparison.type); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | // Log daveys since they are weird and we don't know what they are (b/70339576) |
| 237 | if (totalDuration >= 700_ms) { |
| 238 | static int sDaveyCount = 0; |
| 239 | std::stringstream ss; |
| 240 | ss << "Davey! duration=" << ns2ms(totalDuration) << "ms; "; |
| 241 | for (size_t i = 0; i < static_cast<size_t>(FrameInfoIndex::NumIndexes); i++) { |
| 242 | ss << FrameInfoNames[i] << "=" << frame[i] << ", "; |
| 243 | } |
| 244 | ALOGI("%s", ss.str().c_str()); |
| 245 | // Just so we have something that counts up, the value is largely irrelevant |
| 246 | ATRACE_INT(ss.str().c_str(), ++sDaveyCount); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | int64_t totalGPUDrawTime = frame.gpuDrawTime(); |
| 251 | if (totalGPUDrawTime >= 0) { |
| 252 | mData->reportGPUFrame(totalGPUDrawTime); |
| 253 | (*mGlobalData)->reportGPUFrame(totalGPUDrawTime); |
| 254 | } |
| 255 | |
| 256 | if (CC_UNLIKELY(reporter.get() != nullptr)) { |
| 257 | reporter->reportFrameMetrics(frame.data(), false /* hasPresentTime */); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | void JankTracker::recomputeThresholds(int64_t frameBudget) { |
| 262 | if (mThresholdsFrameBudget == frameBudget) { |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 263 | return; |
| 264 | } |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 265 | mThresholdsFrameBudget = frameBudget; |
John Reck | 0e48647 | 2018-03-19 14:06:16 -0700 | [diff] [blame] | 266 | for (auto& comparison : COMPARISONS) { |
Jorim Jaggi | 10f328c | 2021-01-19 00:08:02 +0100 | [diff] [blame^] | 267 | mThresholds[comparison.type] = comparison.computeThreadshold(frameBudget); |
John Reck | 0e89ca2 | 2017-12-15 16:00:48 -0800 | [diff] [blame] | 268 | } |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 269 | } |
| 270 | |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 271 | void JankTracker::dumpData(int fd, const ProfileDataDescription* description, |
| 272 | const ProfileData* data) { |
Jorim Jaggi | 71db889 | 2021-02-03 23:19:29 +0100 | [diff] [blame] | 273 | |
John Reck | df1742e | 2017-01-19 15:56:21 -0800 | [diff] [blame] | 274 | if (description) { |
| 275 | switch (description->type) { |
| 276 | case JankTrackerType::Generic: |
| 277 | break; |
| 278 | case JankTrackerType::Package: |
| 279 | dprintf(fd, "\nPackage: %s", description->name.c_str()); |
| 280 | break; |
| 281 | case JankTrackerType::Window: |
| 282 | dprintf(fd, "\nWindow: %s", description->name.c_str()); |
| 283 | break; |
| 284 | } |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 285 | } |
John Reck | c7cd9cf | 2016-03-28 10:38:19 -0700 | [diff] [blame] | 286 | if (sFrameStart != FrameInfoIndex::IntendedVsync) { |
| 287 | dprintf(fd, "\nNote: Data has been filtered!"); |
| 288 | } |
John Reck | 7075c79 | 2017-07-05 14:03:43 -0700 | [diff] [blame] | 289 | data->dump(fd); |
John Reck | edc524c | 2015-03-18 15:24:33 -0700 | [diff] [blame] | 290 | dprintf(fd, "\n"); |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 291 | } |
| 292 | |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 293 | void JankTracker::dumpFrames(int fd) { |
John Reck | 47f5c3a | 2017-11-13 11:32:39 -0800 | [diff] [blame] | 294 | dprintf(fd, "\n\n---PROFILEDATA---\n"); |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 295 | for (size_t i = 0; i < static_cast<size_t>(FrameInfoIndex::NumIndexes); i++) { |
Siarhei Vishniakou | 4bcbffd | 2021-02-17 06:19:36 +0000 | [diff] [blame] | 296 | dprintf(fd, "%s", FrameInfoNames[i]); |
John Reck | 47f5c3a | 2017-11-13 11:32:39 -0800 | [diff] [blame] | 297 | dprintf(fd, ","); |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 298 | } |
| 299 | for (size_t i = 0; i < mFrames.size(); i++) { |
| 300 | FrameInfo& frame = mFrames[i]; |
| 301 | if (frame[FrameInfoIndex::SyncStart] == 0) { |
| 302 | continue; |
| 303 | } |
John Reck | 47f5c3a | 2017-11-13 11:32:39 -0800 | [diff] [blame] | 304 | dprintf(fd, "\n"); |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 305 | for (int i = 0; i < static_cast<int>(FrameInfoIndex::NumIndexes); i++) { |
John Reck | 47f5c3a | 2017-11-13 11:32:39 -0800 | [diff] [blame] | 306 | dprintf(fd, "%" PRId64 ",", frame[i]); |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 307 | } |
| 308 | } |
John Reck | 47f5c3a | 2017-11-13 11:32:39 -0800 | [diff] [blame] | 309 | dprintf(fd, "\n---PROFILEDATA---\n\n"); |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 310 | } |
| 311 | |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 312 | void JankTracker::reset() { |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 313 | mFrames.clear(); |
John Reck | 7075c79 | 2017-07-05 14:03:43 -0700 | [diff] [blame] | 314 | mData->reset(); |
John Reck | 34781b2 | 2017-07-05 16:39:36 -0700 | [diff] [blame] | 315 | (*mGlobalData)->reset(); |
John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 316 | sFrameStart = Properties::filterOutTestOverhead ? FrameInfoIndex::HandleInputStart |
| 317 | : FrameInfoIndex::IntendedVsync; |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 318 | } |
| 319 | |
John Reck | ba6adf6 | 2015-02-19 14:36:50 -0800 | [diff] [blame] | 320 | } /* namespace uirenderer */ |
| 321 | } /* namespace android */ |