Stay organized with collections
Save and categorize content based on your preferences.
RelativeFrameTimeHistogram
public
class
RelativeFrameTimeHistogram
extends Object
A histogram of frame times relative to their deadline.
This class aids in reporting AppJankStats
to the system and is designed for use by
library widgets. It facilitates the recording of frame times in relation to the frame deadline.
The class records the distribution of time remaining until a frame is considered janky or how
janky the frame was.
A frame's relative frame time value indicates whether it was delivered early, on time, or late.
A negative relative frame time value indicates the frame was delivered early, a value of zero
indicates the frame was delivered on time and a positive value indicates the frame was delivered
late. The values of the endpoints indicate how early or late a frame was delivered.
The relative frame times are recorded as a histogram: values are
added
to a bucket by increasing the bucket's counter. The
count of frames with a relative frame time between
bucket endpoints
i
and i+1
can be obtained
through index i
of getBucketCounters()
.
Summary
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public constructors
RelativeFrameTimeHistogram
public RelativeFrameTimeHistogram ()
Create a new instance of RelativeFrameTimeHistogram.
Public methods
addRelativeFrameTimeMillis
public void addRelativeFrameTimeMillis (int frameTimeMillis)
Increases the count by one for the bucket representing the relative frame time.
Parameters |
frameTimeMillis |
int : relative frame time in millis, relative frame time is the difference
between a frames deadline and when it was rendered. |
getBucketCounters
public int[] getBucketCounters ()
Returns the counts for the all the relative frame time buckets.
Returns |
int[] |
an array of integers representing the counts of relative frame times. This value
cannot be null. |
getBucketEndpointsMillis
public int[] getBucketEndpointsMillis ()
Returns the relative frame time endpoints for the histogram.
Index i
of getBucketCounters()
contains the count of frames that had a
relative frame time between endpoints[i]
(inclusive) and endpoints[i+1]
(exclusive).
Returns |
int[] |
array of integers representing the endpoints for the predefined histogram count
buckets. This value cannot be null. |
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-03-13 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-03-13 UTC."],[],[],null,["# RelativeFrameTimeHistogram\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Ctors](#pubctors) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nRelativeFrameTimeHistogram\n==========================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/app/jank/RelativeFrameTimeHistogram \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\nclass\nRelativeFrameTimeHistogram\n`\n\n\n`\n\nextends `[Object](/reference/java/lang/Object)`\n\n\n`\n\n`\n\n\n`\n\n|---|---------------------------------------------|\n| [java.lang.Object](/reference/java/lang/Object) ||\n| ↳ | android.app.jank.RelativeFrameTimeHistogram |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA histogram of frame times relative to their deadline.\n\nThis class aids in reporting [AppJankStats](/reference/android/app/jank/AppJankStats) to the system and is designed for use by\nlibrary widgets. It facilitates the recording of frame times in relation to the frame deadline.\nThe class records the distribution of time remaining until a frame is considered janky or how\njanky the frame was.\n\n\nA frame's relative frame time value indicates whether it was delivered early, on time, or late.\nA negative relative frame time value indicates the frame was delivered early, a value of zero\nindicates the frame was delivered on time and a positive value indicates the frame was delivered\nlate. The values of the endpoints indicate how early or late a frame was delivered.\n\n\nThe relative frame times are recorded as a histogram: values are\n[added](/reference/android/app/jank/RelativeFrameTimeHistogram#addRelativeFrameTimeMillis(int)) to a bucket by increasing the bucket's counter. The\ncount of frames with a relative frame time between\n[bucket endpoints](/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketEndpointsMillis()) `i` and `i+1` can be obtained\nthrough index `i` of [getBucketCounters()](/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketCounters()).\n\nSummary\n-------\n\n| ### Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[RelativeFrameTimeHistogram](/reference/android/app/jank/RelativeFrameTimeHistogram#RelativeFrameTimeHistogram())`() ` Create a new instance of RelativeFrameTimeHistogram. |\n\n| ### Public methods ||\n|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[addRelativeFrameTimeMillis](/reference/android/app/jank/RelativeFrameTimeHistogram#addRelativeFrameTimeMillis(int))`(int frameTimeMillis) ` Increases the count by one for the bucket representing the relative frame time. |\n| ` int[]` | ` `[getBucketCounters](/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketCounters())`() ` Returns the counts for the all the relative frame time buckets. |\n| ` int[]` | ` `[getBucketEndpointsMillis](/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketEndpointsMillis())`() ` Returns the relative frame time endpoints for the histogram. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` `[java.lang.Object](/reference/java/lang/Object)` ` |---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](/reference/java/lang/Object) | ` `[clone](/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object. | | ` boolean` | ` `[equals](/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Indicates whether some other object is \"equal to\" this one. | | ` void` | ` `[finalize](/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final `[Class](/reference/java/lang/Class)`\u003c?\u003e` | ` `[getClass](/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`. | | ` int` | ` `[hashCode](/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object. | | ` final void` | ` `[notify](/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` `[notifyAll](/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor. | | ` `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/Object#toString())`() ` Returns a string representation of the object. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||\n\nPublic constructors\n-------------------\n\n### RelativeFrameTimeHistogram\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic RelativeFrameTimeHistogram ()\n```\n\nCreate a new instance of RelativeFrameTimeHistogram.\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### addRelativeFrameTimeMillis\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic void addRelativeFrameTimeMillis (int frameTimeMillis)\n```\n\nIncreases the count by one for the bucket representing the relative frame time.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| `frameTimeMillis` | `int`: relative frame time in millis, relative frame time is the difference between a frames deadline and when it was rendered. \u003cbr /\u003e |\n\n### getBucketCounters\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic int[] getBucketCounters ()\n```\n\nReturns the counts for the all the relative frame time buckets.\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------|---------------------------------------------------------------------------------------------------------|\n| `int[]` | an array of integers representing the counts of relative frame times. This value cannot be null. \u003cbr /\u003e |\n\n### getBucketEndpointsMillis\n\nAdded in [API level 36](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic int[] getBucketEndpointsMillis ()\n```\n\nReturns the relative frame time endpoints for the histogram.\n\n\nIndex `i` of [getBucketCounters()](/reference/android/app/jank/RelativeFrameTimeHistogram#getBucketCounters()) contains the count of frames that had a\nrelative frame time between `endpoints[i]` (inclusive) and `endpoints[i+1]`\n(exclusive).\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------|----------------------------------------------------------------------------------------------------------------------------|\n| `int[]` | array of integers representing the endpoints for the predefined histogram count buckets. This value cannot be null. \u003cbr /\u003e |"]]