MemoryUsageMetric


@ExperimentalMetricApi
public final class MemoryUsageMetric extends TraceMetric


Metric for tracking the memory usage of the target application.

There are two modes for measurement - Last, which represents the last observed value during an iteration, and Max, which represents the largest sample observed per measurement.

By default, reports:

  • memoryRssAnonKb - Anonymous resident/allocated memory owned by the process, not including memory mapped files or shared memory.

  • memoryRssAnonFileKb - Memory allocated by the process to map files.

  • memoryHeapSizeKb - Heap memory allocations from the Android Runtime, sampled after each GC.

  • memoryGpuKb - GPU Memory allocated for the process.

By passing a custom subMetrics list, you can enable other SubMetrics.

Summary

Nested types

public enum MemoryUsageMetric.Mode extends Enum
public enum MemoryUsageMetric.SubMetric extends Enum

Public constructors

Public methods

@NonNull List<@NonNull Metric.Measurement>

Get the metric result for a given iteration given information about the target process and a TraceProcessor session

Public constructors

MemoryUsageMetric

public MemoryUsageMetric(
    @NonNull MemoryUsageMetric.Mode mode,
    @NonNull List<@NonNull MemoryUsageMetric.SubMetric> subMetrics
)

Public methods

getMeasurements

Added in 1.3.0-alpha03
public @NonNull List<@NonNull Metric.MeasurementgetMeasurements(
    @NonNull Metric.CaptureInfo captureInfo,
    @NonNull PerfettoTraceProcessor.Session traceSession
)

Get the metric result for a given iteration given information about the target process and a TraceProcessor session