# Metric.CaptureInfo

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

*** ** * ** ***

<br />

```
@ExperimentalMetricApi
public final class Metric.CaptureInfo
```

<br />

*** ** * ** ***

Contextual information about the environment where metrics are captured, such as `https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo#apiLevel()` and `https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo#targetPackageName()`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo#CaptureInfo(kotlin.Int,kotlin.String,kotlin.String,androidx.benchmark.macro.StartupMode,kotlin.Long)( int apiLevel, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html targetPackageName, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html testPackageName, https://developer.android.com/reference/androidx/benchmark/macro/StartupMode startupMode, https://developer.android.com/reference/java/lang/Long.html artMainlineVersion )` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo` | `https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo#forLocalCapture(kotlin.String,androidx.benchmark.macro.StartupMode)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html targetPackageName, https://developer.android.com/reference/androidx/benchmark/macro/StartupMode startupMode )` Constructs a CaptureInfo for a local run on the current device, from the current process. |
| `final int` | `https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo#getApiLevel()()` `Build.VERSION.SDK_INT` at time of capture. |
| `final https://developer.android.com/reference/java/lang/Long.html` | `https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo#getArtMainlineVersion()()` ART mainline version, or `-1` if on a OS version without ART mainline (\<30). |
| `final https://developer.android.com/reference/androidx/benchmark/macro/StartupMode` | `https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo#getStartupMode()()` StartupMode for the target application, if the app was forced to launch in a specific state, `null` otherwise. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo#getTargetPackageName()()` Package name of the app process being measured. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/benchmark/macro/Metric.CaptureInfo#getTestPackageName()()` Package name of the test/benchmarking process. |

## Public constructors

### CaptureInfo

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.4.0)

```
public CaptureInfo(
    int apiLevel,
    @NonNull String targetPackageName,
    @NonNull String testPackageName,
    StartupMode startupMode,
    Long artMainlineVersion
)
```

## Public methods

### forLocalCapture

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.4.0)

```
public static final @NonNull Metric.CaptureInfo forLocalCapture(
    @NonNull String targetPackageName,
    StartupMode startupMode
)
```

Constructs a CaptureInfo for a local run on the current device, from the current process.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html targetPackageName` | Package name of the app being measured. |
| `https://developer.android.com/reference/androidx/benchmark/macro/StartupMode startupMode` | StartupMode for the target application, if the app was forced to launch in a specific state, `null` otherwise. |

### getApiLevel

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.2.0)

```
public final int getApiLevel()
```

`Build.VERSION.SDK_INT` at time of capture.

### getArtMainlineVersion

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.4.0)

```
public final Long getArtMainlineVersion()
```

ART mainline version, or `-1` if on a OS version without ART mainline (\<30). `null` if captured from a fixed trace, where mainline version is unknown.

### getStartupMode

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.2.0)

```
public final StartupMode getStartupMode()
```

StartupMode for the target application, if the app was forced to launch in a specific state, `null` otherwise.

### getTargetPackageName

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.2.0)

```
public final @NonNull String getTargetPackageName()
```

Package name of the app process being measured.

### getTestPackageName

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.2.0)

```
public final @NonNull String getTestPackageName()
```

Package name of the test/benchmarking process.