Stay organized with collections
Save and categorize content based on your preferences.
WorkDuration
class WorkDuration
WorkDuration contains the measured time in nano seconds of the workload in each component, see PerformanceHintManager.Session.reportActualWorkDuration(WorkDuration)
. All timings should be in SystemClock.uptimeNanos()
and measured in wall time.
Summary
Public methods |
Boolean |
|
Long |
Returns the actual CPU duration in nanoseconds.
|
Long |
Returns the actual GPU duration in nanoseconds.
|
Long |
Returns the actual total duration in nanoseconds.
|
Long |
Returns the work period start timestamp based in nanoseconds.
|
Int |
|
Unit |
Sets the actual CPU duration in nanoseconds.
|
Unit |
Sets the actual GPU duration in nanoseconds.
|
Unit |
Sets the actual total duration in nanoseconds.
|
Unit |
Sets the work period start timestamp in nanoseconds.
|
Public constructors
WorkDuration
WorkDuration()
Public methods
equals
fun equals(other: Any?): Boolean
Parameters |
obj |
the reference object with which to compare. |
Return |
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getActualCpuDurationNanos
fun getActualCpuDurationNanos(): Long
Returns the actual CPU duration in nanoseconds. All timings should be in SystemClock.uptimeNanos()
.
getActualGpuDurationNanos
fun getActualGpuDurationNanos(): Long
Returns the actual GPU duration in nanoseconds. All timings should be in SystemClock.uptimeNanos()
.
getActualTotalDurationNanos
fun getActualTotalDurationNanos(): Long
Returns the actual total duration in nanoseconds. All timings should be in SystemClock.uptimeNanos()
.
getWorkPeriodStartTimestampNanos
fun getWorkPeriodStartTimestampNanos(): Long
Returns the work period start timestamp based in nanoseconds. All timings should be in SystemClock.uptimeNanos()
.
hashCode
fun hashCode(): Int
Return |
Int |
a hash code value for this object. |
setActualCpuDurationNanos
fun setActualCpuDurationNanos(actualCpuDurationNanos: Long): Unit
Sets the actual CPU duration in nanoseconds. All timings should be in SystemClock.uptimeNanos()
.
setActualGpuDurationNanos
fun setActualGpuDurationNanos(actualGpuDurationNanos: Long): Unit
Sets the actual GPU duration in nanoseconds. All timings should be in SystemClock.uptimeNanos()
.
setActualTotalDurationNanos
fun setActualTotalDurationNanos(actualTotalDurationNanos: Long): Unit
Sets the actual total duration in nanoseconds. All timings should be in SystemClock.uptimeNanos()
.
setWorkPeriodStartTimestampNanos
fun setWorkPeriodStartTimestampNanos(workPeriodStartTimestampNanos: Long): Unit
Sets the work period start timestamp in nanoseconds. All timings should be in SystemClock.uptimeNanos()
.
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,["# WorkDuration\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nWorkDuration\n============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/os/WorkDuration \"View this page in Java\") \n\n```\nclass WorkDuration\n```\n\n|---|------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.os.WorkDuration](#) |\n\nWorkDuration contains the measured time in nano seconds of the workload in each component, see [PerformanceHintManager.Session.reportActualWorkDuration(WorkDuration)](/reference/kotlin/android/os/PerformanceHintManager.Session#reportActualWorkDuration(android.os.WorkDuration)). All timings should be in [SystemClock.uptimeNanos()](/reference/kotlin/android/os/SystemClock#uptimeNanos()) and measured in wall time.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------|---|\n| [WorkDuration](#WorkDuration())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [equals](#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` \u003cbr /\u003e |\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getActualCpuDurationNanos](#getActualCpuDurationNanos())`()` Returns the actual CPU duration in nanoseconds. |\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getActualGpuDurationNanos](#getActualGpuDurationNanos())`()` Returns the actual GPU duration in nanoseconds. |\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getActualTotalDurationNanos](#getActualTotalDurationNanos())`()` Returns the actual total duration in nanoseconds. |\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getWorkPeriodStartTimestampNanos](#getWorkPeriodStartTimestampNanos())`()` Returns the work period start timestamp based in nanoseconds. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [hashCode](#hashCode())`()` \u003cbr /\u003e |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setActualCpuDurationNanos](#setActualCpuDurationNanos(kotlin.Long))`(`actualCpuDurationNanos:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Sets the actual CPU duration in nanoseconds. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setActualGpuDurationNanos](#setActualGpuDurationNanos(kotlin.Long))`(`actualGpuDurationNanos:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Sets the actual GPU duration in nanoseconds. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setActualTotalDurationNanos](#setActualTotalDurationNanos(kotlin.Long))`(`actualTotalDurationNanos:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Sets the actual total duration in nanoseconds. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setWorkPeriodStartTimestampNanos](#setWorkPeriodStartTimestampNanos(kotlin.Long))`(`workPeriodStartTimestampNanos:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Sets the work period start timestamp in nanoseconds. |\n\nPublic constructors\n-------------------\n\n### WorkDuration\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nWorkDuration()\n```\n\nPublic methods\n--------------\n\n### equals\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun equals(other: Any?): Boolean\n```\n\n| Parameters ||\n|-------|---------------------------------------------|\n| `obj` | the reference object with which to compare. |\n\n| Return ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true` if this object is the same as the obj argument; `false` otherwise. |\n\n### getActualCpuDurationNanos\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getActualCpuDurationNanos(): Long\n```\n\nReturns the actual CPU duration in nanoseconds. All timings should be in [SystemClock.uptimeNanos()](/reference/kotlin/android/os/SystemClock#uptimeNanos()). \n\n### getActualGpuDurationNanos\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getActualGpuDurationNanos(): Long\n```\n\nReturns the actual GPU duration in nanoseconds. All timings should be in [SystemClock.uptimeNanos()](/reference/kotlin/android/os/SystemClock#uptimeNanos()). \n\n### getActualTotalDurationNanos\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getActualTotalDurationNanos(): Long\n```\n\nReturns the actual total duration in nanoseconds. All timings should be in [SystemClock.uptimeNanos()](/reference/kotlin/android/os/SystemClock#uptimeNanos()). \n\n### getWorkPeriodStartTimestampNanos\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getWorkPeriodStartTimestampNanos(): Long\n```\n\nReturns the work period start timestamp based in nanoseconds. All timings should be in [SystemClock.uptimeNanos()](/reference/kotlin/android/os/SystemClock#uptimeNanos()). \n\n### hashCode\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun hashCode(): Int\n```\n\n| Return ||\n|----------------------------------------------------------------------------|------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |\n\n### setActualCpuDurationNanos\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setActualCpuDurationNanos(actualCpuDurationNanos: Long): Unit\n```\n\nSets the actual CPU duration in nanoseconds. All timings should be in [SystemClock.uptimeNanos()](/reference/kotlin/android/os/SystemClock#uptimeNanos()). \n\n### setActualGpuDurationNanos\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setActualGpuDurationNanos(actualGpuDurationNanos: Long): Unit\n```\n\nSets the actual GPU duration in nanoseconds. All timings should be in [SystemClock.uptimeNanos()](/reference/kotlin/android/os/SystemClock#uptimeNanos()). \n\n### setActualTotalDurationNanos\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setActualTotalDurationNanos(actualTotalDurationNanos: Long): Unit\n```\n\nSets the actual total duration in nanoseconds. All timings should be in [SystemClock.uptimeNanos()](/reference/kotlin/android/os/SystemClock#uptimeNanos()). \n\n### setWorkPeriodStartTimestampNanos\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setWorkPeriodStartTimestampNanos(workPeriodStartTimestampNanos: Long): Unit\n```\n\nSets the work period start timestamp in nanoseconds. All timings should be in [SystemClock.uptimeNanos()](/reference/kotlin/android/os/SystemClock#uptimeNanos())."]]