diff --git a/app/metrics.yaml b/app/metrics.yaml index a10a5b626..2e311c746 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -4213,6 +4213,86 @@ perf.startup: - perf-android-fe@mozilla.com - mcomella@mozilla.com expires: "2021-08-11" + home_activity_on_start: + type: timing_distribution + time_unit: millisecond + description: | + The duration of `HomeActivity.onStart`. This may encapsulate + `HomeFragment` or `BrowserFragment` creation, depending on the code path, + so we expect this to take varying amounts of time. As such, this probe may + not be easy to interpret directly but we believe collecting it may give us + more information about different patterns we might see in performance + data. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/18426 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848 + data_sensitivity: + - technical + notification_emails: + - perf-android-fe@mozilla.com + - mcomella@mozilla.com + expires: "2021-08-11" + home_fragment_on_create_view: + type: timing_distribution + time_unit: millisecond + description: | + The duration of `HomeFragment.onCreateView`. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/18426 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848 + data_sensitivity: + - technical + notification_emails: + - perf-android-fe@mozilla.com + - mcomella@mozilla.com + expires: "2021-08-11" + home_fragment_on_view_created: + type: timing_distribution + time_unit: millisecond + description: | + The duration of `HomeFragment.onViewCreated`. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/18426 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848 + data_sensitivity: + - technical + notification_emails: + - perf-android-fe@mozilla.com + - mcomella@mozilla.com + expires: "2021-08-11" + base_bfragment_on_create_view: + type: timing_distribution + time_unit: millisecond + description: | + The duration of `BaseBrowserFragment.onCreateView`. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/18426 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848 + data_sensitivity: + - technical + notification_emails: + - perf-android-fe@mozilla.com + - mcomella@mozilla.com + expires: "2021-08-11" + base_bfragment_on_view_created: + type: timing_distribution + time_unit: millisecond + description: | + The duration of `BaseBrowserFragment.onViewCreated`. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/18426 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848 + data_sensitivity: + - technical + notification_emails: + - perf-android-fe@mozilla.com + - mcomella@mozilla.com + expires: "2021-08-11" perf.awesomebar: history_suggestions: diff --git a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt index a3f577ac5..5a20d489a 100644 --- a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt @@ -325,7 +325,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { } } - override fun onStart() { + override fun onStart() = PerfStartup.homeActivityOnStart.measureNoInline { super.onStart() // Diagnostic breadcrumb for "Display already aquired" crash: diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index db1b8e351..9b8d06127 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -129,6 +129,8 @@ import mozilla.components.feature.session.behavior.EngineViewBrowserToolbarBehav import mozilla.components.feature.webauthn.WebAuthnFeature import mozilla.components.support.base.feature.ActivityResultHandler import mozilla.components.support.ktx.android.view.enterToImmersiveMode +import org.mozilla.fenix.GleanMetrics.PerfStartup +import org.mozilla.fenix.ext.measureNoInline import mozilla.components.feature.session.behavior.ToolbarPosition as MozacToolbarPosition /** @@ -197,7 +199,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? - ): View { + ): View = PerfStartup.baseBfragmentOnCreateView.measureNoInline { customTabSessionId = requireArguments().getString(EXTRA_SESSION_ID) // Diagnostic breadcrumb for "Display already aquired" crash: @@ -220,10 +222,11 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit ) } - return view + view } - final override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + final override fun onViewCreated(view: View, savedInstanceState: Bundle?) = + PerfStartup.baseBfragmentOnViewCreated.measureNoInline { // weird indentation to avoid breaking blame. initializeUI(view) if (customTabSessionId == null) { @@ -240,6 +243,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit } requireContext().accessibilityManager.addAccessibilityStateChangeListener(this) + Unit } private fun initializeUI(view: View) { diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 924297d65..8d0127545 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -85,6 +85,7 @@ import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged import mozilla.components.ui.tabcounter.TabCounterMenu import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.Config +import org.mozilla.fenix.GleanMetrics.PerfStartup import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R import org.mozilla.fenix.browser.BrowserAnimator.Companion.getToolbarNavOptions @@ -101,6 +102,7 @@ import org.mozilla.fenix.components.toolbar.FenixTabCounterMenu import org.mozilla.fenix.components.toolbar.ToolbarPosition import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.hideToolbar +import org.mozilla.fenix.ext.measureNoInline import org.mozilla.fenix.ext.metrics import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.requireComponents @@ -193,7 +195,7 @@ class HomeFragment : Fragment() { inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? - ): View? { + ): View? = PerfStartup.homeFragmentOnCreateView.measureNoInline { val view = inflater.inflate(R.layout.fragment_home, container, false) val activity = activity as HomeActivity val components = requireComponents @@ -274,7 +276,7 @@ class HomeFragment : Fragment() { appBarLayout = view.homeAppBar activity.themeManager.applyStatusBarTheme(activity) - return view + view } override fun onConfigurationChanged(newConfig: Configuration) { @@ -356,7 +358,8 @@ class HomeFragment : Fragment() { } @Suppress("LongMethod", "ComplexMethod") - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) = + PerfStartup.homeFragmentOnViewCreated.measureNoInline { // weird indent so we don't have to break blame. super.onViewCreated(view, savedInstanceState) observeSearchEngineChanges() diff --git a/docs/metrics.md b/docs/metrics.md index 3feeb4ce8..63598cc4a 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -345,7 +345,12 @@ In addition to those built-in metrics, the following metrics are added to the pi | perf.startup.app_on_create_to_megazord_init |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |A subsection of the duration of `FenixApplication.onCreate` and thus the `application_on_create` probe from after the `app_on_create_to_glean_init` probe until we block for the megazord to complete set up. |[mozilla-mobile/fenix#18525](https://github.com/mozilla-mobile/fenix/pull/18525#issue-594961170)||2021-08-11 |1 | | perf.startup.app_on_create_to_setup_in_main |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |A subsection of the duration of `FenixApplication.onCreate` and thus the `application_on_create` probe from after the `app_on_create_to_megazord_init` probe until the end of `setupInMainProcessOnly`, which is expected to be the end of the `onCreate` call (unless the implementation later changes). |[mozilla-mobile/fenix#18525](https://github.com/mozilla-mobile/fenix/pull/18525#issue-594961170)||2021-08-11 |1 | | perf.startup.application_on_create |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `FenixApplication.onCreate` in the main process. This does not measure the duration of migration code (via `MigratingFenixApplication` included in the Beta and Release channels. |[mozilla-mobile/fenix#17973](https://github.com/mozilla-mobile/fenix/pull/17973#issue-572183889)||2021-08-11 |1 | +| perf.startup.base_bfragment_on_create_view |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `BaseBrowserFragment.onCreateView`. |[mozilla-mobile/fenix#18558](https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848)||2021-08-11 |1 | +| perf.startup.base_bfragment_on_view_created |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `BaseBrowserFragment.onViewCreated`. |[mozilla-mobile/fenix#18558](https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848)||2021-08-11 |1 | | perf.startup.home_activity_on_create |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `HomeActivity.onCreate`. |[mozilla-mobile/fenix#17973](https://github.com/mozilla-mobile/fenix/pull/17973#issue-572183889)||2021-08-11 |1 | +| perf.startup.home_activity_on_start |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `HomeActivity.onStart`. This may encapsulate `HomeFragment` or `BrowserFragment` creation, depending on the code path, so we expect this to take varying amounts of time. As such, this probe may not be easy to interpret directly but we believe collecting it may give us more information about different patterns we might see in performance data. |[mozilla-mobile/fenix#18558](https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848)||2021-08-11 |1 | +| perf.startup.home_fragment_on_create_view |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `HomeFragment.onCreateView`. |[mozilla-mobile/fenix#18558](https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848)||2021-08-11 |1 | +| perf.startup.home_fragment_on_view_created |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `HomeFragment.onViewCreated`. |[mozilla-mobile/fenix#18558](https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848)||2021-08-11 |1 | | preferences.accessibility_services |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has touch exploration or switch services enabled. These are built into the Android OS, not Fenix prefs. default: "" |[mozilla-mobile/fenix#11211](https://github.com/mozilla-mobile/fenix/pull/11211), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | preferences.open_links_in_a_private_tab |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has enabled open links in a private tab. default: false |[mozilla-mobile/fenix#11211](https://github.com/mozilla-mobile/fenix/pull/11211), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | preferences.open_links_in_app |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has the open links in apps feature enabled. default: false |[mozilla-mobile/fenix#11446](https://github.com/mozilla-mobile/fenix/pull/11446), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |