Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADPF] PerformanceHintAPI - include core threads + use NDK API #16610

Merged
merged 7 commits into from
Dec 28, 2023

Conversation

HakimHauston
Copy link
Contributor

Re: #

adapt PerformanceHintAPI to include main thread & render thread and optionally use the NDK API when available

Changelog

  • Add call to ADPF Performance Hint Manager in MessageQueue
  • Adapt ADPFManager to be able to dynamically add/remove thread-ids

Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • [ V] does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

Copy link

Interface Check Report

This pull request does not change any public interfaces !

@minggo
Copy link
Contributor

minggo commented Dec 18, 2023

Please refer the compiling error on Android

 /home/runner/work/cocos-engine/cocos-engine/native/cocos/base/threading/MessageQueue.cpp:284:5: error: use of undeclared identifier 'ADPFManager'
      ADPFManager::getInstance().AddThreadIdToHintSession(tid);

@minggo
Copy link
Contributor

minggo commented Dec 22, 2023

Could you please fix the clang tidy error?

}
void ADPFManager::AddThreadIdToHintSession(int32_t tid) {
thread_ids_.push_back(tid);
auto data = thread_ids_.data();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems data is not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up in 1d6c8b9


void ADPFManager::RemoveThreadIdFromHintSession(int32_t tid) {
thread_ids_.erase(std::remove(thread_ids_.begin(), thread_ids_.end(), tid), thread_ids_.end());
auto data = thread_ids_.data();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up data in 1d6c8b9

#elif __ANDROID_API__ >= 33
auto data = thread_ids_.data();
std::size_t size = thread_ids_.size();
int result = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems result is only used in CC_LOG_INFO ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up variables in 1d6c8b9

@@ -140,17 +155,29 @@ class ADPFManager {
jobject obj_power_service_;
jmethodID get_thermal_headroom_;

std::map<std::string, jobject> map_hint_sessions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to use std::unordered_map<> if the order is not important.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, order isn't important, only the key value mapping is, changed in 1d6c8b9

@minggo
Copy link
Contributor

minggo commented Dec 26, 2023

@HakimHauston thanks, i will merge it after @HakimNB approve it.

@HakimNB
Copy link

HakimNB commented Dec 26, 2023

@HakimHauston thanks, i will merge it after @HakimNB approve it.

Thanks.. but I am not authorized to approve it..?

@minggo
Copy link
Contributor

minggo commented Dec 27, 2023

@HakimNB i am not sure, i thought everyone had the permission. But no matter, you can reply in comment if you approve it.

Copy link

@HakimNB HakimNB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@minggo approved

@minggo minggo merged commit 716b935 into cocos:v3.8.3 Dec 28, 2023
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants