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 | 7c2de58 | 2024-04-05 08:41:35 +0000 | [diff] [blame] | 44 | // Namespace for AIDL types coming from the PowerHAL |
| 45 | namespace hal = aidl::android::hardware::power; |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 46 | |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 47 | using android::base::StringPrintf; |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 48 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 49 | struct APerformanceHintSession; |
| 50 | |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 51 | constexpr int64_t SEND_HINT_TIMEOUT = std::chrono::nanoseconds(100ms).count(); |
Matt Buckley | 7c2de58 | 2024-04-05 08:41:35 +0000 | [diff] [blame] | 52 | struct AWorkDuration : public hal::WorkDuration {}; |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 53 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 54 | struct APerformanceHintManager { |
| 55 | public: |
| 56 | static APerformanceHintManager* getInstance(); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 57 | APerformanceHintManager(std::shared_ptr<IHintManager> service, int64_t preferredRateNanos); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 58 | APerformanceHintManager() = delete; |
| 59 | ~APerformanceHintManager() = default; |
| 60 | |
| 61 | APerformanceHintSession* createSession(const int32_t* threadIds, size_t size, |
| 62 | int64_t initialTargetWorkDurationNanos); |
| 63 | int64_t getPreferredRateNanos() const; |
| 64 | |
| 65 | private: |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 66 | // Necessary to create an empty binder object |
| 67 | static void* tokenStubOnCreate(void*) { |
| 68 | return nullptr; |
| 69 | } |
| 70 | static void tokenStubOnDestroy(void*) {} |
| 71 | static binder_status_t tokenStubOnTransact(AIBinder*, transaction_code_t, const AParcel*, |
| 72 | AParcel*) { |
| 73 | return STATUS_OK; |
| 74 | } |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 75 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 76 | static APerformanceHintManager* create(std::shared_ptr<IHintManager> iHintManager); |
| 77 | |
| 78 | std::shared_ptr<IHintManager> mHintManager; |
| 79 | ndk::SpAIBinder mToken; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 80 | const int64_t mPreferredRateNanos; |
| 81 | }; |
| 82 | |
| 83 | struct APerformanceHintSession { |
| 84 | public: |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 85 | APerformanceHintSession(std::shared_ptr<IHintManager> hintManager, |
| 86 | std::shared_ptr<IHintSession> session, int64_t preferredRateNanos, |
| 87 | int64_t targetDurationNanos); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 88 | APerformanceHintSession() = delete; |
| 89 | ~APerformanceHintSession(); |
| 90 | |
| 91 | int updateTargetWorkDuration(int64_t targetDurationNanos); |
| 92 | int reportActualWorkDuration(int64_t actualDurationNanos); |
Steven Moreland | 42a8cce | 2023-03-03 23:31:17 +0000 | [diff] [blame] | 93 | int sendHint(SessionHint hint); |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 94 | int setThreads(const int32_t* threadIds, size_t size); |
| 95 | int getThreadIds(int32_t* const threadIds, size_t* size); |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 96 | int setPreferPowerEfficiency(bool enabled); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 97 | int reportActualWorkDuration(AWorkDuration* workDuration); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 98 | |
| 99 | private: |
| 100 | friend struct APerformanceHintManager; |
| 101 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 102 | int reportActualWorkDurationInternal(AWorkDuration* workDuration); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 103 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 104 | std::shared_ptr<IHintManager> mHintManager; |
| 105 | std::shared_ptr<IHintSession> mHintSession; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 106 | // HAL preferred update rate |
| 107 | const int64_t mPreferredRateNanos; |
| 108 | // Target duration for choosing update rate |
| 109 | int64_t mTargetDurationNanos; |
Wei Wang | 00feb50 | 2022-10-18 10:56:59 -0700 | [diff] [blame] | 110 | // First target hit timestamp |
| 111 | int64_t mFirstTargetMetTimestamp; |
| 112 | // Last target hit timestamp |
| 113 | int64_t mLastTargetMetTimestamp; |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 114 | // Last hint reported from sendHint indexed by hint value |
| 115 | std::vector<int64_t> mLastHintSentTimestamp; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 116 | // Cached samples |
Matt Buckley | 7c2de58 | 2024-04-05 08:41:35 +0000 | [diff] [blame] | 117 | std::vector<hal::WorkDuration> mActualWorkDurations; |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 118 | std::string mSessionName; |
| 119 | static int32_t sIDCounter; |
| 120 | // The most recent set of thread IDs |
| 121 | std::vector<int32_t> mLastThreadIDs; |
| 122 | // Tracing helpers |
| 123 | void traceThreads(std::vector<int32_t>& tids); |
| 124 | void tracePowerEfficient(bool powerEfficient); |
| 125 | void traceActualDuration(int64_t actualDuration); |
| 126 | void traceBatchSize(size_t batchSize); |
| 127 | void traceTargetDuration(int64_t targetDuration); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 128 | }; |
| 129 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 130 | static std::shared_ptr<IHintManager>* gIHintManagerForTesting = nullptr; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 131 | static APerformanceHintManager* gHintManagerForTesting = nullptr; |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 132 | int32_t APerformanceHintSession::sIDCounter = 0; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 133 | |
| 134 | // ===================================== APerformanceHintManager implementation |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 135 | APerformanceHintManager::APerformanceHintManager(std::shared_ptr<IHintManager> manager, |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 136 | int64_t preferredRateNanos) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 137 | : mHintManager(std::move(manager)), mPreferredRateNanos(preferredRateNanos) { |
| 138 | static AIBinder_Class* tokenBinderClass = |
| 139 | AIBinder_Class_define("phm_token", tokenStubOnCreate, tokenStubOnDestroy, |
| 140 | tokenStubOnTransact); |
| 141 | mToken = ndk::SpAIBinder(AIBinder_new(tokenBinderClass, nullptr)); |
| 142 | } |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 143 | |
| 144 | APerformanceHintManager* APerformanceHintManager::getInstance() { |
| 145 | if (gHintManagerForTesting) return gHintManagerForTesting; |
| 146 | if (gIHintManagerForTesting) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 147 | APerformanceHintManager* manager = create(*gIHintManagerForTesting); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 148 | gIHintManagerForTesting = nullptr; |
| 149 | return manager; |
| 150 | } |
| 151 | static APerformanceHintManager* instance = create(nullptr); |
| 152 | return instance; |
| 153 | } |
| 154 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 155 | APerformanceHintManager* APerformanceHintManager::create(std::shared_ptr<IHintManager> manager) { |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 156 | if (!manager) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 157 | manager = IHintManager::fromBinder( |
| 158 | ndk::SpAIBinder(AServiceManager_waitForService("performance_hint"))); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 159 | } |
| 160 | if (manager == nullptr) { |
| 161 | ALOGE("%s: PerformanceHint service is not ready ", __FUNCTION__); |
| 162 | return nullptr; |
| 163 | } |
| 164 | int64_t preferredRateNanos = -1L; |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 165 | ndk::ScopedAStatus ret = manager->getHintSessionPreferredRate(&preferredRateNanos); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 166 | if (!ret.isOk()) { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 167 | ALOGE("%s: PerformanceHint cannot get preferred rate. %s", __FUNCTION__, ret.getMessage()); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 168 | return nullptr; |
| 169 | } |
| 170 | if (preferredRateNanos <= 0) { |
Bo Liu | d6a0960 | 2021-07-26 14:48:41 -0400 | [diff] [blame] | 171 | preferredRateNanos = -1L; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 172 | } |
| 173 | return new APerformanceHintManager(std::move(manager), preferredRateNanos); |
| 174 | } |
| 175 | |
| 176 | APerformanceHintSession* APerformanceHintManager::createSession( |
| 177 | const int32_t* threadIds, size_t size, int64_t initialTargetWorkDurationNanos) { |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 178 | std::vector<int32_t> tids(threadIds, threadIds + size); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 179 | std::shared_ptr<IHintSession> session; |
| 180 | ndk::ScopedAStatus ret = |
Bo Liu | 9acc558 | 2022-02-17 16:47:32 -0500 | [diff] [blame] | 181 | mHintManager->createHintSession(mToken, tids, initialTargetWorkDurationNanos, &session); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 182 | if (!ret.isOk() || !session) { |
| 183 | return nullptr; |
| 184 | } |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 185 | auto out = new APerformanceHintSession(mHintManager, std::move(session), mPreferredRateNanos, |
| 186 | initialTargetWorkDurationNanos); |
| 187 | out->traceThreads(tids); |
| 188 | out->traceTargetDuration(initialTargetWorkDurationNanos); |
| 189 | out->tracePowerEfficient(false); |
| 190 | return out; |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | int64_t APerformanceHintManager::getPreferredRateNanos() const { |
| 194 | return mPreferredRateNanos; |
| 195 | } |
| 196 | |
| 197 | // ===================================== APerformanceHintSession implementation |
| 198 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 199 | APerformanceHintSession::APerformanceHintSession(std::shared_ptr<IHintManager> hintManager, |
| 200 | std::shared_ptr<IHintSession> session, |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 201 | int64_t preferredRateNanos, |
| 202 | int64_t targetDurationNanos) |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 203 | : mHintManager(hintManager), |
| 204 | mHintSession(std::move(session)), |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 205 | mPreferredRateNanos(preferredRateNanos), |
| 206 | mTargetDurationNanos(targetDurationNanos), |
Wei Wang | 00feb50 | 2022-10-18 10:56:59 -0700 | [diff] [blame] | 207 | mFirstTargetMetTimestamp(0), |
Matt Buckley | 56093a7 | 2022-11-07 21:50:50 +0000 | [diff] [blame] | 208 | mLastTargetMetTimestamp(0) { |
Matt Buckley | 7c2de58 | 2024-04-05 08:41:35 +0000 | [diff] [blame] | 209 | const std::vector<hal::SessionHint> sessionHintRange{ndk::enum_range<hal::SessionHint>() |
| 210 | .begin(), |
| 211 | ndk::enum_range<hal::SessionHint>().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 | 7c2de58 | 2024-04-05 08:41:35 +0000 | [diff] [blame] | 249 | hal::WorkDuration 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 = |
Matt Buckley | 7c2de58 | 2024-04-05 08:41:35 +0000 | [diff] [blame] | 326 | mHintSession->setMode(static_cast<int32_t>(hal::SessionMode::POWER_EFFICIENCY), |
| 327 | enabled); |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 328 | |
| 329 | if (!ret.isOk()) { |
| 330 | ALOGE("%s: HintSession setPreferPowerEfficiency failed: %s", __FUNCTION__, |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 331 | ret.getMessage()); |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 332 | return EPIPE; |
| 333 | } |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 334 | tracePowerEfficient(enabled); |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 335 | return OK; |
| 336 | } |
| 337 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 338 | int APerformanceHintSession::reportActualWorkDuration(AWorkDuration* workDuration) { |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 339 | return reportActualWorkDurationInternal(workDuration); |
| 340 | } |
| 341 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 342 | int APerformanceHintSession::reportActualWorkDurationInternal(AWorkDuration* workDuration) { |
| 343 | int64_t actualTotalDurationNanos = workDuration->durationNanos; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 344 | int64_t now = uptimeNanos(); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 345 | workDuration->timeStampNanos = now; |
| 346 | traceActualDuration(workDuration->durationNanos); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 347 | mActualWorkDurations.push_back(std::move(*workDuration)); |
| 348 | |
| 349 | if (actualTotalDurationNanos >= mTargetDurationNanos) { |
| 350 | // Reset timestamps if we are equal or over the target. |
| 351 | mFirstTargetMetTimestamp = 0; |
| 352 | } else { |
| 353 | // Set mFirstTargetMetTimestamp for first time meeting target. |
| 354 | if (!mFirstTargetMetTimestamp || !mLastTargetMetTimestamp || |
| 355 | (now - mLastTargetMetTimestamp > 2 * mPreferredRateNanos)) { |
| 356 | mFirstTargetMetTimestamp = now; |
| 357 | } |
| 358 | /** |
| 359 | * Rate limit the change if the update is over mPreferredRateNanos since first |
| 360 | * meeting target and less than mPreferredRateNanos since last meeting target. |
| 361 | */ |
| 362 | if (now - mFirstTargetMetTimestamp > mPreferredRateNanos && |
| 363 | now - mLastTargetMetTimestamp <= mPreferredRateNanos) { |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 364 | traceBatchSize(mActualWorkDurations.size()); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 365 | return 0; |
| 366 | } |
| 367 | mLastTargetMetTimestamp = now; |
| 368 | } |
| 369 | |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 370 | ndk::ScopedAStatus ret = mHintSession->reportActualWorkDuration2(mActualWorkDurations); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 371 | if (!ret.isOk()) { |
| 372 | ALOGE("%s: HintSession reportActualWorkDuration failed: %s", __FUNCTION__, |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 373 | ret.getMessage()); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 374 | mFirstTargetMetTimestamp = 0; |
| 375 | mLastTargetMetTimestamp = 0; |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 376 | traceBatchSize(mActualWorkDurations.size()); |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 377 | return ret.getExceptionCode() == EX_ILLEGAL_ARGUMENT ? EINVAL : EPIPE; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 378 | } |
| 379 | mActualWorkDurations.clear(); |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 380 | traceBatchSize(0); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 381 | |
| 382 | return 0; |
| 383 | } |
Matt Buckley | e3d5c3a | 2023-12-01 23:10:32 +0000 | [diff] [blame] | 384 | // ===================================== Tracing helpers |
| 385 | |
| 386 | void APerformanceHintSession::traceThreads(std::vector<int32_t>& tids) { |
| 387 | std::set<int32_t> tidSet{tids.begin(), tids.end()}; |
| 388 | |
| 389 | // Disable old TID tracing |
| 390 | for (int32_t tid : mLastThreadIDs) { |
| 391 | if (!tidSet.count(tid)) { |
| 392 | std::string traceName = |
| 393 | android::base::StringPrintf("%s TID: %" PRId32, mSessionName.c_str(), tid); |
| 394 | ATrace_setCounter(traceName.c_str(), 0); |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | // Add new TID tracing |
| 399 | for (int32_t tid : tids) { |
| 400 | std::string traceName = |
| 401 | android::base::StringPrintf("%s TID: %" PRId32, mSessionName.c_str(), tid); |
| 402 | ATrace_setCounter(traceName.c_str(), 1); |
| 403 | } |
| 404 | |
| 405 | mLastThreadIDs = std::move(tids); |
| 406 | } |
| 407 | |
| 408 | void APerformanceHintSession::tracePowerEfficient(bool powerEfficient) { |
| 409 | ATrace_setCounter((mSessionName + " power efficiency mode").c_str(), powerEfficient); |
| 410 | } |
| 411 | |
| 412 | void APerformanceHintSession::traceActualDuration(int64_t actualDuration) { |
| 413 | ATrace_setCounter((mSessionName + " actual duration").c_str(), actualDuration); |
| 414 | } |
| 415 | |
| 416 | void APerformanceHintSession::traceBatchSize(size_t batchSize) { |
| 417 | std::string traceName = StringPrintf("%s batch size", mSessionName.c_str()); |
| 418 | ATrace_setCounter((mSessionName + " batch size").c_str(), batchSize); |
| 419 | } |
| 420 | |
| 421 | void APerformanceHintSession::traceTargetDuration(int64_t targetDuration) { |
| 422 | ATrace_setCounter((mSessionName + " target duration").c_str(), targetDuration); |
| 423 | } |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 424 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 425 | // ===================================== C API |
| 426 | APerformanceHintManager* APerformanceHint_getManager() { |
| 427 | return APerformanceHintManager::getInstance(); |
| 428 | } |
| 429 | |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 430 | #define VALIDATE_PTR(ptr) \ |
| 431 | LOG_ALWAYS_FATAL_IF(ptr == nullptr, "%s: " #ptr " is nullptr", __FUNCTION__); |
| 432 | |
| 433 | #define VALIDATE_INT(value, cmp) \ |
| 434 | if (!(value cmp)) { \ |
| 435 | ALOGE("%s: Invalid value. Check failed: (" #value " " #cmp ") with value: %" PRIi64, \ |
| 436 | __FUNCTION__, value); \ |
| 437 | return EINVAL; \ |
| 438 | } |
| 439 | |
| 440 | #define WARN_INT(value, cmp) \ |
| 441 | if (!(value cmp)) { \ |
| 442 | ALOGE("%s: Invalid value. Check failed: (" #value " " #cmp ") with value: %" PRIi64, \ |
| 443 | __FUNCTION__, value); \ |
| 444 | } |
| 445 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 446 | APerformanceHintSession* APerformanceHint_createSession(APerformanceHintManager* manager, |
| 447 | const int32_t* threadIds, size_t size, |
| 448 | int64_t initialTargetWorkDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 449 | VALIDATE_PTR(manager) |
| 450 | VALIDATE_PTR(threadIds) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 451 | return manager->createSession(threadIds, size, initialTargetWorkDurationNanos); |
| 452 | } |
| 453 | |
| 454 | int64_t APerformanceHint_getPreferredUpdateRateNanos(APerformanceHintManager* manager) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 455 | VALIDATE_PTR(manager) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 456 | return manager->getPreferredRateNanos(); |
| 457 | } |
| 458 | |
| 459 | int APerformanceHint_updateTargetWorkDuration(APerformanceHintSession* session, |
| 460 | int64_t targetDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 461 | VALIDATE_PTR(session) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 462 | return session->updateTargetWorkDuration(targetDurationNanos); |
| 463 | } |
| 464 | |
| 465 | int APerformanceHint_reportActualWorkDuration(APerformanceHintSession* session, |
| 466 | int64_t actualDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 467 | VALIDATE_PTR(session) |
| 468 | VALIDATE_INT(actualDurationNanos, > 0) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 469 | return session->reportActualWorkDuration(actualDurationNanos); |
| 470 | } |
| 471 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 472 | void APerformanceHint_closeSession(APerformanceHintSession* session) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 473 | VALIDATE_PTR(session) |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 474 | delete session; |
| 475 | } |
| 476 | |
Steven Moreland | 42a8cce | 2023-03-03 23:31:17 +0000 | [diff] [blame] | 477 | int APerformanceHint_sendHint(void* session, SessionHint hint) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 478 | VALIDATE_PTR(session) |
Matt Buckley | 61726a3 | 2022-12-06 23:44:45 +0000 | [diff] [blame] | 479 | return reinterpret_cast<APerformanceHintSession*>(session)->sendHint(hint); |
| 480 | } |
| 481 | |
Peiyong Lin | 7ed6de3 | 2023-01-26 00:52:54 +0000 | [diff] [blame] | 482 | int APerformanceHint_setThreads(APerformanceHintSession* session, const pid_t* threadIds, |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 483 | size_t size) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 484 | VALIDATE_PTR(session) |
| 485 | VALIDATE_PTR(threadIds) |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 486 | return session->setThreads(threadIds, size); |
| 487 | } |
| 488 | |
| 489 | int APerformanceHint_getThreadIds(void* aPerformanceHintSession, int32_t* const threadIds, |
| 490 | size_t* const size) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 491 | VALIDATE_PTR(aPerformanceHintSession) |
Peiyong Lin | 095de76 | 2022-11-11 18:28:12 +0000 | [diff] [blame] | 492 | return static_cast<APerformanceHintSession*>(aPerformanceHintSession) |
| 493 | ->getThreadIds(threadIds, size); |
| 494 | } |
| 495 | |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 496 | int APerformanceHint_setPreferPowerEfficiency(APerformanceHintSession* session, bool enabled) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 497 | VALIDATE_PTR(session) |
Matt Buckley | 423c1b3 | 2023-06-28 19:13:42 +0000 | [diff] [blame] | 498 | return session->setPreferPowerEfficiency(enabled); |
| 499 | } |
| 500 | |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 501 | int APerformanceHint_reportActualWorkDuration2(APerformanceHintSession* session, |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 502 | AWorkDuration* workDurationPtr) { |
| 503 | VALIDATE_PTR(session) |
| 504 | VALIDATE_PTR(workDurationPtr) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 505 | VALIDATE_INT(workDurationPtr->durationNanos, > 0) |
| 506 | VALIDATE_INT(workDurationPtr->workPeriodStartTimestampNanos, > 0) |
| 507 | VALIDATE_INT(workDurationPtr->cpuDurationNanos, >= 0) |
| 508 | VALIDATE_INT(workDurationPtr->gpuDurationNanos, >= 0) |
| 509 | VALIDATE_INT(workDurationPtr->gpuDurationNanos + workDurationPtr->cpuDurationNanos, > 0) |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 510 | return session->reportActualWorkDuration(workDurationPtr); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 511 | } |
| 512 | |
| 513 | AWorkDuration* AWorkDuration_create() { |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 514 | return new AWorkDuration(); |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 515 | } |
| 516 | |
| 517 | void AWorkDuration_release(AWorkDuration* aWorkDuration) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 518 | VALIDATE_PTR(aWorkDuration) |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 519 | delete aWorkDuration; |
| 520 | } |
| 521 | |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 522 | void AWorkDuration_setActualTotalDurationNanos(AWorkDuration* aWorkDuration, |
| 523 | int64_t actualTotalDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 524 | VALIDATE_PTR(aWorkDuration) |
| 525 | WARN_INT(actualTotalDurationNanos, > 0) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 526 | aWorkDuration->durationNanos = actualTotalDurationNanos; |
| 527 | } |
| 528 | |
| 529 | void AWorkDuration_setWorkPeriodStartTimestampNanos(AWorkDuration* aWorkDuration, |
| 530 | int64_t workPeriodStartTimestampNanos) { |
| 531 | VALIDATE_PTR(aWorkDuration) |
| 532 | WARN_INT(workPeriodStartTimestampNanos, > 0) |
| 533 | aWorkDuration->workPeriodStartTimestampNanos = workPeriodStartTimestampNanos; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 534 | } |
| 535 | |
| 536 | void AWorkDuration_setActualCpuDurationNanos(AWorkDuration* aWorkDuration, |
| 537 | int64_t actualCpuDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 538 | VALIDATE_PTR(aWorkDuration) |
Matt Buckley | a115b12 | 2024-01-31 20:57:49 +0000 | [diff] [blame] | 539 | WARN_INT(actualCpuDurationNanos, >= 0) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 540 | aWorkDuration->cpuDurationNanos = actualCpuDurationNanos; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 541 | } |
| 542 | |
| 543 | void AWorkDuration_setActualGpuDurationNanos(AWorkDuration* aWorkDuration, |
| 544 | int64_t actualGpuDurationNanos) { |
Matt Buckley | 83f7709 | 2024-01-18 19:57:29 +0000 | [diff] [blame] | 545 | VALIDATE_PTR(aWorkDuration) |
| 546 | WARN_INT(actualGpuDurationNanos, >= 0) |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 547 | aWorkDuration->gpuDurationNanos = actualGpuDurationNanos; |
Peiyong Lin | 70de085 | 2023-10-25 21:12:35 +0000 | [diff] [blame] | 548 | } |
| 549 | |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 550 | void APerformanceHint_setIHintManagerForTesting(void* iManager) { |
| 551 | delete gHintManagerForTesting; |
| 552 | gHintManagerForTesting = nullptr; |
Matt Buckley | 5897772 | 2024-03-11 23:32:09 +0000 | [diff] [blame] | 553 | gIHintManagerForTesting = static_cast<std::shared_ptr<IHintManager>*>(iManager); |
Bo Liu | 4426772 | 2021-07-16 17:03:20 -0400 | [diff] [blame] | 554 | } |