MemoryUsageMetric
@ExperimentalMetricApi
public final class MemoryUsageMetric extends TraceMetric
| java.lang.Object | |||
| ↳ | 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 |
|---|
public enum MemoryUsageMetric.Mode extends Enum |
public enum MemoryUsageMetric.SubMetric extends Enum |
Public constructors |
|---|
MemoryUsageMetric( |
Public methods |
|
|---|---|
@NonNull List<@NonNull Metric.Measurement> |
getMeasurements(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
public @NonNull List<@NonNull Metric.Measurement> getMeasurements(
@NonNull Metric.CaptureInfo captureInfo,
@NonNull TraceProcessor.Session traceSession
)
Get the metric result for a given iteration given information about the target process and a TraceProcessor session