Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 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 | |
| 17 | #define LOG_TAG "perf_hint" |
| 18 | |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 19 | #include <aidl/android/hardware/power/SessionHint.h> |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 20 | #include <aidl/android/hardware/power/SessionMode.h> |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 21 | #include <aidl/android/hardware/power/SessionTag.h> |
| 22 | #include <aidl/android/hardware/power/WorkDuration.h> |
| 23 | #include <aidl/android/os/IHintManager.h> |
| 24 | #include <aidl/android/os/IHintSession.h> |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 25 | #include <android-base/stringprintf.h> |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 26 | #include <android/binder_manager.h> |
| 27 | #include <android/binder_status.h> |
Bo Liu | 2b739bb | 2021-11-10 19:20:03 -0500 | [diff] [blame] | 28 | #include <android/performance_hint.h> |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 29 | #include <android/trace.h> |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 30 | #include <inttypes.h> |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 31 | #include <performance_hint_private.h> |
| 32 | #include <utils/SystemClock.h> |
| 33 | |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 34 | #include <chrono> |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 35 | #include <set> |
Bo Liu | 2b739bb | 2021-11-10 19:20:03 -0500 | [diff] [blame] | 36 | #include <utility> |
| 37 | #include <vector> |
| 38 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 39 | using namespace android; |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 40 | using namespace aidl::android::os; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 41 | |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 42 | using namespace std::chrono_literals; |
| 43 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 44 | using HalSessionHint = aidl::android::hardware::power::SessionHint; |
| 45 | using HalSessionMode = aidl::android::hardware::power::SessionMode; |
| 46 | using HalWorkDuration = aidl::android::hardware::power::WorkDuration; |
| 47 | |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 48 | using android::base::StringPrintf; |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 49 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 50 | struct APerformanceHintSession; |
| 51 | |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 52 | constexpr int64_t SEND_HINT_TIMEOUT = std::chrono::nanoseconds(100ms).count(); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 53 | struct AWorkDuration : public HalWorkDuration {}; |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 54 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 55 | struct APerformanceHintManager { |
| 56 | public: |
| 57 | static APerformanceHintManager* getInstance(); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 58 | APerformanceHintManager(std::shared_ptr<IHintManager> service, int64_t preferredRateNanos); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 59 | APerformanceHintManager() = delete; |
| 60 | ~APerformanceHintManager() = default; |
| 61 | |
| 62 | APerformanceHintSession* createSession(const int32_t* threadIds, size_t size, |
| 63 | int64_t initialTargetWorkDurationNanos); |
| 64 | int64_t getPreferredRateNanos() const; |
| 65 | |
| 66 | private: |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 67 | // Necessary to create an empty binder object |
| 68 | static void* tokenStubOnCreate(void*) { |
| 69 | return nullptr; |
| 70 | } |
| 71 | static void tokenStubOnDestroy(void*) {} |
| 72 | static binder_status_t tokenStubOnTransact(AIBinder*, transaction_code_t, const AParcel*, |
| 73 | AParcel*) { |
| 74 | return STATUS_OK; |
| 75 | } |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 76 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 77 | static APerformanceHintManager* create(std::shared_ptr<IHintManager> iHintManager); |
| 78 | |
| 79 | std::shared_ptr<IHintManager> mHintManager; |
| 80 | ndk::SpAIBinder mToken; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 81 | const int64_t mPreferredRateNanos; |
| 82 | }; |
| 83 | |
| 84 | struct APerformanceHintSession { |
| 85 | public: |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 86 | APerformanceHintSession(std::shared_ptr<IHintManager> hintManager, |
| 87 | std::shared_ptr<IHintSession> session, int64_t preferredRateNanos, |
| 88 | int64_t targetDurationNanos); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 89 | APerformanceHintSession() = delete; |
| 90 | ~APerformanceHintSession(); |
| 91 | |
| 92 | int updateTargetWorkDuration(int64_t targetDurationNanos); |
| 93 | int reportActualWorkDuration(int64_t actualDurationNanos); |
Steven Moreland | 42a8cce | 2023-03-03 23:31:17 +0000 | [diff] [blame] | 94 | int sendHint(SessionHint hint); |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 95 | int setThreads(const int32_t* threadIds, size_t size); |
| 96 | int getThreadIds(int32_t* const threadIds, size_t* size); |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 97 | int setPreferPowerEfficiency(bool enabled); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 98 | int reportActualWorkDuration(AWorkDuration* workDuration); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 99 | |
| 100 | private: |
| 101 | friend struct APerformanceHintManager; |
| 102 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 103 | int reportActualWorkDurationInternal(AWorkDuration* workDuration); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 104 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 105 | std::shared_ptr<IHintManager> mHintManager; |
| 106 | std::shared_ptr<IHintSession> mHintSession; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 107 | // HAL preferred update rate |
| 108 | const int64_t mPreferredRateNanos; |
| 109 | // Target duration for choosing update rate |
| 110 | int64_t mTargetDurationNanos; |
Wei Wang | 00feb50 | 2022-10-18 10:56:59 -0700 | [diff] [blame] | 111 | // First target hit timestamp |
| 112 | int64_t mFirstTargetMetTimestamp; |
| 113 | // Last target hit timestamp |
| 114 | int64_t mLastTargetMetTimestamp; |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 115 | // Last hint reported from sendHint indexed by hint value |
| 116 | std::vector<int64_t> mLastHintSentTimestamp; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 117 | // Cached samples |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 118 | std::vector<HalWorkDuration> mActualWorkDurations; |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 119 | std::string mSessionName; |
| 120 | static int32_t sIDCounter; |
| 121 | // The most recent set of thread IDs |
| 122 | std::vector<int32_t> mLastThreadIDs; |
| 123 | // Tracing helpers |
| 124 | void traceThreads(std::vector<int32_t>& tids); |
| 125 | void tracePowerEfficient(bool powerEfficient); |
| 126 | void traceActualDuration(int64_t actualDuration); |
| 127 | void traceBatchSize(size_t batchSize); |
| 128 | void traceTargetDuration(int64_t targetDuration); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 129 | }; |
| 130 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 131 | static std::shared_ptr<IHintManager>* gIHintManagerForTesting = nullptr; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 132 | static APerformanceHintManager* gHintManagerForTesting = nullptr; |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 133 | int32_t APerformanceHintSession::sIDCounter = 0; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 134 | |
| 135 | // ===================================== APerformanceHintManager implementation |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 136 | APerformanceHintManager::APerformanceHintManager(std::shared_ptr<IHintManager> manager, |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 137 | int64_t preferredRateNanos) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 138 | : mHintManager(std::move(manager)), mPreferredRateNanos(preferredRateNanos) { |
| 139 | static AIBinder_Class* tokenBinderClass = |
| 140 | AIBinder_Class_define("phm_token", tokenStubOnCreate, tokenStubOnDestroy, |
| 141 | tokenStubOnTransact); |
| 142 | mToken = ndk::SpAIBinder(AIBinder_new(tokenBinderClass, nullptr)); |
| 143 | } |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 144 | |
| 145 | APerformanceHintManager* APerformanceHintManager::getInstance() { |
| 146 | if (gHintManagerForTesting) return gHintManagerForTesting; |
| 147 | if (gIHintManagerForTesting) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 148 | APerformanceHintManager* manager = create(*gIHintManagerForTesting); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 149 | gIHintManagerForTesting = nullptr; |
| 150 | return manager; |
| 151 | } |
| 152 | static APerformanceHintManager* instance = create(nullptr); |
| 153 | return instance; |
| 154 | } |
| 155 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 156 | APerformanceHintManager* APerformanceHintManager::create(std::shared_ptr<IHintManager> manager) { |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 157 | if (!manager) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 158 | manager = IHintManager::fromBinder( |
| 159 | ndk::SpAIBinder(AServiceManager_waitForService("performance_hint"))); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 160 | } |
| 161 | if (manager == nullptr) { |
| 162 | ALOGE("%s: PerformanceHint service is not ready ", __FUNCTION__); |
| 163 | return nullptr; |
| 164 | } |
| 165 | int64_t preferredRateNanos = -1L; |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 166 | ndk::ScopedAStatus ret = manager->getHintSessionPreferredRate(&preferredRateNanos); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 167 | if (!ret.isOk()) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 168 | ALOGE("%s: PerformanceHint cannot get preferred rate. %s", __FUNCTION__, ret.getMessage()); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 169 | return nullptr; |
| 170 | } |
| 171 | if (preferredRateNanos <= 0) { |
Bo Liu | d6a0960 | 2021-07-26 14:48:41 -0400 | [diff] [blame] | 172 | preferredRateNanos = -1L; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 173 | } |
| 174 | return new APerformanceHintManager(std::move(manager), preferredRateNanos); |
| 175 | } |
| 176 | |
| 177 | APerformanceHintSession* APerformanceHintManager::createSession( |
| 178 | const int32_t* threadIds, size_t size, int64_t initialTargetWorkDurationNanos) { |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 179 | std::vector<int32_t> tids(threadIds, threadIds + size); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 180 | std::shared_ptr<IHintSession> session; |
| 181 | ndk::ScopedAStatus ret = |
Bo Liu | 9acc558 | 2022-02-17 16:47:32 -0500 | [diff] [blame] | 182 | mHintManager->createHintSession(mToken, tids, initialTargetWorkDurationNanos, &session); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 183 | if (!ret.isOk() || !session) { |
| 184 | return nullptr; |
| 185 | } |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 186 | auto out = new APerformanceHintSession(mHintManager, std::move(session), mPreferredRateNanos, |
| 187 | initialTargetWorkDurationNanos); |
| 188 | out->traceThreads(tids); |
| 189 | out->traceTargetDuration(initialTargetWorkDurationNanos); |
| 190 | out->tracePowerEfficient(false); |
| 191 | return out; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | int64_t APerformanceHintManager::getPreferredRateNanos() const { |
| 195 | return mPreferredRateNanos; |
| 196 | } |
| 197 | |
| 198 | // ===================================== APerformanceHintSession implementation |
| 199 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 200 | APerformanceHintSession::APerformanceHintSession(std::shared_ptr<IHintManager> hintManager, |
| 201 | std::shared_ptr<IHintSession> session, |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 202 | int64_t preferredRateNanos, |
| 203 | int64_t targetDurationNanos) |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 204 | : mHintManager(hintManager), |
| 205 | mHintSession(std::move(session)), |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 206 | mPreferredRateNanos(preferredRateNanos), |
| 207 | mTargetDurationNanos(targetDurationNanos), |
Wei Wang | 00feb50 | 2022-10-18 10:56:59 -0700 | [diff] [blame] | 208 | mFirstTargetMetTimestamp(0), |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 209 | mLastTargetMetTimestamp(0) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 210 | const std::vector<HalSessionHint> sessionHintRange{ndk::enum_range<HalSessionHint>().begin(), |
| 211 | ndk::enum_range<HalSessionHint>().end()}; |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 212 | |
| 213 | mLastHintSentTimestamp = std::vector<int64_t>(sessionHintRange.size(), 0); |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 214 | mSessionName = android::base::StringPrintf("ADPF Session %" PRId32, ++sIDCounter); |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 215 | } |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 216 | |
| 217 | APerformanceHintSession::~APerformanceHintSession() { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 218 | ndk::ScopedAStatus ret = mHintSession->close(); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 219 | if (!ret.isOk()) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 220 | ALOGE("%s: HintSession close failed: %s", __FUNCTION__, ret.getMessage()); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 221 | } |
| 222 | } |
| 223 | |
| 224 | int APerformanceHintSession::updateTargetWorkDuration(int64_t targetDurationNanos) { |
| 225 | if (targetDurationNanos <= 0) { |
| 226 | ALOGE("%s: targetDurationNanos must be positive", __FUNCTION__); |
| 227 | return EINVAL; |
| 228 | } |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 229 | ndk::ScopedAStatus ret = mHintSession->updateTargetWorkDuration(targetDurationNanos); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 230 | if (!ret.isOk()) { |
Matt Buckley | 354cc0a | 2022-09-28 20:54:46 +0000 | [diff] [blame] | 231 | ALOGE("%s: HintSession updateTargetWorkDuration failed: %s", __FUNCTION__, |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 232 | ret.getMessage()); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 233 | return EPIPE; |
| 234 | } |
| 235 | mTargetDurationNanos = targetDurationNanos; |
| 236 | /** |
| 237 | * Most of the workload is target_duration dependent, so now clear the cached samples |
| 238 | * as they are most likely obsolete. |
| 239 | */ |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 240 | mActualWorkDurations.clear(); |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 241 | traceBatchSize(0); |
| 242 | traceTargetDuration(targetDurationNanos); |
Wei Wang | 00feb50 | 2022-10-18 10:56:59 -0700 | [diff] [blame] | 243 | mFirstTargetMetTimestamp = 0; |
| 244 | mLastTargetMetTimestamp = 0; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 245 | return 0; |
| 246 | } |
| 247 | |
| 248 | int APerformanceHintSession::reportActualWorkDuration(int64_t actualDurationNanos) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 249 | HalWorkDuration workDuration{.durationNanos = actualDurationNanos, |
| 250 | .workPeriodStartTimestampNanos = 0, |
| 251 | .cpuDurationNanos = actualDurationNanos, |
| 252 | .gpuDurationNanos = 0}; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 253 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 254 | return reportActualWorkDurationInternal(static_cast<AWorkDuration*>(&workDuration)); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 255 | } |
| 256 | |
Steven Moreland | 42a8cce | 2023-03-03 23:31:17 +0000 | [diff] [blame] | 257 | int APerformanceHintSession::sendHint(SessionHint hint) { |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 258 | if (hint < 0 || hint >= static_cast<int32_t>(mLastHintSentTimestamp.size())) { |
| 259 | ALOGE("%s: invalid session hint %d", __FUNCTION__, hint); |
Matt Buckley | 354cc0a | 2022-09-28 20:54:46 +0000 | [diff] [blame] | 260 | return EINVAL; |
| 261 | } |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 262 | int64_t now = uptimeNanos(); |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 263 | |
| 264 | // Limit sendHint to a pre-detemined rate for safety |
| 265 | if (now < (mLastHintSentTimestamp[hint] + SEND_HINT_TIMEOUT)) { |
| 266 | return 0; |
| 267 | } |
Matt Buckley | 354cc0a | 2022-09-28 20:54:46 +0000 | [diff] [blame] | 268 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 269 | ndk::ScopedAStatus ret = mHintSession->sendHint(hint); |
Matt Buckley | 354cc0a | 2022-09-28 20:54:46 +0000 | [diff] [blame] | 270 | |
| 271 | if (!ret.isOk()) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 272 | ALOGE("%s: HintSession sendHint failed: %s", __FUNCTION__, ret.getMessage()); |
Matt Buckley | 354cc0a | 2022-09-28 20:54:46 +0000 | [diff] [blame] | 273 | return EPIPE; |
| 274 | } |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 275 | mLastHintSentTimestamp[hint] = now; |
Matt Buckley | 354cc0a | 2022-09-28 20:54:46 +0000 | [diff] [blame] | 276 | return 0; |
| 277 | } |
| 278 | |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 279 | int APerformanceHintSession::setThreads(const int32_t* threadIds, size_t size) { |
| 280 | if (size == 0) { |
| 281 | ALOGE("%s: the list of thread ids must not be empty.", __FUNCTION__); |
| 282 | return EINVAL; |
| 283 | } |
| 284 | std::vector<int32_t> tids(threadIds, threadIds + size); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 285 | ndk::ScopedAStatus ret = mHintManager->setHintSessionThreads(mHintSession, tids); |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 286 | if (!ret.isOk()) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 287 | ALOGE("%s: failed: %s", __FUNCTION__, ret.getMessage()); |
| 288 | if (ret.getExceptionCode() == EX_ILLEGAL_ARGUMENT) { |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 289 | return EINVAL; |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 290 | } else if (ret.getExceptionCode() == EX_SECURITY) { |
Xiang Wang | bee6f16 | 2023-07-18 17:58:10 -0700 | [diff] [blame] | 291 | return EPERM; |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 292 | } |
| 293 | return EPIPE; |
| 294 | } |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 295 | |
| 296 | traceThreads(tids); |
| 297 | |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 298 | return 0; |
| 299 | } |
| 300 | |
| 301 | int APerformanceHintSession::getThreadIds(int32_t* const threadIds, size_t* size) { |
| 302 | std::vector<int32_t> tids; |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 303 | ndk::ScopedAStatus ret = mHintManager->getHintSessionThreadIds(mHintSession, &tids); |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 304 | if (!ret.isOk()) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 305 | ALOGE("%s: failed: %s", __FUNCTION__, ret.getMessage()); |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 306 | return EPIPE; |
| 307 | } |
| 308 | |
| 309 | // When threadIds is nullptr, this is the first call to determine the size |
| 310 | // of the thread ids list. |
| 311 | if (threadIds == nullptr) { |
| 312 | *size = tids.size(); |
| 313 | return 0; |
| 314 | } |
| 315 | |
| 316 | // Second call to return the actual list of thread ids. |
| 317 | *size = tids.size(); |
| 318 | for (size_t i = 0; i < *size; ++i) { |
| 319 | threadIds[i] = tids[i]; |
| 320 | } |
| 321 | return 0; |
| 322 | } |
| 323 | |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 324 | int APerformanceHintSession::setPreferPowerEfficiency(bool enabled) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 325 | ndk::ScopedAStatus ret = |
| 326 | mHintSession->setMode(static_cast<int32_t>(HalSessionMode::POWER_EFFICIENCY), enabled); |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 327 | |
| 328 | if (!ret.isOk()) { |
| 329 | ALOGE("%s: HintSession setPreferPowerEfficiency failed: %s", __FUNCTION__, |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 330 | ret.getMessage()); |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 331 | return EPIPE; |
| 332 | } |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 333 | tracePowerEfficient(enabled); |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 334 | return OK; |
| 335 | } |
| 336 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 337 | int APerformanceHintSession::reportActualWorkDuration(AWorkDuration* workDuration) { |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 338 | return reportActualWorkDurationInternal(workDuration); |
| 339 | } |
| 340 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 341 | int APerformanceHintSession::reportActualWorkDurationInternal(AWorkDuration* workDuration) { |
| 342 | int64_t actualTotalDurationNanos = workDuration->durationNanos; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 343 | int64_t now = uptimeNanos(); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 344 | workDuration->timeStampNanos = now; |
| 345 | traceActualDuration(workDuration->durationNanos); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 346 | mActualWorkDurations.push_back(std::move(*workDuration)); |
| 347 | |
| 348 | if (actualTotalDurationNanos >= mTargetDurationNanos) { |
| 349 | // Reset timestamps if we are equal or over the target. |
| 350 | mFirstTargetMetTimestamp = 0; |
| 351 | } else { |
| 352 | // Set mFirstTargetMetTimestamp for first time meeting target. |
| 353 | if (!mFirstTargetMetTimestamp || !mLastTargetMetTimestamp || |
| 354 | (now - mLastTargetMetTimestamp > 2 * mPreferredRateNanos)) { |
| 355 | mFirstTargetMetTimestamp = now; |
| 356 | } |
| 357 | /** |
| 358 | * Rate limit the change if the update is over mPreferredRateNanos since first |
| 359 | * meeting target and less than mPreferredRateNanos since last meeting target. |
| 360 | */ |
| 361 | if (now - mFirstTargetMetTimestamp > mPreferredRateNanos && |
| 362 | now - mLastTargetMetTimestamp <= mPreferredRateNanos) { |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 363 | traceBatchSize(mActualWorkDurations.size()); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 364 | return 0; |
| 365 | } |
| 366 | mLastTargetMetTimestamp = now; |
| 367 | } |
| 368 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 369 | ndk::ScopedAStatus ret = mHintSession->reportActualWorkDuration2(mActualWorkDurations); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 370 | if (!ret.isOk()) { |
| 371 | ALOGE("%s: HintSession reportActualWorkDuration failed: %s", __FUNCTION__, |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 372 | ret.getMessage()); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 373 | mFirstTargetMetTimestamp = 0; |
| 374 | mLastTargetMetTimestamp = 0; |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 375 | traceBatchSize(mActualWorkDurations.size()); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 376 | return ret.getExceptionCode() == EX_ILLEGAL_ARGUMENT ? EINVAL : EPIPE; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 377 | } |
| 378 | mActualWorkDurations.clear(); |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 379 | traceBatchSize(0); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 380 | |
| 381 | return 0; |
| 382 | } |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 383 | // ===================================== Tracing helpers |
| 384 | |
| 385 | void APerformanceHintSession::traceThreads(std::vector<int32_t>& tids) { |
| 386 | std::set<int32_t> tidSet{tids.begin(), tids.end()}; |
| 387 | |
| 388 | // Disable old TID tracing |
| 389 | for (int32_t tid : mLastThreadIDs) { |
| 390 | if (!tidSet.count(tid)) { |
| 391 | std::string traceName = |
| 392 | android::base::StringPrintf("%s TID: %" PRId32, mSessionName.c_str(), tid); |
| 393 | ATrace_setCounter(traceName.c_str(), 0); |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | // Add new TID tracing |
| 398 | for (int32_t tid : tids) { |
| 399 | std::string traceName = |
| 400 | android::base::StringPrintf("%s TID: %" PRId32, mSessionName.c_str(), tid); |
| 401 | ATrace_setCounter(traceName.c_str(), 1); |
| 402 | } |
| 403 | |
| 404 | mLastThreadIDs = std::move(tids); |
| 405 | } |
| 406 | |
| 407 | void APerformanceHintSession::tracePowerEfficient(bool powerEfficient) { |
| 408 | ATrace_setCounter((mSessionName + " power efficiency mode").c_str(), powerEfficient); |
| 409 | } |
| 410 | |
| 411 | void APerformanceHintSession::traceActualDuration(int64_t actualDuration) { |
| 412 | ATrace_setCounter((mSessionName + " actual duration").c_str(), actualDuration); |
| 413 | } |
| 414 | |
| 415 | void APerformanceHintSession::traceBatchSize(size_t batchSize) { |
| 416 | std::string traceName = StringPrintf("%s batch size", mSessionName.c_str()); |
| 417 | ATrace_setCounter((mSessionName + " batch size").c_str(), batchSize); |
| 418 | } |
| 419 | |
| 420 | void APerformanceHintSession::traceTargetDuration(int64_t targetDuration) { |
| 421 | ATrace_setCounter((mSessionName + " target duration").c_str(), targetDuration); |
| 422 | } |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 423 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 424 | // ===================================== C API |
| 425 | APerformanceHintManager* APerformanceHint_getManager() { |
| 426 | return APerformanceHintManager::getInstance(); |
| 427 | } |
| 428 | |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 429 | #define VALIDATE_PTR(ptr) \ |
| 430 | LOG_ALWAYS_FATAL_IF(ptr == nullptr, "%s: " #ptr " is nullptr", __FUNCTION__); |
| 431 | |
| 432 | #define VALIDATE_INT(value, cmp) \ |
| 433 | if (!(value cmp)) { \ |
| 434 | ALOGE("%s: Invalid value. Check failed: (" #value " " #cmp ") with value: %" PRIi64, \ |
| 435 | __FUNCTION__, value); \ |
| 436 | return EINVAL; \ |
| 437 | } |
| 438 | |
| 439 | #define WARN_INT(value, cmp) \ |
| 440 | if (!(value cmp)) { \ |
| 441 | ALOGE("%s: Invalid value. Check failed: (" #value " " #cmp ") with value: %" PRIi64, \ |
| 442 | __FUNCTION__, value); \ |
| 443 | } |
| 444 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 445 | APerformanceHintSession* APerformanceHint_createSession(APerformanceHintManager* manager, |
| 446 | const int32_t* threadIds, size_t size, |
| 447 | int64_t initialTargetWorkDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 448 | VALIDATE_PTR(manager) |
| 449 | VALIDATE_PTR(threadIds) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 450 | return manager->createSession(threadIds, size, initialTargetWorkDurationNanos); |
| 451 | } |
| 452 | |
| 453 | int64_t APerformanceHint_getPreferredUpdateRateNanos(APerformanceHintManager* manager) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 454 | VALIDATE_PTR(manager) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 455 | return manager->getPreferredRateNanos(); |
| 456 | } |
| 457 | |
| 458 | int APerformanceHint_updateTargetWorkDuration(APerformanceHintSession* session, |
| 459 | int64_t targetDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 460 | VALIDATE_PTR(session) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 461 | return session->updateTargetWorkDuration(targetDurationNanos); |
| 462 | } |
| 463 | |
| 464 | int APerformanceHint_reportActualWorkDuration(APerformanceHintSession* session, |
| 465 | int64_t actualDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 466 | VALIDATE_PTR(session) |
| 467 | VALIDATE_INT(actualDurationNanos, > 0) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 468 | return session->reportActualWorkDuration(actualDurationNanos); |
| 469 | } |
| 470 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 471 | void APerformanceHint_closeSession(APerformanceHintSession* session) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 472 | VALIDATE_PTR(session) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 473 | delete session; |
| 474 | } |
| 475 | |
Steven Moreland | 42a8cce | 2023-03-03 23:31:17 +0000 | [diff] [blame] | 476 | int APerformanceHint_sendHint(void* session, SessionHint hint) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 477 | VALIDATE_PTR(session) |
Matt Buckley | 61726a3 | 2022-12-06 23:44:45 +0000 | [diff] [blame] | 478 | return reinterpret_cast<APerformanceHintSession*>(session)->sendHint(hint); |
| 479 | } |
| 480 | |
Peiyong Lin | 7ed6de3 | 2023-01-26 00:52:54 +0000 | [diff] [blame] | 481 | int APerformanceHint_setThreads(APerformanceHintSession* session, const pid_t* threadIds, |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 482 | size_t size) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 483 | VALIDATE_PTR(session) |
| 484 | VALIDATE_PTR(threadIds) |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 485 | return session->setThreads(threadIds, size); |
| 486 | } |
| 487 | |
| 488 | int APerformanceHint_getThreadIds(void* aPerformanceHintSession, int32_t* const threadIds, |
| 489 | size_t* const size) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 490 | VALIDATE_PTR(aPerformanceHintSession) |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 491 | return static_cast<APerformanceHintSession*>(aPerformanceHintSession) |
| 492 | ->getThreadIds(threadIds, size); |
| 493 | } |
| 494 | |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 495 | int APerformanceHint_setPreferPowerEfficiency(APerformanceHintSession* session, bool enabled) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 496 | VALIDATE_PTR(session) |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 497 | return session->setPreferPowerEfficiency(enabled); |
| 498 | } |
| 499 | |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 500 | int APerformanceHint_reportActualWorkDuration2(APerformanceHintSession* session, |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 501 | AWorkDuration* workDurationPtr) { |
| 502 | VALIDATE_PTR(session) |
| 503 | VALIDATE_PTR(workDurationPtr) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 504 | VALIDATE_INT(workDurationPtr->durationNanos, > 0) |
| 505 | VALIDATE_INT(workDurationPtr->workPeriodStartTimestampNanos, > 0) |
| 506 | VALIDATE_INT(workDurationPtr->cpuDurationNanos, >= 0) |
| 507 | VALIDATE_INT(workDurationPtr->gpuDurationNanos, >= 0) |
| 508 | VALIDATE_INT(workDurationPtr->gpuDurationNanos + workDurationPtr->cpuDurationNanos, > 0) |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 509 | return session->reportActualWorkDuration(workDurationPtr); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 510 | } |
| 511 | |
| 512 | AWorkDuration* AWorkDuration_create() { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 513 | return new AWorkDuration(); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 514 | } |
| 515 | |
| 516 | void AWorkDuration_release(AWorkDuration* aWorkDuration) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 517 | VALIDATE_PTR(aWorkDuration) |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 518 | delete aWorkDuration; |
| 519 | } |
| 520 | |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 521 | void AWorkDuration_setActualTotalDurationNanos(AWorkDuration* aWorkDuration, |
| 522 | int64_t actualTotalDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 523 | VALIDATE_PTR(aWorkDuration) |
| 524 | WARN_INT(actualTotalDurationNanos, > 0) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 525 | aWorkDuration->durationNanos = actualTotalDurationNanos; |
| 526 | } |
| 527 | |
| 528 | void AWorkDuration_setWorkPeriodStartTimestampNanos(AWorkDuration* aWorkDuration, |
| 529 | int64_t workPeriodStartTimestampNanos) { |
| 530 | VALIDATE_PTR(aWorkDuration) |
| 531 | WARN_INT(workPeriodStartTimestampNanos, > 0) |
| 532 | aWorkDuration->workPeriodStartTimestampNanos = workPeriodStartTimestampNanos; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 533 | } |
| 534 | |
| 535 | void AWorkDuration_setActualCpuDurationNanos(AWorkDuration* aWorkDuration, |
| 536 | int64_t actualCpuDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 537 | VALIDATE_PTR(aWorkDuration) |
Matt Buckley | a115b12 | 2024-01-31 20:57:49 +0000 | [diff] [blame] | 538 | WARN_INT(actualCpuDurationNanos, >= 0) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 539 | aWorkDuration->cpuDurationNanos = actualCpuDurationNanos; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 540 | } |
| 541 | |
| 542 | void AWorkDuration_setActualGpuDurationNanos(AWorkDuration* aWorkDuration, |
| 543 | int64_t actualGpuDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 544 | VALIDATE_PTR(aWorkDuration) |
| 545 | WARN_INT(actualGpuDurationNanos, >= 0) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 546 | aWorkDuration->gpuDurationNanos = actualGpuDurationNanos; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 547 | } |
| 548 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 549 | void APerformanceHint_setIHintManagerForTesting(void* iManager) { |
| 550 | delete gHintManagerForTesting; |
| 551 | gHintManagerForTesting = nullptr; |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame^] | 552 | gIHintManagerForTesting = static_cast<std::shared_ptr<IHintManager>*>(iManager); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 553 | } |