1 /*
2  * Copyright 2022 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 androidx.benchmark
18 
19 import androidx.annotation.RestrictTo
20 import androidx.benchmark.perfetto.PerfettoConfig
21 
22 /**
23  * Annotates declarations that are considered experimental within the Benchmark API, and are likely
24  * to change before becoming stable. Using experimental features can potentially break your code if
25  * the design or behavior changes.
26  */
27 @RequiresOptIn
28 @Retention(AnnotationRetention.BINARY)
29 public annotation class ExperimentalBenchmarkConfigApi
30 
31 @ExperimentalBenchmarkConfigApi
32 public class ExperimentalConfig(
33     val perfettoConfig: PerfettoConfig? = null,
34     val startupInsightsConfig: StartupInsightsConfig? = null
35 )
36 
37 /** Configuration for startup insights. */
38 @ExperimentalBenchmarkConfigApi
39 public class StartupInsightsConfig(val isEnabled: Boolean) {
40     /**
41      * Base URL for linking to more information about specific startup reasons. This URL should
42      * accept a reason ID as a direct suffix. For example, a base URL of
43      * `https://developer.android.com/[...]/slow-start-reason#` could be combined with a reason ID
44      * of `MAIN_THREAD_MONITOR_CONTENTION` to create a complete URL like:
45      * `https://developer.android.com/[...]/slow-start-reason#MAIN_THREAD_MONITOR_CONTENTION`
46      */
47     val reasonHelpUrlBase: String? = Arguments.startupInsightsHelpUrlBase
48         @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) get
49 }
50