-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPowerHintSession.h
49 lines (43 loc) · 1.8 KB
/
PowerHintSession.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __POWERHINTSESSION__
#define __POWERHINTSESSION__
#include <aidl/android/hardware/power/BnPowerHintSession.h>
#include <aidl/android/hardware/power/SessionHint.h>
#include <aidl/android/hardware/power/WorkDuration.h>
#include <mutex>
#include <set>
#include <unordered_map>
enum LOAD_TYPE { LOAD_UP, LOAD_DOWN, LOAD_RESET, LOAD_RESUME };
std::shared_ptr<aidl::android::hardware::power::IPowerHintSession> setPowerHintSession(
int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds);
int64_t getSessionPreferredRate();
class PowerHintSessionImpl : public aidl::android::hardware::power::BnPowerHintSession {
public:
explicit PowerHintSessionImpl(int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds);
~PowerHintSessionImpl();
ndk::ScopedAStatus updateTargetWorkDuration(int64_t targetDurationNanos) override;
ndk::ScopedAStatus reportActualWorkDuration(
const std::vector<aidl::android::hardware::power::WorkDuration>& durations) override;
ndk::ScopedAStatus pause() override;
ndk::ScopedAStatus resume() override;
ndk::ScopedAStatus close() override;
ndk::ScopedAStatus sendHint(aidl::android::hardware::power::SessionHint hint) override;
ndk::ScopedAStatus setThreads(const std::vector<int32_t>& threadIds) override;
bool perfBoost(int boostVal, int hintType);
int setThreadPipelining(std::vector<int32_t>& threadIds);
void removePipelining();
void resumeThreadPipelining();
void resetBoost();
private:
int32_t mUid;
int32_t mTgid;
int mHandle;
int mBoostSum;
int mLastAction;
int mThreadHandle;
std::vector<int32_t> mThreadIds;
};
#endif /* __POWERHINTSESSION__ */