# BaselineProfileConfig.Builder

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/BaselineProfileConfig.kt+class:androidx.benchmark.macro.BaselineProfileConfig.Builder) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.4.0)

*** ** * ** ***


```
public final class BaselineProfileConfig.Builder
```

<br />

*** ** * ** ***

Can be used to build a `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig` instance.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder#Builder(kotlin.String,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html packageName, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/MacrobenchmarkScope, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> profileBlock )` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig` | `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder#build()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder#setFilterPredicate(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> filterPredicate )` Overrides the function used to filter individual rules / lines of the baseline profile. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder#setIncludeInStartupProfile(kotlin.Boolean)(boolean includeInStartupProfile)` Overrides the bit that determines whether the generated profile should be also used as a startup profile. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder#setMaxIterations(kotlin.Int)(int maxIterations)` Overrides the maximum number of iterations to run when collecting profiles. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder#setOutputFilePrefix(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html outputFilePrefix)` Sets the optional file name prefix used when creating the output file with the contents of the human readable baseline profile. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder#setStableIterations(kotlin.Int)(int stableIterations)` Overrides the minimum number of iterations to observe as stable before assuming stability, and completing profile generation. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder#setStrictStability(kotlin.Boolean)(boolean strictStability)` Overrides the bit that enforces if the generated profile was stable |

## Public constructors

### Builder

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

```
public Builder(
    @NonNull String packageName,
    @NonNull Function1<@NonNull MacrobenchmarkScope, Unit> profileBlock
)
```

## Public methods

### build

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

```
public final @NonNull BaselineProfileConfig build()
```

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig` | the `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig` instance. |

### setFilterPredicate

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

```
public final @NonNull BaselineProfileConfig.Builder setFilterPredicate(
    @NonNull Function1<@NonNull String, @NonNull Boolean> filterPredicate
)
```

Overrides the function used to filter individual rules / lines of the baseline profile. By default, no filters are applied. Note that this works only when the target application's code is not obfuscated.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | The `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` instance for chaining. |

### setIncludeInStartupProfile

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

```
public final @NonNull BaselineProfileConfig.Builder setIncludeInStartupProfile(boolean includeInStartupProfile)
```

Overrides the bit that determines whether the generated profile should be also used as a startup profile. A startup profile is utilized during the build process in order to determine which classes are needed in the primary dex to optimize the startup time. This flag should be used only for startup flows, such as main application startup pre and post login or other entry points of the app. Note that methods collected in a startup profiles are also utilized for baseline profiles.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | The `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` instance for chaining. |

### setMaxIterations

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

```
public final @NonNull BaselineProfileConfig.Builder setMaxIterations(int maxIterations)
```

Overrides the maximum number of iterations to run when collecting profiles.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | The `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` instance for chaining. |

### setOutputFilePrefix

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

```
public final @NonNull BaselineProfileConfig.Builder setOutputFilePrefix(@NonNull String outputFilePrefix)
```

Sets the optional file name prefix used when creating the output file with the contents of the human readable baseline profile. For example: `outputFilePrefix-baseline-prof.txt`

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | The `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` instance for chaining. |

### setStableIterations

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

```
public final @NonNull BaselineProfileConfig.Builder setStableIterations(int stableIterations)
```

Overrides the minimum number of iterations to observe as stable before assuming stability, and completing profile generation.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | The `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` instance for chaining. |

### setStrictStability

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

```
public final @NonNull BaselineProfileConfig.Builder setStrictStability(boolean strictStability)
```

Overrides the bit that enforces if the generated profile was stable

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` | The `https://developer.android.com/reference/androidx/benchmark/macro/BaselineProfileConfig.Builder` instance for chaining. |