Status Update
Comments
cc...@google.com <cc...@google.com> #2
After some review and discussion with ART, it doesn't appear that there's any issue with tracking our allocations as such, but it can happen that allocations we request don't occur due to optimizations at compilation time.
We may need a black hole, e.g. passing objects to JNI to ensure it's not optimized out.
ja...@gmail.com <ja...@gmail.com> #3
Is there any documentation on the specifics of Microbenchmark allocation tracking? Is it counting just the Java allocs in the benchmarked code or is its 'count' also including allocs that occur via any associated DSOs underneath? (I'm inferring that this is what this ticket was originally about - apologies if I've misunderstood)
Essentially, I'd like to know whether it's possible to identify/collect allocs from invoking a Java entry-point method which subsequently calls through to some underlying DSO (inclusive of the allocations within that DSO). Macrobenchmarks seem too heavyweight with regard to this. Is there a specific mode, for the Runner say, that identifies this? As I say, some details on this would be useful. Thanks!
ra...@google.com <ra...@google.com> #4
It counts the benchmarked code + allocations incurred by its associated data structures (a.k.a. the implementation detail).
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit 23c069d4309c8798cdfccaa80478bd486508ca17
Author: Chris Craik <ccraik@google.com>
Date: Mon May 13 15:35:58 2024
Add BlackHole to enable controlling dead code elimination in Benchmark
Fixes: 286091643
Test: BlackHoleBenchmark
Relnote: "Added experimental `BlackHole.consume()` api to prevent dead
code elimination in microbenchmarks."
Change-Id: If681208c4e5ad5d054117c2320b4fd56b86f4ff5
A benchmark/benchmark-common/api/api_lint.ignore
M benchmark/benchmark-common/api/current.txt
M benchmark/benchmark-common/api/restricted_current.txt
M benchmark/benchmark-common/src/main/cpp/CMakeLists.txt
A benchmark/benchmark-common/src/main/cpp/androidx_benchmark_BlackHole.cpp
A benchmark/benchmark-common/src/main/java/androidx/benchmark/BlackHole.kt
A benchmark/benchmark-common/src/main/java/androidx/benchmark/ExperimentalBlackHoleApi.kt
M benchmark/benchmark-junit4/proguard-rules.pro
M benchmark/benchmark/build.gradle
A benchmark/benchmark/proguard-rules.pro
A benchmark/benchmark/src/androidTest/java/androidx/benchmark/benchmark/BlackHoleBenchmark.kt
pr...@google.com <pr...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.benchmark:benchmark-common:1.3.0-beta01
androidx.benchmark:benchmark-junit4:1.3.0-beta01
Description
We should confirm this, check api versions affected, and consider [switching to heapprofd](