Assigned
Status Update
Comments
ma...@gmail.com <ma...@gmail.com> #2
Update: according to the trace, dex2oat starts at the same moment as the application. So i guess, the problem lays in xiaomi firmware that starts the optimization with the application during benchmark
ra...@google.com <ra...@google.com>
pa...@gmail.com <pa...@gmail.com> #3
Have the same issue
Device: Realme 8 Pro (updated to Android 13)
Lib versions: profileInstaller & benchmark-macro = 1.2.0-alpha13
Error StackTrace:
java.lang.IllegalStateException: Check failed.
at androidx.benchmark.macro.CompilationMode$Companion.cmdPackageCompile$benchmark_macro_release(CompilationMode.kt:436)
at androidx.benchmark.macro.CompilationMode$Partial.compileImpl$benchmark_macro_release(CompilationMode.kt:308)
at androidx.benchmark.macro.CompilationMode.resetAndCompile$benchmark_macro_release(CompilationMode.kt:115)
at androidx.benchmark.macro.CompilationMode.resetAndCompile$benchmark_macro_release$default(CompilationMode.kt:77)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmark(Macrobenchmark.kt:185)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmarkWithStartupMode(Macrobenchmark.kt:365)
at androidx.benchmark.macro.junit4.MacrobenchmarkRule.measureRepeated(MacrobenchmarkRule.kt:107)
at com.example.StartupBenchmarks.startup(StartupBenchmarks.kt:58)
at com.example.StartupBenchmarks.startupWithBaselieProfile(StartupBenchmarks.kt:53)
The same test runs successfully on the other device Teclast T40 Pro (Android 11) and emulators.
cc...@google.com <cc...@google.com> #4
Try using benchmark-macro 1.3.0 alpha, which has a more specific exception message for this problem.
Please also try issuing the command manually, and reporting the result here:
adb shell cmd package compile -f -m speed com.masum.pdfreader # your package name here
My guess is either the device has an unexpected success output, or it's failing to compile for some reason. If it works on other devices, it's likely an issue with the device.
Description
Version used:1.2.2
Devices/Android versions reproduced on: Android 11
Error
java.lang.IllegalStateException: Check failed.
at androidx.benchmark.macro.CompilationMode$Companion.cmdPackageCompile$benchmark_macro_release(CompilationMode.kt:423)
at androidx.benchmark.macro.CompilationMode$Full.compileImpl$benchmark_macro_release(CompilationMode.kt:358)
at androidx.benchmark.macro.CompilationMode.resetAndCompile$benchmark_macro_release(CompilationMode.kt:112)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmark(Macrobenchmark.kt:184)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmarkWithStartupMode(Macrobenchmark.kt:367)
My Code
@RunWith(AndroidJUnit4::class)
class ExampleStartupBenchmark {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@Test
fun startupCompilationNone() = startup(CompilationMode.None())
@Test
fun startupCompilationPartial() = startup(CompilationMode.Partial())
@Test
fun startupCompilationFull() = startup(CompilationMode.Full())
fun startup(compilationMode: CompilationMode) = benchmarkRule.measureRepeated(
packageName = "com.masum.pdfreader",
metrics = listOf(StartupTimingMetric()),
iterations = 5,
compilationMode = CompilationMode.Full(), // Set the compilation mode
startupMode = StartupMode.COLD
) {
pressHome()
startActivityAndWait()
}