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

Add bindings for Performance Hint Manager #480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarijnS95
Copy link
Member

https://developer.android.com/ndk/reference/group/a-performance-hint

Performance Hint Manager allows apps to inform the system about workloads running on threads to more accurately allocate power for them. After the fact, applications should report back how long their operation actually ended up taking.

The new work duration API (driven by AWorkDuration) also includes GPU timings.

Comment on lines +32 to +44
/// Retrieve a reference to the performance hint manager.
///
/// Returns [`None`] on failure.
#[doc(alias = "APerformanceHint_getManager")]
pub fn new() -> Option<Self> {
NonNull::new(unsafe { ffi::APerformanceHint_getManager() }).map(|ptr| Self { ptr })
}
Copy link
Member Author

Choose a reason for hiding this comment

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

As it turns out there was a hidden static keyword in this C function, this should always return the same singleton for the process:

https://issuetracker.google.com/issues/357214902#comment7

Meaning we can also derive Send/Sync and Copy/Clone since the user could anyway cheaply retrieve the same singleton from any thread.

https://developer.android.com/ndk/reference/group/a-performance-hint

Performance Hint Manager allows apps to inform the system about
workloads running on threads to more accurately allocate power for them.
After the fact, applications should report back how long their operation
actually ended up taking.

The new work duration API (driven by `AWorkDuration`) also includes
GPU timings.
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.

1 participant