| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright 2019 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 | */ | 
|  | 16 |  | 
| Ady Abraham | b0dbdaa | 2020-01-06 16:19:42 -0800 | [diff] [blame] | 17 | // TODO(b/129481165): remove the #pragma below and fix conversion issues | 
|  | 18 | #pragma clang diagnostic push | 
|  | 19 | #pragma clang diagnostic ignored "-Wconversion" | 
|  | 20 |  | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 21 | #define ATRACE_TAG ATRACE_TAG_GRAPHICS | 
|  | 22 | //#define LOG_NDEBUG 0 | 
|  | 23 | #include "VSyncPredictor.h" | 
|  | 24 | #include <android-base/logging.h> | 
| Ady Abraham | 5e7371c | 2020-03-24 14:47:24 -0700 | [diff] [blame] | 25 | #include <android-base/stringprintf.h> | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 26 | #include <cutils/compiler.h> | 
| Kevin DuBois | ecb1f0d | 2019-12-12 10:47:41 -0800 | [diff] [blame] | 27 | #include <cutils/properties.h> | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 28 | #include <utils/Log.h> | 
|  | 29 | #include <utils/Trace.h> | 
|  | 30 | #include <algorithm> | 
|  | 31 | #include <chrono> | 
| Kevin DuBois | 127a2d9 | 2019-12-04 13:52:52 -0800 | [diff] [blame] | 32 | #include <sstream> | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 33 |  | 
|  | 34 | namespace android::scheduler { | 
| Ady Abraham | 5e7371c | 2020-03-24 14:47:24 -0700 | [diff] [blame] | 35 | using base::StringAppendF; | 
| Kevin DuBois | ecb1f0d | 2019-12-12 10:47:41 -0800 | [diff] [blame] | 36 |  | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 37 | static auto constexpr kMaxPercent = 100u; | 
|  | 38 |  | 
|  | 39 | VSyncPredictor::~VSyncPredictor() = default; | 
|  | 40 |  | 
|  | 41 | VSyncPredictor::VSyncPredictor(nsecs_t idealPeriod, size_t historySize, | 
|  | 42 | size_t minimumSamplesForPrediction, uint32_t outlierTolerancePercent) | 
| Kevin DuBois | c57f2c3 | 2019-12-20 16:32:29 -0800 | [diff] [blame] | 43 | : mTraceOn(property_get_bool("debug.sf.vsp_trace", true)), | 
| Kevin DuBois | ecb1f0d | 2019-12-12 10:47:41 -0800 | [diff] [blame] | 44 | kHistorySize(historySize), | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 45 | kMinimumSamplesForPrediction(minimumSamplesForPrediction), | 
|  | 46 | kOutlierTolerancePercent(std::min(outlierTolerancePercent, kMaxPercent)), | 
|  | 47 | mIdealPeriod(idealPeriod) { | 
| Kevin DuBois | c3e9e8e | 2020-01-07 09:06:52 -0800 | [diff] [blame] | 48 | resetModel(); | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 49 | } | 
|  | 50 |  | 
| Kevin DuBois | ecb1f0d | 2019-12-12 10:47:41 -0800 | [diff] [blame] | 51 | inline void VSyncPredictor::traceInt64If(const char* name, int64_t value) const { | 
|  | 52 | if (CC_UNLIKELY(mTraceOn)) { | 
|  | 53 | ATRACE_INT64(name, value); | 
|  | 54 | } | 
|  | 55 | } | 
|  | 56 |  | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 57 | inline size_t VSyncPredictor::next(int i) const { | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 58 | return (i + 1) % mTimestamps.size(); | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 59 | } | 
|  | 60 |  | 
|  | 61 | bool VSyncPredictor::validate(nsecs_t timestamp) const { | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 62 | if (mLastTimestampIndex < 0 || mTimestamps.empty()) { | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 63 | return true; | 
|  | 64 | } | 
|  | 65 |  | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 66 | auto const aValidTimestamp = mTimestamps[mLastTimestampIndex]; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 67 | auto const percent = (timestamp - aValidTimestamp) % mIdealPeriod * kMaxPercent / mIdealPeriod; | 
|  | 68 | return percent < kOutlierTolerancePercent || percent > (kMaxPercent - kOutlierTolerancePercent); | 
|  | 69 | } | 
|  | 70 |  | 
| Kevin DuBois | 2fd3cea | 2019-11-14 08:52:45 -0800 | [diff] [blame] | 71 | nsecs_t VSyncPredictor::currentPeriod() const { | 
|  | 72 | std::lock_guard<std::mutex> lk(mMutex); | 
|  | 73 | return std::get<0>(mRateMap.find(mIdealPeriod)->second); | 
|  | 74 | } | 
|  | 75 |  | 
| Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 76 | bool VSyncPredictor::addVsyncTimestamp(nsecs_t timestamp) { | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 77 | std::lock_guard<std::mutex> lk(mMutex); | 
|  | 78 |  | 
|  | 79 | if (!validate(timestamp)) { | 
| Kevin DuBois | 241d0ee | 2020-06-26 17:00:15 -0700 | [diff] [blame] | 80 | // VSR could elect to ignore the incongruent timestamp or resetModel(). If ts is ignored, | 
|  | 81 | // don't insert this ts into mTimestamps ringbuffer. | 
|  | 82 | if (!mTimestamps.empty()) { | 
|  | 83 | mKnownTimestamp = | 
|  | 84 | std::max(timestamp, *std::max_element(mTimestamps.begin(), mTimestamps.end())); | 
|  | 85 | } else { | 
|  | 86 | mKnownTimestamp = timestamp; | 
|  | 87 | } | 
| Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 88 | return false; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 89 | } | 
|  | 90 |  | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 91 | if (mTimestamps.size() != kHistorySize) { | 
|  | 92 | mTimestamps.push_back(timestamp); | 
|  | 93 | mLastTimestampIndex = next(mLastTimestampIndex); | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 94 | } else { | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 95 | mLastTimestampIndex = next(mLastTimestampIndex); | 
|  | 96 | mTimestamps[mLastTimestampIndex] = timestamp; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 97 | } | 
|  | 98 |  | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 99 | if (mTimestamps.size() < kMinimumSamplesForPrediction) { | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 100 | mRateMap[mIdealPeriod] = {mIdealPeriod, 0}; | 
| Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 101 | return true; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 102 | } | 
|  | 103 |  | 
|  | 104 | // This is a 'simple linear regression' calculation of Y over X, with Y being the | 
|  | 105 | // vsync timestamps, and X being the ordinal of vsync count. | 
|  | 106 | // The calculated slope is the vsync period. | 
|  | 107 | // Formula for reference: | 
|  | 108 | // Sigma_i: means sum over all timestamps. | 
|  | 109 | // mean(variable): statistical mean of variable. | 
|  | 110 | // X: snapped ordinal of the timestamp | 
|  | 111 | // Y: vsync timestamp | 
|  | 112 | // | 
|  | 113 | //         Sigma_i( (X_i - mean(X)) * (Y_i - mean(Y) ) | 
|  | 114 | // slope = ------------------------------------------- | 
|  | 115 | //         Sigma_i ( X_i - mean(X) ) ^ 2 | 
|  | 116 | // | 
|  | 117 | // intercept = mean(Y) - slope * mean(X) | 
|  | 118 | // | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 119 | std::vector<nsecs_t> vsyncTS(mTimestamps.size()); | 
|  | 120 | std::vector<nsecs_t> ordinals(mTimestamps.size()); | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 121 |  | 
|  | 122 | // normalizing to the oldest timestamp cuts down on error in calculating the intercept. | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 123 | auto const oldest_ts = *std::min_element(mTimestamps.begin(), mTimestamps.end()); | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 124 | auto it = mRateMap.find(mIdealPeriod); | 
|  | 125 | auto const currentPeriod = std::get<0>(it->second); | 
|  | 126 | // TODO (b/144707443): its important that there's some precision in the mean of the ordinals | 
| Kevin DuBois | 0049f8b | 2020-03-11 10:30:11 -0700 | [diff] [blame] | 127 | //                     for the intercept calculation, so scale the ordinals by 1000 to continue | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 128 | //                     fixed point calculation. Explore expanding | 
|  | 129 | //                     scheduler::utils::calculate_mean to have a fixed point fractional part. | 
| Kevin DuBois | 0049f8b | 2020-03-11 10:30:11 -0700 | [diff] [blame] | 130 | static constexpr int64_t kScalingFactor = 1000; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 131 |  | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 132 | for (auto i = 0u; i < mTimestamps.size(); i++) { | 
|  | 133 | traceInt64If("VSP-ts", mTimestamps[i]); | 
| Kevin DuBois | ecb1f0d | 2019-12-12 10:47:41 -0800 | [diff] [blame] | 134 |  | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 135 | vsyncTS[i] = mTimestamps[i] - oldest_ts; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 136 | ordinals[i] = ((vsyncTS[i] + (currentPeriod / 2)) / currentPeriod) * kScalingFactor; | 
|  | 137 | } | 
|  | 138 |  | 
|  | 139 | auto meanTS = scheduler::calculate_mean(vsyncTS); | 
|  | 140 | auto meanOrdinal = scheduler::calculate_mean(ordinals); | 
|  | 141 | for (auto i = 0; i < vsyncTS.size(); i++) { | 
|  | 142 | vsyncTS[i] -= meanTS; | 
|  | 143 | ordinals[i] -= meanOrdinal; | 
|  | 144 | } | 
|  | 145 |  | 
|  | 146 | auto top = 0ll; | 
|  | 147 | auto bottom = 0ll; | 
|  | 148 | for (auto i = 0; i < vsyncTS.size(); i++) { | 
|  | 149 | top += vsyncTS[i] * ordinals[i]; | 
|  | 150 | bottom += ordinals[i] * ordinals[i]; | 
|  | 151 | } | 
|  | 152 |  | 
|  | 153 | if (CC_UNLIKELY(bottom == 0)) { | 
|  | 154 | it->second = {mIdealPeriod, 0}; | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 155 | clearTimestamps(); | 
| Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 156 | return false; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 157 | } | 
|  | 158 |  | 
| Kevin DuBois | 0049f8b | 2020-03-11 10:30:11 -0700 | [diff] [blame] | 159 | nsecs_t const anticipatedPeriod = top * kScalingFactor / bottom; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 160 | nsecs_t const intercept = meanTS - (anticipatedPeriod * meanOrdinal / kScalingFactor); | 
|  | 161 |  | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 162 | auto const percent = std::abs(anticipatedPeriod - mIdealPeriod) * kMaxPercent / mIdealPeriod; | 
|  | 163 | if (percent >= kOutlierTolerancePercent) { | 
|  | 164 | it->second = {mIdealPeriod, 0}; | 
|  | 165 | clearTimestamps(); | 
|  | 166 | return false; | 
|  | 167 | } | 
|  | 168 |  | 
| Kevin DuBois | ecb1f0d | 2019-12-12 10:47:41 -0800 | [diff] [blame] | 169 | traceInt64If("VSP-period", anticipatedPeriod); | 
|  | 170 | traceInt64If("VSP-intercept", intercept); | 
|  | 171 |  | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 172 | it->second = {anticipatedPeriod, intercept}; | 
|  | 173 |  | 
|  | 174 | ALOGV("model update ts: %" PRId64 " slope: %" PRId64 " intercept: %" PRId64, timestamp, | 
|  | 175 | anticipatedPeriod, intercept); | 
| Kevin DuBois | 02d5ed9 | 2020-01-27 11:05:46 -0800 | [diff] [blame] | 176 | return true; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 177 | } | 
|  | 178 |  | 
|  | 179 | nsecs_t VSyncPredictor::nextAnticipatedVSyncTimeFrom(nsecs_t timePoint) const { | 
|  | 180 | std::lock_guard<std::mutex> lk(mMutex); | 
|  | 181 |  | 
|  | 182 | auto const [slope, intercept] = getVSyncPredictionModel(lk); | 
|  | 183 |  | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 184 | if (mTimestamps.empty()) { | 
| Kevin DuBois | ecb1f0d | 2019-12-12 10:47:41 -0800 | [diff] [blame] | 185 | traceInt64If("VSP-mode", 1); | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 186 | auto const knownTimestamp = mKnownTimestamp ? *mKnownTimestamp : timePoint; | 
|  | 187 | auto const numPeriodsOut = ((timePoint - knownTimestamp) / mIdealPeriod) + 1; | 
|  | 188 | return knownTimestamp + numPeriodsOut * mIdealPeriod; | 
|  | 189 | } | 
|  | 190 |  | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 191 | auto const oldest = *std::min_element(mTimestamps.begin(), mTimestamps.end()); | 
| Kevin DuBois | 127a2d9 | 2019-12-04 13:52:52 -0800 | [diff] [blame] | 192 |  | 
|  | 193 | // See b/145667109, the ordinal calculation must take into account the intercept. | 
|  | 194 | auto const zeroPoint = oldest + intercept; | 
|  | 195 | auto const ordinalRequest = (timePoint - zeroPoint + slope) / slope; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 196 | auto const prediction = (ordinalRequest * slope) + intercept + oldest; | 
|  | 197 |  | 
| Kevin DuBois | ecb1f0d | 2019-12-12 10:47:41 -0800 | [diff] [blame] | 198 | traceInt64If("VSP-mode", 0); | 
|  | 199 | traceInt64If("VSP-timePoint", timePoint); | 
|  | 200 | traceInt64If("VSP-prediction", prediction); | 
|  | 201 |  | 
| Kevin DuBois | 127a2d9 | 2019-12-04 13:52:52 -0800 | [diff] [blame] | 202 | auto const printer = [&, slope = slope, intercept = intercept] { | 
|  | 203 | std::stringstream str; | 
|  | 204 | str << "prediction made from: " << timePoint << "prediction: " << prediction << " (+" | 
|  | 205 | << prediction - timePoint << ") slope: " << slope << " intercept: " << intercept | 
|  | 206 | << "oldestTS: " << oldest << " ordinal: " << ordinalRequest; | 
|  | 207 | return str.str(); | 
|  | 208 | }; | 
|  | 209 |  | 
|  | 210 | ALOGV("%s", printer().c_str()); | 
|  | 211 | LOG_ALWAYS_FATAL_IF(prediction < timePoint, "VSyncPredictor: model miscalculation: %s", | 
|  | 212 | printer().c_str()); | 
|  | 213 |  | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 214 | return prediction; | 
|  | 215 | } | 
|  | 216 |  | 
|  | 217 | std::tuple<nsecs_t, nsecs_t> VSyncPredictor::getVSyncPredictionModel() const { | 
|  | 218 | std::lock_guard<std::mutex> lk(mMutex); | 
|  | 219 | return VSyncPredictor::getVSyncPredictionModel(lk); | 
|  | 220 | } | 
|  | 221 |  | 
|  | 222 | std::tuple<nsecs_t, nsecs_t> VSyncPredictor::getVSyncPredictionModel( | 
|  | 223 | std::lock_guard<std::mutex> const&) const { | 
|  | 224 | return mRateMap.find(mIdealPeriod)->second; | 
|  | 225 | } | 
|  | 226 |  | 
|  | 227 | void VSyncPredictor::setPeriod(nsecs_t period) { | 
|  | 228 | ATRACE_CALL(); | 
|  | 229 |  | 
|  | 230 | std::lock_guard<std::mutex> lk(mMutex); | 
|  | 231 | static constexpr size_t kSizeLimit = 30; | 
|  | 232 | if (CC_UNLIKELY(mRateMap.size() == kSizeLimit)) { | 
|  | 233 | mRateMap.erase(mRateMap.begin()); | 
|  | 234 | } | 
|  | 235 |  | 
|  | 236 | mIdealPeriod = period; | 
|  | 237 | if (mRateMap.find(period) == mRateMap.end()) { | 
|  | 238 | mRateMap[mIdealPeriod] = {period, 0}; | 
|  | 239 | } | 
|  | 240 |  | 
| Kevin DuBois | c3e9e8e | 2020-01-07 09:06:52 -0800 | [diff] [blame] | 241 | clearTimestamps(); | 
|  | 242 | } | 
|  | 243 |  | 
|  | 244 | void VSyncPredictor::clearTimestamps() { | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 245 | if (!mTimestamps.empty()) { | 
| Kevin DuBois | 241d0ee | 2020-06-26 17:00:15 -0700 | [diff] [blame] | 246 | auto const maxRb = *std::max_element(mTimestamps.begin(), mTimestamps.end()); | 
|  | 247 | if (mKnownTimestamp) { | 
|  | 248 | mKnownTimestamp = std::max(*mKnownTimestamp, maxRb); | 
|  | 249 | } else { | 
|  | 250 | mKnownTimestamp = maxRb; | 
|  | 251 | } | 
|  | 252 |  | 
| Ady Abraham | 92fa2f4 | 2020-02-11 15:33:56 -0800 | [diff] [blame] | 253 | mTimestamps.clear(); | 
|  | 254 | mLastTimestampIndex = 0; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 255 | } | 
|  | 256 | } | 
|  | 257 |  | 
| Kevin DuBois | bc7ddff | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 258 | bool VSyncPredictor::needsMoreSamples() const { | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 259 | std::lock_guard<std::mutex> lk(mMutex); | 
| Kevin DuBois | bc7ddff | 2020-07-10 14:29:36 -0700 | [diff] [blame] | 260 | return mTimestamps.size() < kMinimumSamplesForPrediction; | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 261 | } | 
|  | 262 |  | 
| Kevin DuBois | c3e9e8e | 2020-01-07 09:06:52 -0800 | [diff] [blame] | 263 | void VSyncPredictor::resetModel() { | 
|  | 264 | std::lock_guard<std::mutex> lk(mMutex); | 
|  | 265 | mRateMap[mIdealPeriod] = {mIdealPeriod, 0}; | 
|  | 266 | clearTimestamps(); | 
|  | 267 | } | 
|  | 268 |  | 
| Ady Abraham | 5e7371c | 2020-03-24 14:47:24 -0700 | [diff] [blame] | 269 | void VSyncPredictor::dump(std::string& result) const { | 
|  | 270 | std::lock_guard<std::mutex> lk(mMutex); | 
|  | 271 | StringAppendF(&result, "\tmIdealPeriod=%.2f\n", mIdealPeriod / 1e6f); | 
|  | 272 | StringAppendF(&result, "\tRefresh Rate Map:\n"); | 
|  | 273 | for (const auto& [idealPeriod, periodInterceptTuple] : mRateMap) { | 
|  | 274 | StringAppendF(&result, | 
|  | 275 | "\t\tFor ideal period %.2fms: period = %.2fms, intercept = %" PRId64 "\n", | 
|  | 276 | idealPeriod / 1e6f, std::get<0>(periodInterceptTuple) / 1e6f, | 
|  | 277 | std::get<1>(periodInterceptTuple)); | 
|  | 278 | } | 
|  | 279 | } | 
|  | 280 |  | 
| Kevin DuBois | 1678e2c | 2019-08-22 12:26:24 -0700 | [diff] [blame] | 281 | } // namespace android::scheduler | 
| Ady Abraham | b0dbdaa | 2020-01-06 16:19:42 -0800 | [diff] [blame] | 282 |  | 
|  | 283 | // TODO(b/129481165): remove the #pragma below and fix conversion issues | 
|  | 284 | #pragma clang diagnostic pop // ignored "-Wconversion" |