@@ -157,7 +157,8 @@ function getComputedRenderBeaconSpans<ScopeT extends ScopeBase>(
157
157
{
158
158
firstStart : number
159
159
lastEnd : number | undefined
160
- lastLoadingEnd : number | undefined
160
+ firstLoadingStart : number | undefined
161
+ firstContentStart : number | undefined
161
162
renderCount : number
162
163
sumOfDurations : number
163
164
}
@@ -177,31 +178,38 @@ function getComputedRenderBeaconSpans<ScopeT extends ScopeBase>(
177
178
const start = startTime . now
178
179
const contentEnd =
179
180
renderedOutput === 'content' ? start + duration : undefined
180
- const loadingEnd =
181
- renderedOutput === 'loading' ? start + duration : undefined
182
181
183
182
const spanTimes = renderSpansByBeacon . get ( name )
184
183
185
184
if ( ! spanTimes ) {
186
185
renderSpansByBeacon . set ( name , {
187
186
firstStart : start ,
188
187
lastEnd : contentEnd ,
189
- lastLoadingEnd : loadingEnd ,
190
188
renderCount : 1 ,
191
189
sumOfDurations : duration ,
190
+ firstLoadingStart : renderedOutput === 'loading' ? start : undefined ,
191
+ firstContentStart : renderedOutput === 'content' ? start : undefined ,
192
192
} )
193
193
} else {
194
194
spanTimes . firstStart = Math . min ( spanTimes . firstStart , start )
195
195
spanTimes . lastEnd =
196
196
contentEnd && spanTimes . lastEnd
197
197
? Math . max ( spanTimes . lastEnd , contentEnd )
198
198
: contentEnd ?? spanTimes . lastEnd
199
- spanTimes . lastLoadingEnd =
200
- loadingEnd && spanTimes . lastLoadingEnd
201
- ? Math . max ( spanTimes . lastLoadingEnd , loadingEnd )
202
- : loadingEnd ?? spanTimes . lastLoadingEnd
203
199
spanTimes . renderCount += 1
204
200
spanTimes . sumOfDurations += duration
201
+ if (
202
+ spanTimes . firstContentStart === undefined &&
203
+ renderedOutput === 'content'
204
+ ) {
205
+ spanTimes . firstContentStart = start
206
+ }
207
+ if (
208
+ spanTimes . firstLoadingStart === undefined &&
209
+ renderedOutput === 'loading'
210
+ ) {
211
+ spanTimes . firstLoadingStart = start
212
+ }
205
213
}
206
214
}
207
215
@@ -213,9 +221,12 @@ function getComputedRenderBeaconSpans<ScopeT extends ScopeBase>(
213
221
if ( ! spanTimes . lastEnd ) continue
214
222
computedRenderBeaconSpans [ beaconName ] = {
215
223
startOffset : spanTimes . firstStart - input . startTime . now ,
216
- timeToRendered : spanTimes . lastEnd - spanTimes . firstStart ,
217
- timeToData : spanTimes . lastLoadingEnd
218
- ? spanTimes . lastLoadingEnd - spanTimes . firstStart
224
+ timeToContent : spanTimes . lastEnd - spanTimes . firstStart ,
225
+ timeToLoading : spanTimes . firstLoadingStart
226
+ ? spanTimes . firstLoadingStart - spanTimes . firstStart
227
+ : 0 ,
228
+ timeToData : spanTimes . firstContentStart
229
+ ? spanTimes . firstContentStart - spanTimes . firstStart
219
230
: 0 ,
220
231
renderCount : spanTimes . renderCount ,
221
232
sumOfDurations : spanTimes . sumOfDurations ,
0 commit comments