Skip to content

Commit 92dbf9e

Browse files
Marcello AlbanoGerrit Code Review
Marcello Albano
authored and
Gerrit Code Review
committed
Merge "Fixed baseline profile generation on android U and updated baseline profile in integration test" into androidx-main
2 parents b77b654 + 402276a commit 92dbf9e

File tree

2 files changed

+350
-87
lines changed

2 files changed

+350
-87
lines changed

benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/BaselineProfiles.kt

+7-11
Original file line numberDiff line numberDiff line change
@@ -302,18 +302,14 @@ private fun reportResults(
302302
private fun extractProfile(packageName: String): String {
303303

304304
val dumpCommand = "pm dump-profiles --dump-classes-and-methods $packageName"
305-
if (BuildCompat.isAtLeastU()) {
306-
// On api 34 this will produce an output like:
307-
// Profile saved to '/data/misc/profman/<PACKAGE_NAME>-primary.prof.txt'
308-
val stdout = Shell.executeScriptCaptureStdout(dumpCommand).trim()
309-
val expected = "Profile saved to '/data/misc/profman/$packageName-primary.prof.txt'"
310-
check(stdout == expected) {
311-
"Expected `pm dump-profiles` stdout to be $expected but was $stdout"
312-
}
313-
} else {
314-
// On api 33 and below this command does not produce any output
315-
Shell.executeScriptSilent(dumpCommand)
305+
val stdout = Shell.executeScriptCaptureStdout(dumpCommand).trim()
306+
val expected = "Profile saved to '/data/misc/profman/$packageName-primary.prof.txt'"
307+
308+
// Output of profman was empty in previous version and can be `expected` on newer versions.
309+
check(stdout.isBlank() || stdout == expected) {
310+
"Expected `pm dump-profiles` stdout to be either black or `$expected` but was $stdout"
316311
}
312+
317313
val fileName = "$packageName-primary.prof.txt"
318314
Shell.executeScriptSilent(
319315
"mv /data/misc/profman/$fileName ${Outputs.dirUsableByAppAndShell}/"

0 commit comments

Comments
 (0)