Skip to content

Commit 3d458c2

Browse files
author
Brian Vaughn
committedAug 3, 2021
Updated test data
1 parent 5f21abd commit 3d458c2

File tree

3 files changed

+62
-15
lines changed

3 files changed

+62
-15
lines changed
 

‎packages/react-devtools-scheduling-profiler/src/import-worker/__tests__/preprocessData-test.internal.js

+31-14
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ describe(preprocessData, () => {
203203
});
204204

205205
expect(preprocessData([cpuProfilerSample, randomSample])).toStrictEqual({
206+
componentMeasures: [],
206207
duration: 0.002,
207208
flamechart: [],
208209
measures: [],
@@ -259,6 +260,7 @@ describe(preprocessData, () => {
259260
}),
260261
]),
261262
).toStrictEqual({
263+
componentMeasures: [],
262264
duration: 0.008,
263265
flamechart: [],
264266
measures: [
@@ -323,6 +325,7 @@ describe(preprocessData, () => {
323325

324326
const userTimingData = createUserTimingData(clearedMarks);
325327
expect(preprocessData(userTimingData)).toStrictEqual({
328+
componentMeasures: [],
326329
duration: 0.011,
327330
flamechart: [],
328331
measures: [
@@ -405,13 +408,27 @@ describe(preprocessData, () => {
405408

406409
const userTimingData = createUserTimingData(clearedMarks);
407410
expect(preprocessData(userTimingData)).toStrictEqual({
408-
duration: 0.022,
411+
componentMeasures: [
412+
{
413+
componentName: 'App',
414+
duration: 0.001,
415+
timestamp: 0.007,
416+
warning: null,
417+
},
418+
{
419+
componentName: 'App',
420+
duration: 0.0010000000000000009,
421+
timestamp: 0.018,
422+
warning: null,
423+
},
424+
],
425+
duration: 0.026,
409426
flamechart: [],
410427
measures: [
411428
{
412429
batchUID: 0,
413430
depth: 0,
414-
duration: 0.004999999999999999,
431+
duration: 0.006999999999999999,
415432
laneLabels: ['Default'],
416433
lanes: [4],
417434
timestamp: 0.006,
@@ -420,7 +437,7 @@ describe(preprocessData, () => {
420437
{
421438
batchUID: 0,
422439
depth: 0,
423-
duration: 0.001,
440+
duration: 0.002999999999999999,
424441
laneLabels: ['Default'],
425442
lanes: [4],
426443
timestamp: 0.006,
@@ -432,7 +449,7 @@ describe(preprocessData, () => {
432449
duration: 0.002999999999999999,
433450
laneLabels: ['Default'],
434451
lanes: [4],
435-
timestamp: 0.008,
452+
timestamp: 0.01,
436453
type: 'commit',
437454
},
438455
{
@@ -441,7 +458,7 @@ describe(preprocessData, () => {
441458
duration: 0.0010000000000000009,
442459
laneLabels: ['Default'],
443460
lanes: [4],
444-
timestamp: 0.009,
461+
timestamp: 0.011,
445462
type: 'layout-effects',
446463
},
447464
{
@@ -450,25 +467,25 @@ describe(preprocessData, () => {
450467
duration: 0.002,
451468
laneLabels: ['Default'],
452469
lanes: [4],
453-
timestamp: 0.012,
470+
timestamp: 0.014,
454471
type: 'passive-effects',
455472
},
456473
{
457474
batchUID: 1,
458475
depth: 0,
459-
duration: 0.005000000000000001,
476+
duration: 0.006999999999999999,
460477
laneLabels: ['Default'],
461478
lanes: [4],
462-
timestamp: 0.015,
479+
timestamp: 0.017,
463480
type: 'render-idle',
464481
},
465482
{
466483
batchUID: 1,
467484
depth: 0,
468-
duration: 0.0010000000000000009,
485+
duration: 0.002999999999999999,
469486
laneLabels: ['Default'],
470487
lanes: [4],
471-
timestamp: 0.015,
488+
timestamp: 0.017,
472489
type: 'render',
473490
},
474491
{
@@ -477,7 +494,7 @@ describe(preprocessData, () => {
477494
duration: 0.002999999999999999,
478495
laneLabels: ['Default'],
479496
lanes: [4],
480-
timestamp: 0.017,
497+
timestamp: 0.021,
481498
type: 'commit',
482499
},
483500
{
@@ -486,7 +503,7 @@ describe(preprocessData, () => {
486503
duration: 0.0010000000000000009,
487504
laneLabels: ['Default'],
488505
lanes: [4],
489-
timestamp: 0.018,
506+
timestamp: 0.022,
490507
type: 'layout-effects',
491508
},
492509
{
@@ -495,7 +512,7 @@ describe(preprocessData, () => {
495512
duration: 0.0009999999999999974,
496513
laneLabels: ['Default'],
497514
lanes: [4],
498-
timestamp: 0.021,
515+
timestamp: 0.025,
499516
type: 'passive-effects',
500517
},
501518
],
@@ -522,7 +539,7 @@ describe(preprocessData, () => {
522539
componentName: 'App',
523540
laneLabels: ['Default'],
524541
lanes: [4],
525-
timestamp: 0.013,
542+
timestamp: 0.015,
526543
type: 'schedule-state-update',
527544
warning: null,
528545
},

‎packages/react-reconciler/src/ReactFiberThrow.new.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ import {
7070
import {propagateParentContextChangesToDeferredTree} from './ReactFiberNewContext.new';
7171
import {logCapturedError} from './ReactFiberErrorLogger';
7272
import {logComponentSuspended} from './DebugTracing';
73-
import {markComponentSuspended} from './SchedulingProfiler';
73+
import {
74+
markComponentRenderStopped,
75+
markComponentSuspended,
76+
} from './SchedulingProfiler';
7477
import {isDevToolsPresent} from './ReactFiberDevToolsHook.new';
7578
import {
7679
SyncLane,
@@ -244,6 +247,7 @@ function throwException(
244247
}
245248

246249
if (enableSchedulingProfiler) {
250+
markComponentRenderStopped();
247251
markComponentSuspended(sourceFiber, wakeable, rootRenderLanes);
248252
}
249253

‎packages/react-reconciler/src/__tests__/SchedulingProfiler-test.internal.js

+26
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ describe('SchedulingProfiler', () => {
174174
`--react-init-${ReactVersion}`,
175175
`--schedule-render-${formatLanes(ReactFiberLane.TransitionLane1)}`,
176176
`--render-start-${formatLanes(ReactFiberLane.TransitionLane1)}`,
177+
'--component-render-start-Foo',
178+
'--component-render-stop',
177179
'--render-yield',
178180
]);
179181
} else {
@@ -208,6 +210,8 @@ describe('SchedulingProfiler', () => {
208210
`--react-init-${ReactVersion}`,
209211
`--schedule-render-${formatLanes(ReactFiberLane.SyncLane)}`,
210212
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
213+
'--component-render-start-Example',
214+
'--component-render-stop',
211215
'--suspense-suspend-0-Example-mount-1-Sync',
212216
'--render-stop',
213217
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
@@ -239,6 +243,8 @@ describe('SchedulingProfiler', () => {
239243
`--react-init-${ReactVersion}`,
240244
`--schedule-render-${formatLanes(ReactFiberLane.SyncLane)}`,
241245
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
246+
'--component-render-start-Example',
247+
'--component-render-stop',
242248
'--suspense-suspend-0-Example-mount-1-Sync',
243249
'--render-stop',
244250
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
@@ -278,6 +284,8 @@ describe('SchedulingProfiler', () => {
278284

279285
expectMarksToEqual([
280286
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
287+
'--component-render-start-Example',
288+
'--component-render-stop',
281289
'--suspense-suspend-0-Example-mount-16-Default',
282290
'--render-stop',
283291
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
@@ -317,6 +325,8 @@ describe('SchedulingProfiler', () => {
317325

318326
expectMarksToEqual([
319327
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
328+
'--component-render-start-Example',
329+
'--component-render-stop',
320330
'--suspense-suspend-0-Example-mount-16-Default',
321331
'--render-stop',
322332
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
@@ -356,12 +366,16 @@ describe('SchedulingProfiler', () => {
356366

357367
expectMarksToEqual([
358368
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
369+
'--component-render-start-Example',
370+
'--component-render-stop',
359371
'--render-stop',
360372
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
361373
`--layout-effects-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
362374
`--schedule-state-update-${formatLanes(ReactFiberLane.SyncLane)}-Example`,
363375
'--layout-effects-stop',
364376
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
377+
'--component-render-start-Example',
378+
'--component-render-stop',
365379
'--render-stop',
366380
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
367381
'--commit-stop',
@@ -393,6 +407,8 @@ describe('SchedulingProfiler', () => {
393407

394408
expectMarksToEqual([
395409
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
410+
'--component-render-start-Example',
411+
'--component-render-stop',
396412
'--render-stop',
397413
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
398414
`--layout-effects-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
@@ -401,6 +417,8 @@ describe('SchedulingProfiler', () => {
401417
)}-Example`,
402418
'--layout-effects-stop',
403419
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
420+
'--component-render-start-Example',
421+
'--component-render-stop',
404422
'--render-stop',
405423
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
406424
'--commit-stop',
@@ -495,12 +513,16 @@ describe('SchedulingProfiler', () => {
495513

496514
expectMarksToEqual([
497515
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
516+
'--component-render-start-Example',
517+
'--component-render-stop',
498518
'--render-stop',
499519
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
500520
`--layout-effects-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
501521
`--schedule-state-update-${formatLanes(ReactFiberLane.SyncLane)}-Example`,
502522
'--layout-effects-stop',
503523
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
524+
'--component-render-start-Example',
525+
'--component-render-stop',
504526
'--render-stop',
505527
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
506528
'--commit-stop',
@@ -528,6 +550,8 @@ describe('SchedulingProfiler', () => {
528550
`--react-init-${ReactVersion}`,
529551
`--schedule-render-${formatLanes(ReactFiberLane.DefaultLane)}`,
530552
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
553+
'--component-render-start-Example',
554+
'--component-render-stop',
531555
'--render-stop',
532556
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
533557
`--layout-effects-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
@@ -539,6 +563,8 @@ describe('SchedulingProfiler', () => {
539563
)}-Example`,
540564
'--passive-effects-stop',
541565
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
566+
'--component-render-start-Example',
567+
'--component-render-stop',
542568
'--render-stop',
543569
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
544570
'--commit-stop',

0 commit comments

Comments
 (0)