performance-samples icon indicating copy to clipboard operation
performance-samples copied to clipboard

java.lang.IllegalStateException: Failed to compile (out=Error: Failed to cpmpile !

Open vikasraimeesho opened this issue 1 year ago • 3 comments

java.lang.IllegalStateException: Failed to compile (out=Error: Failed to cpmpile !
)
at androidx.benchmark.macro.CompilationMode$Companion.cmdPackageCompile$benchmark_macro_release(CompilationMode.kt:434)
at androidx.benchmark.macro.CompilationMode$Partial.compileImpl$benchmark_macro_release(CompilationMode.kt:307)
at androidx.benchmark.macro.CompilationMode.resetAndCompile$benchmark_macro_release(CompilationMode.kt:114)
at androidx.benchmark.macro.CompilationMode.resetAndCompile$benchmark_macro_release$default(CompilationMode.kt:75)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmark(Macrobenchmark.kt:237)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmarkWithStartupMode(Macrobenchmark.kt:436)
at androidx.benchmark.macro.junit4.MacrobenchmarkRule.measureRepeated(MacrobenchmarkRule.kt:107)
at com.meesho.baselineprofile.StartupBenchmarks.benchmark(StartupBenchmarks.kt:52)
at com.meesho.baselineprofile.StartupBenchmarks.startupCompilationBaselineProfiles()

I'm trying to add benchmark profile for my project. Below is the generated code by the android studio. The startupCompilationNone() method is compiling fine but startupCompilationBaselineProfiles is getting failed with above stacktrace.

@RunWith(AndroidJUnit4::class)
@LargeTest
class StartupBenchmarks {

    @get:Rule
    val rule = MacrobenchmarkRule()

    @Test
    fun startupCompilationNone() =
        benchmark(CompilationMode.None())

    @Test
    fun startupCompilationBaselineProfiles() =
        benchmark(CompilationMode.Partial(BaselineProfileMode.Require))

    private fun benchmark(compilationMode: CompilationMode) {
        // This example works only with the variant with application id `com.example.myapplication`."
        rule.measureRepeated(
            packageName = "com.example.myapplication",
            metrics = listOf(StartupTimingMetric()),
            compilationMode = compilationMode,
            startupMode = StartupMode.COLD,
            iterations = 10,
            setupBlock = {
                pressHome()
            },
            measureBlock = {
                startActivityAndWait()

                // TODO Add interactions to wait for when your app is fully drawn.
                // The app is fully drawn when Activity.reportFullyDrawn is called.
                // For Jetpack Compose, you can use ReportDrawn, ReportDrawnWhen and ReportDrawnAfter
                // from the AndroidX Activity library.

                // Check the UiAutomator documentation for more information on how to
                // interact with the app.
                // https://d.android.com/training/testing/other-components/ui-automator
            }
        )
    }
}

vikasraimeesho avatar May 05 '24 22:05 vikasraimeesho

Thanks for bringing this up. This does not look like an issue with the sample to me. Can you verify that this occurs on the sample app in this repository?

keyboardsurfer avatar May 06 '24 07:05 keyboardsurfer

@keyboardsurfer I just verified it, Its happening on the sample app as well.

com.example.macrobenchmark.benchmark.startup.ColdStartupBenchmark > startupFullCompilation[RMX1992 - 11] FAILED 
	java.lang.IllegalStateException: Failed to compile (out=Error: Failed to cpmpile !
	)

vikasraimeesho avatar May 09 '24 17:05 vikasraimeesho

This could be a device specific issue as we don't observe this with the benchmarking sample in general. Please file a bug against benchmarking and include details on the device setup you're using there.

keyboardsurfer avatar May 10 '24 11:05 keyboardsurfer