MemoryUsageMetric
@ExperimentalMetricApi
class MemoryUsageMetric : TraceMetric
| kotlin.Any | |||
| ↳ | androidx.benchmark.macro.Metric | ||
| ↳ | androidx.benchmark.macro.TraceMetric | ||
| ↳ | androidx.benchmark.macro.MemoryUsageMetric |
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 |
|---|
enum MemoryUsageMetric.Mode : Enum |
enum MemoryUsageMetric.SubMetric : Enum |
Public constructors |
|---|
MemoryUsageMetric( |
Public functions |
|
|---|---|
open List<Metric.Measurement> |
getMeasurements(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
open fun getMeasurements(
captureInfo: Metric.CaptureInfo,
traceSession: TraceProcessor.Session
): List<Metric.Measurement>
Get the metric result for a given iteration given information about the target process and a TraceProcessor session