# androidx.benchmark.macro

*** ** * ** ***

## Classes

|---|---|
| `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/BaselineProfileConfig` |   |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/BaselineProfileConfig.Builder` | Can be used to build a `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/BaselineProfileConfig` instance. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/BaselineProfileResult` | A container for the results of collecting Baseline Profiles using the `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/package-summary#collect(kotlin.String,kotlin.String,kotlin.Int,kotlin.Int,kotlin.Boolean,kotlin.Boolean,kotlin.Function1,kotlin.Function1)` API. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/CompilationMode` | Type of compilation to use for a Macrobenchmark. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/CompilationMode.Full` | Full ahead-of-time compilation of all method (but not classes) in the target application. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/CompilationMode.Ignore` | This compilation mode doesn't perform any reset or compilation, leaving the user the choice to implement these steps. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/CompilationMode.None` | No pre-compilation - a compilation profile reset is performed and the entire app will be allowed to Just-In-Time compile as it runs. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/CompilationMode.Partial` | Partial ahead-of-time app compilation. |
| `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/MacrobenchmarkScope` | Provides access to common operations in app automation, such as killing the app, or navigating home. |
| `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. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/Metric` | Metric interface. |
| `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://developer.android.com/reference/kotlin/androidx/benchmark/macro/Metric.Measurement` | Represents a Metric's measurement of a single iteration. |
| `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/PowerMetric.Type` | Configures the PowerMetric request. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/PowerMetric.Type.Battery` |   |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/PowerMetric.Type.Energy` |   |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/PowerMetric.Type.Power` |   |
| `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()`. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric.Mode` |   |

## Objects

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric.Mode.Average` | Average duration of trace sections matching `sectionName` in the trace. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric.Mode.Count` | Counts the number of observed instances of a trace section matching `sectionName` in the trace. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric.Mode.First` | Captures the duration of the first instance of `sectionName` in the trace. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric.Mode.Max` | Reports the maximum observed duration for a trace section matching `sectionName` in the trace. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric.Mode.Min` | Reports the maximum observed duration for a trace section matching `sectionName` in the trace. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric.Mode.Sum` | Captures the sum of all instances of `sectionName` in the trace. |

## Annotations

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/ExperimentalMacrobenchmarkApi` |   |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/ExperimentalMetricApi` |   |

## Enums

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/BaselineProfileMode` | Choice of how the Baseline Profile in a target application should be included or ignored during pre-compilation. |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/MemoryUsageMetric.Mode` |   |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/MemoryUsageMetric.SubMetric` |   |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/PowerCategory` |   |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/PowerCategoryDisplayLevel` |   |
| `https://developer.android.com/reference/kotlin/androidx/benchmark/macro/StartupMode` |   |

## Top-level functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/benchmark/macro/ExperimentalMetricApi https://developer.android.com/reference/kotlin/androidx/benchmark/macro/package-summary#assertEqualMeasurements(kotlin.collections.List,kotlin.collections.List,kotlin.Double)( expected: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/benchmark/macro/Metric.Measurement>, observed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/benchmark/macro/Metric.Measurement>, threshold: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html )` Asserts that the two lists of Measurements are equal with a threshold for data, ignoring list order. |

## Top-level functions

### assertEqualMeasurements

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/MetricResultExtensions.kt+function:assertEqualMeasurements) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.2.0)

```
@ExperimentalMetricApi
fun assertEqualMeasurements(
    expected: List<Metric.Measurement>,
    observed: List<Metric.Measurement>,
    threshold: Double
): Unit
```

Asserts that the two lists of Measurements are equal with a threshold for data, ignoring list order.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` |   |