File tree Expand file tree Collapse file tree 5 files changed +60
-15
lines changed
src/main/java/com/example/macrobenchmark/baselineprofile Expand file tree Collapse file tree 5 files changed +60
-15
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ android {
28
28
applicationId = " com.example.macrobenchmark.target"
29
29
versionCode = 1
30
30
versionName = " 1.0"
31
- minSdk = 21 // Minimum SDK for target application can be lower than for benchmarks.
31
+ minSdk = 24
32
32
targetSdk = 34
33
33
testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
34
34
}
Original file line number Diff line number Diff line change 1
1
[versions ]
2
- agp = " 8.1.4 "
3
- activity = " 1.7 .2"
2
+ agp = " 8.2.2 "
3
+ activity = " 1.8 .2"
4
4
appcompat = " 1.6.1"
5
- benchmark = " 1.2.1 "
6
- composeBom = " 2023.10.01 "
5
+ benchmark = " 1.2.3 "
6
+ composeBom = " 2024.01.00 "
7
7
composeCompiler = " 1.5.4"
8
8
constraintLayout = " 2.1.4"
9
9
core = " 1.12.0"
10
- coroutines = " 1.6.4 "
10
+ coroutines = " 1.7.3 "
11
11
concurrentFutures = " 1.1.0"
12
12
curtains = " 1.2.4"
13
13
dataStore = " 1.0.0"
14
14
espressoCore = " 3.5.1"
15
15
jUnit = " 1.1.5"
16
16
kotlin = " 1.9.20"
17
- lifecycle = " 2.6.2 "
18
- material = " 1.9 .0"
17
+ lifecycle = " 2.7.0 "
18
+ material = " 1.11 .0"
19
19
profileInstaller = " 1.3.1"
20
20
rules = " 1.5.0"
21
- runtimeTracing = " 1.0.0-alpha05 "
21
+ runtimeTracing = " 1.0.0-beta01 "
22
22
tracing = " 1.3.0-alpha02"
23
23
tracingPerfetto = " 1.0.0"
24
- uiAutomator = " 2.3.0-alpha05 "
24
+ uiAutomator = " 2.3.0-beta01 "
25
25
26
26
[libraries ]
27
27
androidx-rules = { module = " androidx.test:rules" , version.ref = " rules" }
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ android {
32
32
defaultConfig {
33
33
// Minimum supported version for Baseline Profiles.
34
34
// On lower APIs, apps are fully AOT compile, therefore Baseline Profiles aren't needed.
35
- minSdk = 24
35
+ minSdk = 28
36
36
targetSdk = 34
37
37
testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
38
38
}
Original file line number Diff line number Diff line change 16
16
17
17
package com.example.macrobenchmark.baselineprofile
18
18
19
- import android.os.Build
20
- import androidx.annotation.RequiresApi
21
19
import androidx.benchmark.macro.MacrobenchmarkScope
22
20
import androidx.benchmark.macro.junit4.BaselineProfileRule
23
21
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -30,7 +28,6 @@ import org.junit.runner.RunWith
30
28
* start generating a profile directly by implementing [MacrobenchmarkScope.profileBlock].
31
29
*/
32
30
@RunWith(AndroidJUnit4 ::class )
33
- @RequiresApi(Build .VERSION_CODES .P )
34
31
abstract class BaselineProfileGeneratorScaffold {
35
32
36
33
@get:Rule
@@ -45,7 +42,8 @@ abstract class BaselineProfileGeneratorScaffold {
45
42
fun profileGenerator () {
46
43
rule.collect(
47
44
packageName = TARGET_PACKAGE ,
48
- maxIterations = 10
45
+ maxIterations = 15 ,
46
+ stableIterations = 3
49
47
) {
50
48
profileBlock()
51
49
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2024 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com.example.macrobenchmark.baselineprofile
18
+
19
+ import androidx.benchmark.macro.junit4.BaselineProfileRule
20
+ import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
21
+ import org.junit.Rule
22
+ import org.junit.Test
23
+ import org.junit.runner.RunWith
24
+
25
+ /* *
26
+ * Generates a startup profile.
27
+ * See
28
+ * [the documentation](https://d.android.com//topic/performance/baselineprofiles/dex-layout-optimizations)
29
+ * for details.
30
+ */
31
+ @RunWith(AndroidJUnit4ClassRunner ::class )
32
+ class StartupProfileGenerator {
33
+ @get:Rule
34
+ val rule = BaselineProfileRule ()
35
+
36
+ @Test
37
+ fun profileGenerator () {
38
+ rule.collect(
39
+ packageName = TARGET_PACKAGE ,
40
+ maxIterations = 15 ,
41
+ stableIterations = 3 ,
42
+ includeInStartupProfile = true
43
+ ) {
44
+ startActivityAndWait()
45
+ }
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments