@@ -29,6 +29,7 @@ class RNPerfMetrics {
2929 #telemetryInfo: Object = { } ;
3030 // map of panel location to panel name
3131 #currentPanels = new Map < PanelLocation , string > ( ) ;
32+ #initialBundlesLoadedInfo: null | { count : number } = null ;
3233
3334 isEnabled ( ) : boolean {
3435 return globalThis . enableReactNativePerfMetrics === true ;
@@ -187,12 +188,7 @@ class RNPerfMetrics {
187188 }
188189
189190 allInitialDeveloperResourcesLoadingFinished ( count : number ) : void {
190- this . sendEvent ( {
191- eventName : 'DeveloperResource.AllInitialLoadingFinished' ,
192- params : {
193- count,
194- } ,
195- } ) ;
191+ this . #initialBundlesLoadedInfo = { count} ;
196192 }
197193
198194 fuseboxSetClientMetadataStarted ( ) : void {
@@ -215,10 +211,22 @@ class RNPerfMetrics {
215211 }
216212 }
217213
218- firstSteadyPing ( ) : void {
214+ tryReportingSteadyPing ( ) : boolean {
215+ if ( this . #initialBundlesLoadedInfo === null ) {
216+ return false ;
217+ }
218+
219+ // const [navigationEntry] = performance.getEntriesByType('navigation');
220+ // eslint-disable-next-line
221+ console . info ( 'Startup time is %s' , performance . now ( ) ) ;
222+
219223 this . sendEvent ( {
220- eventName : 'FirstSteadyPing' ,
224+ eventName : 'FirstSteadyPingAfterInitialResourcesLoaded' ,
225+ params : {
226+ bundleCount : this . #initialBundlesLoadedInfo. count ,
227+ }
221228 } ) ;
229+ return true ;
222230 }
223231
224232 heapSnapshotStarted ( ) : void {
@@ -511,8 +519,11 @@ export type StackTraceFrameUrlResolutionFailed = Readonly<{
511519 } > ,
512520} > ;
513521
514- export type FirstSteadyPing = Readonly < {
515- eventName : 'FirstSteadyPing' ,
522+ export type FirstSteadyPingAfterInitialResourcesLoaded = Readonly < {
523+ eventName : 'FirstSteadyPingAfterInitialResourcesLoaded' ,
524+ params : Readonly < {
525+ bundleCount : number ,
526+ } > ,
516527} > ;
517528
518529export type ReactNativeChromeDevToolsEvent =
@@ -521,6 +532,6 @@ export type ReactNativeChromeDevToolsEvent =
521532 DeveloperResourceLoadingFinishedEvent | AllInitialDeveloperResourcesLoadingFinished | FuseboxSetClientMetadataStartedEvent |
522533 FuseboxSetClientMetadataFinishedEvent | MemoryPanelActionStartedEvent | MemoryPanelActionFinishedEvent |
523534 PanelShownEvent | PanelClosedEvent | StackTraceSymbolicationSucceeded | StackTraceSymbolicationFailed |
524- StackTraceFrameUrlResolutionSucceeded | StackTraceFrameUrlResolutionFailed | FirstSteadyPing ;
535+ StackTraceFrameUrlResolutionSucceeded | StackTraceFrameUrlResolutionFailed | FirstSteadyPingAfterInitialResourcesLoaded ;
525536
526537export type DecoratedReactNativeChromeDevToolsEvent = CommonEventFields & ReactNativeChromeDevToolsEvent ;
0 commit comments