@@ -29,6 +29,7 @@ class RNPerfMetrics {
2929 #telemetryInfo: Object = { } ;
3030 // map of panel location to panel name
3131 #currentPanels = new Map < PanelLocation , string > ( ) ;
32+ #initialResourcesLoadedInfo: null | { count : number } = null ;
3233
3334 isEnabled ( ) : boolean {
3435 return globalThis . enableReactNativePerfMetrics === true ;
@@ -186,13 +187,8 @@ class RNPerfMetrics {
186187 } ) ;
187188 }
188189
189- allInitialDeveloperResourcesLoadingFinished ( count : number ) : void {
190- this . sendEvent ( {
191- eventName : 'DeveloperResource.AllInitialLoadingFinished' ,
192- params : {
193- count,
194- } ,
195- } ) ;
190+ initialResourcesLoaded ( count : number ) : void {
191+ this . #initialResourcesLoadedInfo = { count} ;
196192 }
197193
198194 fuseboxSetClientMetadataStarted ( ) : void {
@@ -215,10 +211,21 @@ class RNPerfMetrics {
215211 }
216212 }
217213
218- firstSteadyPing ( ) : void {
214+ tryReportingSteadyPing ( ) : boolean {
215+ if ( this . #initialResourcesLoadedInfo === null ) {
216+ return false ;
217+ }
218+
219+ // eslint-disable-next-line no-console
220+ console . info ( 'Startup time is %s' , performance . now ( ) ) ;
221+
219222 this . sendEvent ( {
220- eventName : 'FirstSteadyPing' ,
223+ eventName : 'FirstSteadyPingAfterInitialResourcesLoaded' ,
224+ params : {
225+ bundleCount : this . #initialResourcesLoadedInfo. count ,
226+ }
221227 } ) ;
228+ return true ;
222229 }
223230
224231 heapSnapshotStarted ( ) : void {
@@ -432,13 +439,6 @@ export type DeveloperResourceLoadingFinishedEvent = Readonly<{
432439 } > ,
433440} > ;
434441
435- export type AllInitialDeveloperResourcesLoadingFinished = Readonly < {
436- eventName : 'DeveloperResource.AllInitialLoadingFinished' ,
437- params : Readonly < {
438- count : number ,
439- } > ,
440- } > ;
441-
442442export type FuseboxSetClientMetadataStartedEvent = Readonly < {
443443 eventName : 'FuseboxSetClientMetadataStarted' ,
444444} > ;
@@ -511,16 +511,19 @@ export type StackTraceFrameUrlResolutionFailed = Readonly<{
511511 } > ,
512512} > ;
513513
514- export type FirstSteadyPing = Readonly < {
515- eventName : 'FirstSteadyPing' ,
514+ export type FirstSteadyPingAfterInitialResourcesLoaded = Readonly < {
515+ eventName : 'FirstSteadyPingAfterInitialResourcesLoaded' ,
516+ params : Readonly < {
517+ bundleCount : number ,
518+ } > ,
516519} > ;
517520
518521export type ReactNativeChromeDevToolsEvent =
519522 EntrypointLoadingStartedEvent | EntrypointLoadingFinishedEvent | DebuggerReadyEvent | BrowserVisibilityChangeEvent |
520523 BrowserErrorEvent | RemoteDebuggingTerminatedEvent | DeveloperResourceLoadingStartedEvent |
521- DeveloperResourceLoadingFinishedEvent | AllInitialDeveloperResourcesLoadingFinished | FuseboxSetClientMetadataStartedEvent |
524+ DeveloperResourceLoadingFinishedEvent | FuseboxSetClientMetadataStartedEvent |
522525 FuseboxSetClientMetadataFinishedEvent | MemoryPanelActionStartedEvent | MemoryPanelActionFinishedEvent |
523526 PanelShownEvent | PanelClosedEvent | StackTraceSymbolicationSucceeded | StackTraceSymbolicationFailed |
524- StackTraceFrameUrlResolutionSucceeded | StackTraceFrameUrlResolutionFailed | FirstSteadyPing ;
527+ StackTraceFrameUrlResolutionSucceeded | StackTraceFrameUrlResolutionFailed | FirstSteadyPingAfterInitialResourcesLoaded ;
525528
526529export type DecoratedReactNativeChromeDevToolsEvent = CommonEventFields & ReactNativeChromeDevToolsEvent ;
0 commit comments