Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NoQA] feat: more startup marks #39181

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate

import com.oblador.performance.RNPerformance

class MainActivity : ReactActivity() {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
Expand Down Expand Up @@ -82,4 +84,9 @@ class MainActivity : ReactActivity() {
KeyCommandModule.getInstance().onKeyDownEvent(keyCode, event)
return super.onKeyUp(keyCode, event)
}

override fun onStart() {
super.onStart()
RNPerformance.getInstance().mark("appCreationEnd", false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.modules.i18nmanager.I18nUtil
import com.facebook.soloader.SoLoader
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.oblador.performance.RNPerformance
import expo.modules.ApplicationLifecycleDispatcher
import expo.modules.ReactNativeHostWrapper

Expand Down Expand Up @@ -42,6 +43,8 @@ class MainApplication : MultiDexApplication(), ReactApplication {
override fun onCreate() {
super.onCreate()

RNPerformance.getInstance().mark("appCreationStart", false);

if (isOnfidoProcess()) {
return
}
Expand Down
12 changes: 12 additions & 0 deletions src/libs/Performance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ if (Metrics.canCapturePerformanceMetrics()) {
if (entry.name === 'runJsBundleEnd') {
Performance.measureFailSafe('runJsBundle', 'runJsBundleStart', 'runJsBundleEnd');
}
if (entry.name === 'appCreationEnd') {
Performance.measureFailSafe('appCreation', 'appCreationStart', 'appCreationEnd');
Performance.measureFailSafe('nativeLaunchEnd_To_appCreationStart', 'nativeLaunchEnd', 'appCreationStart');
}
if (entry.name === 'contentAppeared') {
Performance.measureFailSafe('appCreationEnd_To_contentAppeared', 'appCreationEnd', 'contentAppeared');
}

// We don't need to keep the observer past this point
if (entry.name === 'runJsBundleEnd' || entry.name === 'downloadEnd') {
Expand All @@ -154,6 +161,7 @@ if (Metrics.canCapturePerformanceMetrics()) {

// Capture any custom measures or metrics below
if (mark.name === `${CONST.TIMING.SIDEBAR_LOADED}_end`) {
Performance.measureFailSafe('contentAppeared_To_screenTTI', 'contentAppeared', mark.name);
Performance.measureTTI(mark.name);
}
});
Expand All @@ -163,6 +171,10 @@ if (Metrics.canCapturePerformanceMetrics()) {
Performance.getPerformanceMetrics = (): PerformanceEntry[] =>
[
...rnPerformance.getEntriesByName('nativeLaunch'),
...rnPerformance.getEntriesByName('nativeLaunchEnd_To_appCreationStart'),
...rnPerformance.getEntriesByName('appCreation'),
...rnPerformance.getEntriesByName('appCreationEnd_To_contentAppeared'),
...rnPerformance.getEntriesByName('contentAppeared_To_screenTTI'),
...rnPerformance.getEntriesByName('runJsBundle'),
...rnPerformance.getEntriesByName('jsBundleDownload'),
...rnPerformance.getEntriesByName('TTI'),
Expand Down
Loading