Status Update
Comments
ra...@google.com <ra...@google.com> #2
ml...@google.com <ml...@google.com> #3
ra...@google.com <ra...@google.com> #4
Branch: androidx-master-dev
commit 3ed3fb003fa6c1244f923202859a616225b5b2fa
Author: Ian Lake <ilake@google.com>
Date: Fri Feb 14 11:17:46 2020
Create an interface for layouts that can be opened
Create a common interface that represents layouts
that have two states: open and closed. This allows
higher level libraries to rely on the interface,
rather than concrete implementations such as
DrawerLayout, making them more resilient to
changes in the current recommended implementation.
Fixes: 129979320
Test: ./gradlew checkApi
Change-Id: I0f2a1414977825aa053c6555261f2b7d4417bd19
M customview/customview/api/1.1.0-alpha02.txt
M customview/customview/api/current.txt
M customview/customview/api/public_plus_experimental_1.1.0-alpha02.txt
M customview/customview/api/public_plus_experimental_current.txt
M customview/customview/api/restricted_1.1.0-alpha02.txt
M customview/customview/api/restricted_current.txt
A customview/customview/src/main/java/androidx/customview/widget/Openable.java
M drawerlayout/drawerlayout/api/1.1.0-alpha03.txt
M drawerlayout/drawerlayout/api/current.txt
M drawerlayout/drawerlayout/api/public_plus_experimental_1.1.0-alpha03.txt
M drawerlayout/drawerlayout/api/public_plus_experimental_current.txt
M drawerlayout/drawerlayout/api/restricted_1.1.0-alpha03.txt
M drawerlayout/drawerlayout/api/restricted_current.txt
M drawerlayout/drawerlayout/build.gradle
M drawerlayout/drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java
M jetifier/jetifier/migration.config
M slidingpanelayout/slidingpanelayout/api/1.1.0-alpha01.txt
M slidingpanelayout/slidingpanelayout/api/current.txt
M slidingpanelayout/slidingpanelayout/api/public_plus_experimental_1.1.0-alpha01.txt
M slidingpanelayout/slidingpanelayout/api/public_plus_experimental_current.txt
M slidingpanelayout/slidingpanelayout/api/restricted_1.1.0-alpha01.txt
M slidingpanelayout/slidingpanelayout/api/restricted_current.txt
M slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
ml...@google.com <ml...@google.com> #5
I have a feeling there's a lot of implicit behavior behind the startup/compilation modes, which is not easy for developers to discover or understand.
For example:
StartupMode.COLD
--> process dies betweensetupBlock
andmeasureBlock
while not in other modes- reinstalling the app on (older) user device builds
StartupMode.WARM
--> there's a additional warmup iteration
And now we'll build additional behavior that is different for StartupMode.COLD
.
ra...@google.com <ra...@google.com> #6
I understand your concern, but with the current shape of the API: we don't really have too many options to control this behavior.
Once the lower level APIs are available to write your own Macrobenchmark loop, you can do a lot more and define the bits exactly like you want. That being said, I also want to extensively document the lifecycle of a method trace better in Macrobenchmark.
ml...@google.com <ml...@google.com> #7
Ok, sounds good. Thanks for explaining!
cc...@google.com <cc...@google.com> #8
I have a feeling there's a lot of implicit behavior behind the startup/compilation modes, which is not easy for developers to discover or understand.
Agree, this is tracked in
And now we'll build additional behavior that is different for StartupMode.COLD.
This is a good point, and I agree we shouldn't be making StartupMode.COLD even more complex to reason about. I'd prefer we say method tracing is always on during the measurement in macrobenchmarks (assuming you use macrobench to start/kill the process), and we should make that work automatically.
ra...@google.com <ra...@google.com> #9
I'd prefer we say method tracing is always on during the measurement in macrobenchmarks (assuming you use macrobench to start/kill the process)
When a process is being started is not entirely obvious to an app developer. Additionally, method traces collected during startup are actually very important; so we need to make that part easy. Which is why startActivityAndWait(...)
signals a method trace start (when StartupMode.COLD
is being used), and the end of the measurement is when a method trace ends.
ml...@google.com <ml...@google.com> #10
What scenario do you have in mind that you'd want the method tracing for startup, but it wouldn't be covered by the startActivityAndWait
or measureBlock
?
If I have
startupMode = COLD
setupBlock= {
// prepare something
}
measureBlock = {
startActivityAndWait()
}
I would say I still want to only see the method trace of what I'm measuring.
If I have
startupMode = COLD
setupBlock= {
startActivityAndWait()
}
measureBlock = {
// do something in the app
}
This doesn't work, because the process is killed between setupBlock
and measureBlock
.
I can have something like
startupMode = COLD
setupBlock= {
sendABroadcastWhichWakesTheProcess()
}
measureBlock = {
startActivityAndWait()
}
But I would still expect the method trace to run in the measureBlock
?
The process would be killed after setupBlock
anyway, so the method trace can't really survive, can it?
Maybe I'm missing some scenario though.
cc...@google.com <cc...@google.com> #11
Summarizing an offline convo about how we plan to do this:
- at beginning of measure block:
- start method tracing if process alive
- (in measure block) process started
- start process with method tracing
- (in measure block) process killed
- flush method trace before kill
- at end of measure block:
- flush method trace
No special handling for startup modes, or tracing of the setup block.
This requires a lot of checking process state, but that should only happen while method tracing, so it's worth the cost to get predictable tracing.
Note that you'll potentially get arbitrary numbers of traces depending on how many instances of the process run sequentially.
ml...@google.com <ml...@google.com> #12
I think that SG. I think the arbitraty numbers of traces is fine, because these probably matter only for further analysis.
ra...@google.com <ra...@google.com>
ap...@google.com <ap...@google.com> #13
Branch: androidx-main
commit 81955ec73236d3862de4897aa4fa8ad53c453e89
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Fri Apr 12 15:10:25 2024
Improve lifecycle of a method trace in a Macrobenchmark.
* Previously, when method tracing was turned on for a Macrobenchmark, the trace session would start with a process cold start, and end at the end of a `measureBlock()`.
* This change makes it so that Macrobenchmark automatically attaches to the process to start a profiler or uses `start-profiler` under the hood when using `startActivityAndWait(...)`.
* Tracing starts correctly on process start inside a `measureBlock` or at the beginning of a `measureBlock` and therefore we always get a well scoped trace at the end.
Test: Added MacrobenchmarkScopeTest
Bug: 300651094
Relnote: Make it simpler to capture method traces for a Macrobenchmark is scoped to the duration of the actual `measureBlock()`. Previously, it started at target process launch and only supported cold startss
Change-Id: Iee85a37d5b03d92a3128c976b41bd145b2921161
M benchmark/benchmark-common/src/main/java/androidx/benchmark/Profiler.kt
M benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/MacrobenchmarkScopeTest.kt
M benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Macrobenchmark.kt
M benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/MacrobenchmarkScope.kt
Description
When you enable method tracing for benchmarks, it's currently started with
startActivityAndWait
and it's disabled after the benchmark finishes.Method tracing collects huge amount of data which might result in big trace file and might take long due to its nature to slow down the app's performance.
This causes problems for scenarios navigating to a certain screen and starting collection from there. For example start the app, log in, navigate to a screen and scroll some content. The interested part is only scrolling the content.
There might be several options how this could work:
Enable method traces for
measureBlock
. This would be intuitive with when benchmarks actually record data.Have API to dynamically enable/disable method tracing. This might be helpful to record only part of the measure block. This could result in more polluted API though. What if you don't pass method androidx.benchmark.profiling.mode=MethodTracing`, but call the API?