BaselineProfileConfig.Builder


public final class BaselineProfileConfig.Builder


Can be used to build a androidx.benchmark.macro.BaselineProfileConfig instance.

Summary

Public constructors

Builder(
    @NonNull String packageName,
    @ExtensionFunctionType @NonNull Function1<@NonNull MacrobenchmarkScopeUnit> profileBlock
)

Public methods

final @NonNull BaselineProfileConfig
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.

final @NonNull BaselineProfileConfig.Builder
setIncludeInStartupProfile(boolean includeInStartupProfile)

Overrides the bit that determines whether the generated profile should be also used as a startup profile.

final @NonNull BaselineProfileConfig.Builder
setMaxIterations(int maxIterations)

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

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.

final @NonNull BaselineProfileConfig.Builder
setStableIterations(int stableIterations)

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

final @NonNull BaselineProfileConfig.Builder
setStrictStability(boolean strictStability)

Overrides the bit that enforces if the generated profile was stable

Public constructors

Builder

Added in 1.4.0-beta02
public Builder(
    @NonNull String packageName,
    @ExtensionFunctionType @NonNull Function1<@NonNull MacrobenchmarkScopeUnit> profileBlock
)

Public methods

setFilterPredicate

Added in 1.4.0-beta02
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.

setIncludeInStartupProfile

Added in 1.4.0-beta02
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.

setMaxIterations

Added in 1.4.0-beta02
public final @NonNull BaselineProfileConfig.Builder setMaxIterations(int maxIterations)

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

setOutputFilePrefix

Added in 1.4.0-beta02
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

setStableIterations

Added in 1.4.0-beta02
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.

setStrictStability

Added in 1.4.0-beta02
public final @NonNull BaselineProfileConfig.Builder setStrictStability(boolean strictStability)

Overrides the bit that enforces if the generated profile was stable