added in version 26.1.0
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1

FrameMetricsAggregator

public class FrameMetricsAggregator
extends Object

java.lang.Object
   ↳ android.support.v4.app.FrameMetricsAggregator


This class can be used to record and return data about per-frame durations. It returns those results in an array per metric type, with the results indicating how many samples were recorded for each duration value. The details of the durations data are described in getMetrics().

For more information on the various metrics tracked, see the documentation for the FrameMetrics API added in API 24 as well as the GPU Profiling guide.

Summary

Constants

int ANIMATION_DURATION

A flag indicating that the metrics should track the animation duration.

int ANIMATION_INDEX

The index in the metrics array where the data for ANIMATION_DURATION is stored.

int COMMAND_DURATION

A flag indicating that the metrics should track the command duration.

int COMMAND_INDEX

The index in the metrics array where the data for SYNC_DURATION is stored.

int DELAY_DURATION

A flag indicating that the metrics should track the delay duration.

int DELAY_INDEX

The index in the metrics array where the data for DELAY_DURATION is stored.

int DRAW_DURATION

A flag indicating that the metrics should track the draw duration.

int DRAW_INDEX

The index in the metrics array where the data for DRAW_DURATION is stored.

int EVERY_DURATION

A flag indicating that the metrics should track all durations.

int INPUT_DURATION

A flag indicating that the metrics should track the input duration.

int INPUT_INDEX

The index in the metrics array where the data for INPUT_DURATION is stored.

int LAYOUT_MEASURE_DURATION

A flag indicating that the metrics should track the layout duration.

int LAYOUT_MEASURE_INDEX

The index in the metrics array where the data for LAYOUT_MEASURE_DURATION is stored.

int SWAP_DURATION

A flag indicating that the metrics should track the swap duration.

int SWAP_INDEX

The index in the metrics array where the data for COMMAND_DURATION is stored.

int SYNC_DURATION

A flag indicating that the metrics should track the sync duration.

int SYNC_INDEX

The index in the metrics array where the data for SYNC_DURATION is stored.

int TOTAL_DURATION

A flag indicating that the metrics should track the total duration.

int TOTAL_INDEX

The index in the metrics array where the data for TOTAL_DURATION is stored.

Public constructors

FrameMetricsAggregator()

Constructs a FrameMetricsAggregator object that will track TOTAL_DURATION metrics.

FrameMetricsAggregator(int metricTypeFlags)

Constructs a FrameMetricsAggregator object that will track the metrics specified bty metricTypeFlags, which is a value derived by OR'ing together metrics constants such as TOTAL_DURATION to specify all metrics that should be tracked.

Public methods

void add(Activity activity)

Starts recording frame metrics for the given activity.

SparseIntArray[] getMetrics()

Returns the currently-collected metrics in an array of SparseIntArray objects.

SparseIntArray[] remove(Activity activity)

Stops recording metrics for activity and returns the collected metrics so far.

SparseIntArray[] reset()

Resets the metrics data and returns the currently-collected metrics.

SparseIntArray[] stop()

Stops recording metrics for all Activities currently being tracked.

Inherited methods

From class java.lang.Object

Constants

ANIMATION_DURATION

added in version 26.1.0
int ANIMATION_DURATION

A flag indicating that the metrics should track the animation duration. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate all of the metrics that should be tracked for that activity.

Constant Value: 256 (0x00000100)

ANIMATION_INDEX

added in version 26.1.0
int ANIMATION_INDEX

The index in the metrics array where the data for ANIMATION_DURATION is stored.

See also:

Constant Value: 8 (0x00000008)

COMMAND_DURATION

added in version 26.1.0
int COMMAND_DURATION

A flag indicating that the metrics should track the command duration. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate all of the metrics that should be tracked for that activity.

Constant Value: 32 (0x00000020)

COMMAND_INDEX

added in version 26.1.0
int COMMAND_INDEX

The index in the metrics array where the data for SYNC_DURATION is stored.

See also:

Constant Value: 5 (0x00000005)

DELAY_DURATION

added in version 26.1.0
int DELAY_DURATION

A flag indicating that the metrics should track the delay duration. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate all of the metrics that should be tracked for that activity.

Constant Value: 128 (0x00000080)

DELAY_INDEX

added in version 26.1.0
int DELAY_INDEX

The index in the metrics array where the data for DELAY_DURATION is stored.

See also:

Constant Value: 7 (0x00000007)

DRAW_DURATION

added in version 26.1.0
int DRAW_DURATION

A flag indicating that the metrics should track the draw duration. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate all of the metrics that should be tracked for that activity.

Constant Value: 8 (0x00000008)

DRAW_INDEX

added in version 26.1.0
int DRAW_INDEX

The index in the metrics array where the data for DRAW_DURATION is stored.

See also:

Constant Value: 3 (0x00000003)

EVERY_DURATION

added in version 26.1.0
int EVERY_DURATION

A flag indicating that the metrics should track all durations. This is a shorthand for OR'ing all of the duration flags. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate the metrics that should be tracked for that activity.

Constant Value: 511 (0x000001ff)

INPUT_DURATION

added in version 26.1.0
int INPUT_DURATION

A flag indicating that the metrics should track the input duration. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate all of the metrics that should be tracked for that activity.

Constant Value: 2 (0x00000002)

INPUT_INDEX

added in version 26.1.0
int INPUT_INDEX

The index in the metrics array where the data for INPUT_DURATION is stored.

See also:

Constant Value: 1 (0x00000001)

LAYOUT_MEASURE_DURATION

added in version 26.1.0
int LAYOUT_MEASURE_DURATION

A flag indicating that the metrics should track the layout duration. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate all of the metrics that should be tracked for that activity.

Constant Value: 4 (0x00000004)

LAYOUT_MEASURE_INDEX

added in version 26.1.0
int LAYOUT_MEASURE_INDEX

The index in the metrics array where the data for LAYOUT_MEASURE_DURATION is stored.

See also:

Constant Value: 2 (0x00000002)

SWAP_DURATION

added in version 26.1.0
int SWAP_DURATION

A flag indicating that the metrics should track the swap duration. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate all of the metrics that should be tracked for that activity.

Constant Value: 64 (0x00000040)

SWAP_INDEX

added in version 26.1.0
int SWAP_INDEX

The index in the metrics array where the data for COMMAND_DURATION is stored.

See also:

Constant Value: 6 (0x00000006)

SYNC_DURATION

added in version 26.1.0
int SYNC_DURATION

A flag indicating that the metrics should track the sync duration. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate all of the metrics that should be tracked for that activity.

Constant Value: 16 (0x00000010)

SYNC_INDEX

added in version 26.1.0
int SYNC_INDEX

The index in the metrics array where the data for SYNC_DURATION is stored.

See also:

Constant Value: 4 (0x00000004)

TOTAL_DURATION

added in version 26.1.0
int TOTAL_DURATION

A flag indicating that the metrics should track the total duration. This flag may be OR'd with the other flags here when calling FrameMetricsAggregator(int) to indicate all of the metrics that should be tracked for that activity.

Constant Value: 1 (0x00000001)

TOTAL_INDEX

added in version 26.1.0
int TOTAL_INDEX

The index in the metrics array where the data for TOTAL_DURATION is stored.

See also:

Constant Value: 0 (0x00000000)

Public constructors

FrameMetricsAggregator

added in version 26.1.0
FrameMetricsAggregator ()

Constructs a FrameMetricsAggregator object that will track TOTAL_DURATION metrics. If more fine-grained metrics are needed, use FrameMetricsAggregator(int) instead.

FrameMetricsAggregator

added in version 26.1.0
FrameMetricsAggregator (int metricTypeFlags)

Constructs a FrameMetricsAggregator object that will track the metrics specified bty metricTypeFlags, which is a value derived by OR'ing together metrics constants such as TOTAL_DURATION to specify all metrics that should be tracked. For example, TOTAL_DURATION | DRAW_DURATION will track both the total and draw durations for every frame.

Parameters
metricTypeFlags int: A bitwise collection of flags indicating which metrics should be recorded.

Public methods

add

added in version 26.1.0
void add (Activity activity)

Starts recording frame metrics for the given activity.

Parameters
activity