Stay organized with collections
Save and categorize content based on your preferences.
class PerformanceHintManager
The PerformanceHintManager allows apps to send performance hint to system.
Summary
Nested classes |
|
A Session represents a group of threads with an inter-related workload such that hints for their performance should be considered as a unit.
|
Public methods
createHintSession
fun createHintSession(
tids: IntArray,
initialTargetWorkDurationNanos: Long
): PerformanceHintManager.Session?
Creates a Session
for the given set of threads and sets their initial target work duration.
Parameters |
tids |
IntArray: The list of threads to be associated with this session. They must be part of this process' thread group This value cannot be null . |
initialTargetWorkDurationNanos |
Long: The desired duration in nanoseconds for the new session |
Return |
PerformanceHintManager.Session? |
the new session if it is supported on this device, null if hint session is not supported on this device or the tid doesn't belong to the application |
Exceptions |
java.lang.IllegalArgumentException |
if the thread id list is empty, or initialTargetWorkDurationNanos is non-positive |
getPreferredUpdateRateNanos
fun getPreferredUpdateRateNanos(): Long
Get preferred update rate information for this device.
Return |
Long |
the preferred update rate supported by device software |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# PerformanceHintManager\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPerformanceHintManager\n======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/os/PerformanceHintManager \"View this page in Java\") \n\n```\nclass PerformanceHintManager\n```\n\n|---|----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.os.PerformanceHintManager](#) |\n\nThe PerformanceHintManager allows apps to send performance hint to system.\n\nSummary\n-------\n\n| Nested classes ||\n|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Session](/reference/kotlin/android/os/PerformanceHintManager.Session) A Session represents a group of threads with an inter-related workload such that hints for their performance should be considered as a unit. |\n\n| Public methods ||\n|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [PerformanceHintManager.Session](/reference/kotlin/android/os/PerformanceHintManager.Session)? | [createHintSession](#createHintSession(kotlin.IntArray,%20kotlin.Long))`(`tids:` `[IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)`, `initialTargetWorkDurationNanos:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Creates a [Session](/reference/kotlin/android/os/PerformanceHintManager.Session) for the given set of threads and sets their initial target work duration. |\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getPreferredUpdateRateNanos](#getPreferredUpdateRateNanos())`()` Get preferred update rate information for this device. |\n\nPublic methods\n--------------\n\n### createHintSession\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun createHintSession(\n tids: IntArray, \n initialTargetWorkDurationNanos: Long\n): PerformanceHintManager.Session?\n```\n\nCreates a [Session](/reference/kotlin/android/os/PerformanceHintManager.Session) for the given set of threads and sets their initial target work duration.\n\n| Parameters ||\n|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `tids` | [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html): The list of threads to be associated with this session. They must be part of this process' thread group This value cannot be `null`. |\n| `initialTargetWorkDurationNanos` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The desired duration in nanoseconds for the new session |\n\n| Return ||\n|------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [PerformanceHintManager.Session](/reference/kotlin/android/os/PerformanceHintManager.Session)? | the new session if it is supported on this device, null if hint session is not supported on this device or the tid doesn't belong to the application |\n\n| Exceptions ||\n|--------------------------------------|-----------------------------------------------------------------------------------|\n| `java.lang.IllegalArgumentException` | if the thread id list is empty, or initialTargetWorkDurationNanos is non-positive |\n\n### getPreferredUpdateRateNanos\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getPreferredUpdateRateNanos(): Long\n```\n\nGet preferred update rate information for this device.\n\n| Return ||\n|------------------------------------------------------------------------------|--------------------------------------------------------|\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | the preferred update rate supported by device software |"]]