MemoryUsageMetric


@ExperimentalMetricApi
class MemoryUsageMetric : 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

Public constructors

Public functions

open List<Metric.Measurement>
getMeasurements(
    captureInfo: Metric.CaptureInfo,
    traceSession: PerfettoTraceProcessor.Session
)

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

Public constructors

MemoryUsageMetric

MemoryUsageMetric(
    mode: MemoryUsageMetric.Mode,
    subMetrics: List<MemoryUsageMetric.SubMetric> = listOf( SubMetric.HeapSize, SubMetric.RssAnon, SubMetric.RssFile, SubMetric.Gpu, )
)

Public functions

getMeasurements

Added in 1.3.0-alpha03
open fun getMeasurements(
    captureInfo: Metric.CaptureInfo,
    traceSession: PerfettoTraceProcessor.Session
): List<Metric.Measurement>

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