Status Update
Comments
cc...@google.com <cc...@google.com> #2
Branch: androidx-main
commit 5f42f07ec2b8acf74af422829d8e95d775107af0
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Wed Oct 13 17:48:56 2021
Add a `measureRepeated` overload for `MacrobenchmarkRule`
* Uses a `Consumer<MacrobenchmarkScope>` which makes things easier for Java developers.
Test: Updated unit test.
Bug:
Relnote: Uses a `Consumer<MacrobenchmarkScope>` functional interface, that makes it easy for Java developers to author Macrobenchmarks.
Change-Id: If74abe75c4b0defd0016acd3de20689cf604badd
M benchmark/benchmark-macro-junit4/build.gradle
M benchmark/benchmark-macro-junit4/api/restricted_1.1.0-beta01.txt
M benchmark/benchmark-macro-junit4/src/main/java/androidx/benchmark/macro/junit4/MacrobenchmarkRule.kt
M benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialStartupJavaBenchmark.java
M benchmark/benchmark-macro-junit4/api/current.txt
M benchmark/benchmark-macro-junit4/api/restricted_current.txt
M benchmark/benchmark-macro-junit4/api/public_plus_experimental_1.1.0-beta01.txt
M benchmark/benchmark-macro-junit4/api/1.1.0-beta01.txt
M benchmark/benchmark-macro-junit4/api/public_plus_experimental_current.txt
dv...@gmail.com <dv...@gmail.com> #3
Branch: androidx-main
commit 93b34a82a8608e02f25b02e85c43b0a59f4babda
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Wed Oct 13 16:21:53 2021
Better Java APIs for Macrobenchmarks.
* Add @JvmOverloads for default paramters.
Bug:
Test: Added a `TrivialStartupJavaBenchmark`
Change-Id: I644fe5b1ba90200ae264e8dabd68ae27689befa8
Relnote: Better Java APIs for Macrobenchmarks.
M benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/MacrobenchmarkScope.kt
M benchmark/benchmark-macro/api/current.txt
M benchmark/benchmark-macro/api/restricted_1.1.0-beta01.txt
A benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialStartupJavaBenchmark.java
M benchmark/benchmark-macro/api/public_plus_experimental_1.1.0-beta01.txt
M benchmark/benchmark-macro/api/1.1.0-beta01.txt
M benchmark/benchmark-macro/api/public_plus_experimental_current.txt
M benchmark/benchmark-macro/api/restricted_current.txt
cc...@google.com <cc...@google.com> #4
Uploaded a change to do the simpler version of this, which just allows top level customization of config:
A "proper" solution which lets Metrics contribute DataSources to be merged together is complex, as it requires central coordination of underlying buffer ids and sizes, at minimum. For now, we'll just let advanced users fully customize this.
We can see what feedback on the simpler approach is in 1.3, and see if there's still need for something more advanced.
cc...@google.com <cc...@google.com> #5
InMemoryTrace
My instinct is to avoid using InMemoryTrace in macrobenchmark entirely, as traces can be arbitrarily long, so the cost of --full-sort is likely not worth the benefit, at least in how macrobenchmark uses it. InMemoryTrace is most useful for microbenchmark - injecting trace events after the fact, at 0 cost during very sensitive measurement, and with limited trace durations.
You can consider using androidx.tracing:tracing-perfetto
if you want additional tracepoints, though this adds startup complexity and requires
Probably worth a separate bug if we want to discuss further.
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit 5d5db95b1b823a1a174fbfc11fa6589c5988f378
Author: Chris Craik <ccraik@google.com>
Date: Thu Apr 11 15:04:05 2024
Enable passing custom PerfettoConfig to Macrobenchmark
Test: MacrobenchmarkTest
Test: ./gradlew benchmark:benchmark-macro:lintDebug
Fixes: 309841164
Bug: 304038384
Relnote: "Added experimental MacrobenchmarkRule#measureRepeated
variant which takes a custom PerfettoConfig for fully customized
Perfetto trace recording. Note that incorrectly configured configs may
cause built in Metric classes to fail."
Change-Id: Idfd3d0c071005f04f8be9975c6379e6095416775
M benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoConfig.kt
M benchmark/benchmark-macro-junit4/api/current.txt
M benchmark/benchmark-macro-junit4/api/restricted_current.txt
M benchmark/benchmark-macro-junit4/build.gradle
M benchmark/benchmark-macro-junit4/src/main/java/androidx/benchmark/macro/junit4/MacrobenchmarkRule.kt
M benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/MacrobenchmarkTest.kt
M benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Macrobenchmark.kt
Description
Component used: Metric Version used: latest Devices/Android versions reproduced on: Android 13, Oneplus 11
If this is a bug in the library, we would appreciate if you could attach:
When I add some new metric, I need add new Perfetto trace datasource to capture.
But there is no way to modify the PerfettoConfig class , default is PerfettonConfig.benchmark
Can you modify the macrobenchmark architecture , let Metric class has a changes to add datasource used in benchmarktest?