@@ -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,22 @@ class RNPerfMetrics {
215211 }
216212 }
217213
218- firstSteadyPing ( ) : void {
214+ tryReportingSteadyPing ( ) : boolean {
215+ if ( this . #initialResourcesLoadedInfo === 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 . #initialResourcesLoadedInfo. count ,
227+ }
221228 } ) ;
229+ return true ;
222230 }
223231
224232 heapSnapshotStarted ( ) : void {
@@ -432,13 +440,6 @@ export type DeveloperResourceLoadingFinishedEvent = Readonly<{
432440 } > ,
433441} > ;
434442
435- export type AllInitialDeveloperResourcesLoadingFinished = Readonly < {
436- eventName : 'DeveloperResource.AllInitialLoadingFinished' ,
437- params : Readonly < {
438- count : number ,
439- } > ,
440- } > ;
441-
442443export type FuseboxSetClientMetadataStartedEvent = Readonly < {
443444 eventName : 'FuseboxSetClientMetadataStarted' ,
444445} > ;
@@ -511,16 +512,19 @@ export type StackTraceFrameUrlResolutionFailed = Readonly<{
511512 } > ,
512513} > ;
513514
514- export type FirstSteadyPing = Readonly < {
515- eventName : 'FirstSteadyPing' ,
515+ export type FirstSteadyPingAfterInitialResourcesLoaded = Readonly < {
516+ eventName : 'FirstSteadyPingAfterInitialResourcesLoaded' ,
517+ params : Readonly < {
518+ bundleCount : number ,
519+ } > ,
516520} > ;
517521
518522export type ReactNativeChromeDevToolsEvent =
519523 EntrypointLoadingStartedEvent | EntrypointLoadingFinishedEvent | DebuggerReadyEvent | BrowserVisibilityChangeEvent |
520524 BrowserErrorEvent | RemoteDebuggingTerminatedEvent | DeveloperResourceLoadingStartedEvent |
521- DeveloperResourceLoadingFinishedEvent | AllInitialDeveloperResourcesLoadingFinished | FuseboxSetClientMetadataStartedEvent |
525+ DeveloperResourceLoadingFinishedEvent | FuseboxSetClientMetadataStartedEvent |
522526 FuseboxSetClientMetadataFinishedEvent | MemoryPanelActionStartedEvent | MemoryPanelActionFinishedEvent |
523527 PanelShownEvent | PanelClosedEvent | StackTraceSymbolicationSucceeded | StackTraceSymbolicationFailed |
524- StackTraceFrameUrlResolutionSucceeded | StackTraceFrameUrlResolutionFailed | FirstSteadyPing ;
528+ StackTraceFrameUrlResolutionSucceeded | StackTraceFrameUrlResolutionFailed | FirstSteadyPingAfterInitialResourcesLoaded ;
525529
526530export type DecoratedReactNativeChromeDevToolsEvent = CommonEventFields & ReactNativeChromeDevToolsEvent ;
0 commit comments