For #21299: add duration markers for HomeActivity Create/Start.

We only instrument these methods because they're the only ones that
noticeably long running in the current implementation.
upstream-sync
Michael Comella 3 years ago committed by mergify[bot]
parent d67bd65f19
commit bb632c7b3b

@ -95,6 +95,7 @@ import org.mozilla.fenix.library.bookmarks.DesktopFolders
import org.mozilla.fenix.library.history.HistoryFragmentDirections
import org.mozilla.fenix.library.recentlyclosed.RecentlyClosedFragmentDirections
import org.mozilla.fenix.onboarding.DefaultBrowserNotificationWorker
import org.mozilla.fenix.perf.MarkersLifecycleCallbacks
import org.mozilla.fenix.perf.Performance
import org.mozilla.fenix.perf.PerformanceInflater
import org.mozilla.fenix.perf.ProfilerMarkers
@ -179,6 +180,9 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
private lateinit var startupTypeTelemetry: StartupTypeTelemetry
final override fun onCreate(savedInstanceState: Bundle?) {
// DO NOT MOVE ANYTHING ABOVE THIS getProfilerTime CALL.
val startTimeProfiler = components.core.engine.profiler?.getProfilerTime()
components.strictMode.attachListenerToDisablePenaltyDeath(supportFragmentManager)
// There is disk read violations on some devices such as samsung and pixel for android 9/10
components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
@ -266,6 +270,9 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
components.core.pocketStoriesService.startPeriodicStoriesRefresh()
}
components.core.engine.profiler?.addMarker(
MarkersLifecycleCallbacks.MARKER_NAME, startTimeProfiler, "HomeActivity.onCreate"
)
StartupTimeline.onActivityCreateEndHome(this) // DO NOT MOVE ANYTHING BELOW HERE.
}
@ -316,6 +323,9 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
}
override fun onStart() {
// DO NOT MOVE ANYTHING ABOVE THIS getProfilerTime CALL.
val startProfilerTime = components.core.engine.profiler?.getProfilerTime()
super.onStart()
// Diagnostic breadcrumb for "Display already aquired" crash:
@ -325,6 +335,9 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
)
ProfilerMarkers.homeActivityOnStart(binding.rootContainer, components.core.engine.profiler)
components.core.engine.profiler?.addMarker(
MarkersLifecycleCallbacks.MARKER_NAME, startProfilerTime, "HomeActivity.onStart"
) // DO NOT MOVE ANYTHING BELOW THIS addMarker CALL.
}
override fun onStop() {

@ -7,6 +7,7 @@ package org.mozilla.fenix.perf
import android.app.Activity
import android.os.Bundle
import mozilla.components.concept.engine.Engine
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.IntentReceiverActivity
import org.mozilla.fenix.android.DefaultActivityLifecycleCallbacks
@ -26,7 +27,8 @@ class MarkersLifecycleCallbacks(
override fun onActivityCreated(activity: Activity, bundle: Bundle?) {
if (shouldSkip() ||
// This method is manually instrumented with duration.
// These methods are manually instrumented with duration.
activity is HomeActivity ||
activity is IntentReceiverActivity
) {
return
@ -35,7 +37,12 @@ class MarkersLifecycleCallbacks(
}
override fun onActivityStarted(activity: Activity) {
if (shouldSkip()) { return }
if (shouldSkip() ||
// These methods are manually instrumented with duration.
activity is HomeActivity
) {
return
}
engine.profiler?.addMarker(MARKER_NAME, "${activity::class.simpleName}.onStart (via callbacks)")
}

Loading…
Cancel
Save