Macrobenchmark Instrumentation Arguments

Configure the behavior of the library with the following instrumentation arguments. These can either be added to your Gradle configuration or applied directly when running instrumentation from the command line. If using Gradle, add the arguments to testInstrumentationRunnerArguments:

android {
    defaultConfig {
        // ...
        testInstrumentationRunnerArguments["androidx.benchmark.enabledRules"] = "BaselineProfile"

If calling directly from command line, use -P android.testInstrumentationRunnerArguments.[name of the argument].

./gradlew :benchmark:connectedAndroidTest -P android.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile


Allows disabling compilation between each iteration of the benchmark. By default, the target application is re-installed and re-compiled between each benchmark, to respect the CompilationMode passed into measureRepeated. Disabling this allows you to skip both reinstall and compilation if, for example, you want to fully compile the target app once before running the test suite, and run all benchmarks against that fully compiled target.

  • Argument type: boolean
  • Defaults to: true


Allows running benchmarks in single loop to verify they work properly. It can be used with regular tests as part of verification.

  • Argument type: boolean
  • Defaults to: false


Allows filtering runs to just one type of test - Baseline Profile generation or Macrobenchmark test. Comma-separated list also supported.

  • Argument type: string
  • Available options:
    • Macrobenchmark
    • BaselineProfile
  • Defaults to: Not specified

androidx.benchmark.fullTracing.enable (Experimental)

Enables androidx.tracing.perfetto tracepoints such as Jetpack Compose composition tracing. Note this only affects when StartupMode.COLD is not used, since enabling the tracepoints wakes the target process.

  • Argument type: boolean
  • Defaults to: false


Accepts comma-separated list of errors to turn into warnings.

  • Argument type: list of strings
  • Available options:
  • Defaults to: an empty list


Configures where JSON benchmark reports and profiling results are saved on device.

  • Argument type: file path string
  • Defaults to: test APK's external directory