Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacrobenchmarkRule#measureRepeated - findRepeatedlyGrowingObjects #2720

Open
timrijckaert opened this issue Nov 3, 2024 · 0 comments
Open

Comments

@timrijckaert
Copy link

👋
I just saw Py's amazing talk about HeapDiff.repeatingUiAutomatorScenario
https://www.droidcon.com/2024/10/17/root-causing-memory-growth-with-leakcanary-3/

I was excited to try it out for one of my projects.
I already have a MacrobenchmarkRule written and was wondering how to plug in the HeapDiff#repeatingUiAutomatorScenario

I was hoping something like would work

@Test
fun scrolling() {
    benchmarkRule.measureRepeated(
        packageName = "xx.xxxx.xxxx.xxxxx.xxxx",
        metrics = listOf(FrameTimingMetric()),
        iterations = 5,
        startupMode = StartupMode.COLD,
        setupBlock = {}
    ) {
        startActivityAndWait()
        val diff = detector.findRepeatedlyGrowingObjects {
            val lazyColumn = By.res("xxxxx")
            device.wait(Until.hasObject(lazyColumn), 10000L)
            pressDown()
        }
        Assert.assertEquals(diff.growingObjects, emptyList<GrowingObjectNodes>())
    }
}

However I got java.lang.IllegalStateException: Expected heap dump directory /data/local/tmp/heap_dumps_object_growth_be.persgroep.lfvp.storerfront.benchmark to exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant