@@ -244,85 +244,58 @@ export function createTableData(
244
244
// Add totals row first
245
245
const totals = profile . totals ;
246
246
const totalsDelta = delta ?. totals ;
247
- result . push ( {
248
- isTotal : true ,
249
- label : totals . label ,
247
+ result . push ( createRowData ( true , totals , totalsDelta ) ) ;
248
+
249
+ // Add query data rows
250
+ profile . query_data . forEach ( ( query , idx ) => {
251
+ const queryDelta = delta ?. query_data [ idx ] ;
252
+ result . push ( createRowData ( false , query , queryDelta ) ) ;
253
+ } ) ;
254
+
255
+ return result ;
256
+ }
257
+
258
+ function createRowData (
259
+ isTotal : boolean ,
260
+ value : ProfileElement ,
261
+ delta ?: ProfileElement
262
+ ) : TableRowData {
263
+ return {
264
+ isTotal,
265
+ label : value . label ,
250
266
timePercent :
251
- totals . percent_total_time < 0
267
+ value . percent_total_time < 0
252
268
? {
253
269
value : - 1 ,
254
270
formatted : "-" ,
255
271
title : "No wall-time stat collected for this run" ,
256
272
}
257
273
: {
258
- value : totals . percent_total_time ,
259
- formatted : totals . percent_total_time . toFixed ( 2 ) + "%* " ,
274
+ value : value . percent_total_time ,
275
+ formatted : value . percent_total_time . toFixed ( 2 ) + "%" ,
260
276
title : "% of cpu-time stat" ,
261
277
} ,
262
- timeSeconds : toSeconds ( totals . self_time ) ,
263
- timeDelta : totalsDelta
278
+ timeSeconds : toSeconds ( value . self_time ) ,
279
+ timeDelta : delta
264
280
? createDelta (
265
- toSeconds ( totals . self_time ) ,
266
- toSeconds ( totalsDelta . self_time ) ,
281
+ toSeconds ( value . self_time ) ,
282
+ toSeconds ( delta . self_time ) ,
267
283
false
268
284
)
269
285
: null ,
270
- executions : totals . invocation_count ,
271
- executionsDelta : totalsDelta
272
- ? createDelta ( totals . invocation_count , totalsDelta . invocation_count , true )
286
+ executions : value . invocation_count ,
287
+ executionsDelta : delta
288
+ ? createDelta ( value . invocation_count , delta . invocation_count , true )
273
289
: null ,
274
- incrementalLoading : toSeconds ( totals . incremental_load_time ) ,
275
- incrementalLoadingDelta : totalsDelta
290
+ incrementalLoading : toSeconds ( value . incremental_load_time ) ,
291
+ incrementalLoadingDelta : delta
276
292
? createDelta (
277
- toSeconds ( totals . incremental_load_time ) ,
278
- toSeconds ( totalsDelta . incremental_load_time ) ,
293
+ toSeconds ( value . incremental_load_time ) ,
294
+ toSeconds ( delta . incremental_load_time ) ,
279
295
false
280
296
)
281
297
: null ,
282
- } ) ;
283
-
284
- // Add query data rows
285
- profile . query_data . forEach ( ( query , idx ) => {
286
- const queryDelta = delta ?. query_data [ idx ] ;
287
- result . push ( {
288
- isTotal : false ,
289
- label : query . label ,
290
- timePercent :
291
- query . percent_total_time < 0
292
- ? {
293
- value : - 1 ,
294
- formatted : "-" ,
295
- title : "No wall-time stat collected for this run" ,
296
- }
297
- : {
298
- value : query . percent_total_time ,
299
- formatted : query . percent_total_time . toFixed ( 2 ) + "%" ,
300
- title : "" ,
301
- } ,
302
- timeSeconds : toSeconds ( query . self_time ) ,
303
- timeDelta : queryDelta
304
- ? createDelta (
305
- toSeconds ( query . self_time ) ,
306
- toSeconds ( queryDelta . self_time ) ,
307
- false
308
- )
309
- : null ,
310
- executions : query . invocation_count ,
311
- executionsDelta : queryDelta
312
- ? createDelta ( query . invocation_count , queryDelta . invocation_count , true )
313
- : null ,
314
- incrementalLoading : toSeconds ( query . incremental_load_time ) ,
315
- incrementalLoadingDelta : queryDelta
316
- ? createDelta (
317
- toSeconds ( query . incremental_load_time ) ,
318
- toSeconds ( queryDelta . incremental_load_time ) ,
319
- false
320
- )
321
- : null ,
322
- } ) ;
323
- } ) ;
324
-
325
- return result ;
298
+ } ;
326
299
}
327
300
328
301
export function createArtifactData ( data : SelfProfileResponse | null ) : {
0 commit comments