# Metric

Artifact: [androidx.benchmark:benchmark-macro](https://developer.android.com/jetpack/androidx/releases/benchmark) [View Source](https://cs.android.com/search?q=file:androidx/benchmark/macro/Metric.kt+class:androidx.benchmark.macro.Metric) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.1.0)

*** ** * ** ***

<br />

```
sealed class Metric
```

<br />

Known direct subclasses [ArtMetric](https://developer.android.com/reference/kotlin/androidx/benchmark/macro/ArtMetric), [FrameTimingGfxInfoMetric](https://developer.android.com/reference/kotlin/androidx/benchmark/macro/FrameTimingGfxInfoMetric), [FrameTimingMetric](https://developer.android.com/reference/kotlin/androidx/benchmark/macro/FrameTimingMetric), [PowerMetric](https://developer.android.com/reference/kotlin/androidx/benchmark/macro/PowerMetric), [StartupTimingMetric](https://developer.android.com/reference/kotlin/androidx/benchmark/macro/StartupTimingMetric), [TraceMetric](https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceMetric), [TraceSectionMetric](https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/ArtMetric` | Captures metrics about ART method/class compilation and initialization. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/FrameTimingGfxInfoMetric` | Version of FrameTimingMetric based on 'dumpsys gfxinfo' instead of trace data. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/FrameTimingMetric` | Metric which captures timing information from frames produced by a benchmark, such as a scrolling or animation benchmark. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/PowerMetric` | Captures the change of power, energy or battery charge metrics over time for specified duration. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/StartupTimingMetric` | Captures app startup timing metrics. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceMetric` | Metric which captures results from a Perfetto trace with custom `https://developer.android.com/reference/kotlin/androidx/benchmark/traceprocessor/TraceProcessor` queries. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric` | Captures the time taken by named trace section - a named begin / end pair matching the provided `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric#sectionNames()`. |

Known indirect subclasses [MemoryCountersMetric](https://developer.android.com/reference/kotlin/androidx/benchmark/macro/MemoryCountersMetric), [MemoryUsageMetric](https://developer.android.com/reference/kotlin/androidx/benchmark/macro/MemoryUsageMetric)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/MemoryCountersMetric` | Captures the number of page faults over time for a target package name. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/MemoryUsageMetric` | Metric for tracking the memory usage of the target application. |

*** ** * ** ***

Metric interface.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/benchmark/macro/ExperimentalMetricApi class https://developer.android.com/reference/kotlin/androidx/benchmark/macro/Metric.CaptureInfo` Contextual information about the environment where metrics are captured, such as `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/Metric.CaptureInfo#apiLevel()` and `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/Metric.CaptureInfo#targetPackageName()`. |
| `@https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-consistent-copy-visibility/index.html @https://developer.android.com/reference/kotlin/androidx/benchmark/macro/ExperimentalMetricApi data class https://developer.android.com/reference/kotlin/androidx/benchmark/macro/Metric.Measurement` Represents a Metric's measurement of a single iteration. |

| ### Protected constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/Metric#Metric()()` |

## Protected constructors

### Metric

```
protected Metric()
```