Skip to content

Commit 0f98e4b

Browse files
committed
Simplify StartupBenchmark to just use StartupMode.COLD
Change-Id: I70186c3fdab43fb1ceebcce62105666551ede269
1 parent 5b8453b commit 0f98e4b

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

benchmarks/src/main/java/com/google/samples/apps/nowinandroid/startup/StartupBenchmark.kt

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,24 @@ package com.google.samples.apps.nowinandroid.startup
1919
import androidx.benchmark.macro.BaselineProfileMode.Disable
2020
import androidx.benchmark.macro.BaselineProfileMode.Require
2121
import androidx.benchmark.macro.CompilationMode
22-
import androidx.benchmark.macro.StartupMode
2322
import androidx.benchmark.macro.StartupMode.COLD
24-
import androidx.benchmark.macro.StartupMode.HOT
25-
import androidx.benchmark.macro.StartupMode.WARM
2623
import androidx.benchmark.macro.StartupTimingMetric
2724
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
2825
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
2926
import com.google.samples.apps.nowinandroid.PACKAGE_NAME
27+
import com.google.samples.apps.nowinandroid.allowNotifications
3028
import com.google.samples.apps.nowinandroid.foryou.forYouWaitForContent
3129
import org.junit.Rule
3230
import org.junit.Test
3331
import org.junit.runner.RunWith
3432

3533
/**
34+
* Enables app startups from various states of baseline profile or [CompilationMode]s.
3635
* Run this benchmark from Studio to see startup measurements, and captured system traces
3736
* for investigating your app's performance from a cold state.
3837
*/
3938
@RunWith(AndroidJUnit4ClassRunner::class)
40-
class ColdStartupBenchmark : AbstractStartupBenchmark(COLD)
41-
42-
/**
43-
* Run this benchmark from Studio to see startup measurements, and captured system traces
44-
* for investigating your app's performance from a warm state.
45-
*/
46-
@RunWith(AndroidJUnit4ClassRunner::class)
47-
class WarmStartupBenchmark : AbstractStartupBenchmark(WARM)
48-
49-
/**
50-
* Run this benchmark from Studio to see startup measurements, and captured system traces
51-
* for investigating your app's performance from a hot state.
52-
*/
53-
@RunWith(AndroidJUnit4ClassRunner::class)
54-
class HotStartupBenchmark : AbstractStartupBenchmark(HOT)
55-
56-
/**
57-
* Base class for benchmarks with different startup modes.
58-
* Enables app startups from various states of baseline profile or [CompilationMode]s.
59-
*/
60-
abstract class AbstractStartupBenchmark(private val startupMode: StartupMode) {
39+
class StartupBenchmark {
6140
@get:Rule
6241
val benchmarkRule = MacrobenchmarkRule()
6342

@@ -80,9 +59,10 @@ abstract class AbstractStartupBenchmark(private val startupMode: StartupMode) {
8059
metrics = listOf(StartupTimingMetric()),
8160
compilationMode = compilationMode,
8261
iterations = 10,
83-
startupMode = startupMode,
62+
startupMode = COLD,
8463
setupBlock = {
8564
pressHome()
65+
allowNotifications()
8666
},
8767
) {
8868
startActivityAndWait()

0 commit comments

Comments
 (0)