Skip to content

Commit

Permalink
Updated test data
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 3, 2021
1 parent 5f21abd commit cd3b12e
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ describe(preprocessData, () => {
});

expect(preprocessData([cpuProfilerSample, randomSample])).toStrictEqual({
componentMeasures: [],
duration: 0.002,
flamechart: [],
measures: [],
Expand Down Expand Up @@ -259,6 +260,7 @@ describe(preprocessData, () => {
}),
]),
).toStrictEqual({
componentMeasures: [],
duration: 0.008,
flamechart: [],
measures: [
Expand Down Expand Up @@ -323,6 +325,7 @@ describe(preprocessData, () => {

const userTimingData = createUserTimingData(clearedMarks);
expect(preprocessData(userTimingData)).toStrictEqual({
componentMeasures: [],
duration: 0.011,
flamechart: [],
measures: [
Expand Down Expand Up @@ -405,13 +408,27 @@ describe(preprocessData, () => {

const userTimingData = createUserTimingData(clearedMarks);
expect(preprocessData(userTimingData)).toStrictEqual({
duration: 0.022,
componentMeasures: [
{
componentName: 'App',
duration: 0.001,
timestamp: 0.007,
warning: null,
},
{
componentName: 'App',
duration: 0.0010000000000000009,
timestamp: 0.018,
warning: null,
},
],
duration: 0.026,
flamechart: [],
measures: [
{
batchUID: 0,
depth: 0,
duration: 0.004999999999999999,
duration: 0.006999999999999999,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.006,
Expand All @@ -420,7 +437,7 @@ describe(preprocessData, () => {
{
batchUID: 0,
depth: 0,
duration: 0.001,
duration: 0.002999999999999999,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.006,
Expand All @@ -432,7 +449,7 @@ describe(preprocessData, () => {
duration: 0.002999999999999999,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.008,
timestamp: 0.01,
type: 'commit',
},
{
Expand All @@ -441,7 +458,7 @@ describe(preprocessData, () => {
duration: 0.0010000000000000009,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.009,
timestamp: 0.011,
type: 'layout-effects',
},
{
Expand All @@ -450,25 +467,25 @@ describe(preprocessData, () => {
duration: 0.002,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.012,
timestamp: 0.014,
type: 'passive-effects',
},
{
batchUID: 1,
depth: 0,
duration: 0.005000000000000001,
duration: 0.006999999999999999,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.015,
timestamp: 0.017,
type: 'render-idle',
},
{
batchUID: 1,
depth: 0,
duration: 0.0010000000000000009,
duration: 0.002999999999999999,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.015,
timestamp: 0.017,
type: 'render',
},
{
Expand All @@ -477,7 +494,7 @@ describe(preprocessData, () => {
duration: 0.002999999999999999,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.017,
timestamp: 0.021,
type: 'commit',
},
{
Expand All @@ -486,7 +503,7 @@ describe(preprocessData, () => {
duration: 0.0010000000000000009,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.018,
timestamp: 0.022,
type: 'layout-effects',
},
{
Expand All @@ -495,7 +512,7 @@ describe(preprocessData, () => {
duration: 0.0009999999999999974,
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.021,
timestamp: 0.025,
type: 'passive-effects',
},
],
Expand All @@ -522,7 +539,7 @@ describe(preprocessData, () => {
componentName: 'App',
laneLabels: ['Default'],
lanes: [4],
timestamp: 0.013,
timestamp: 0.015,
type: 'schedule-state-update',
warning: null,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ function processTimelineEvent(
if (name.startsWith('--component-render-start-')) {
const [componentName] = name.substr(25).split('-');

if (state.currentReactComponentMeasure !== null) {
console.error(
'Render started while another render in progress:',
state.currentReactComponentMeasure,
);
}

state.currentReactComponentMeasure = {
componentName,
timestamp: startTime,
Expand Down
6 changes: 5 additions & 1 deletion packages/react-reconciler/src/ReactFiberThrow.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ import {
import {propagateParentContextChangesToDeferredTree} from './ReactFiberNewContext.new';
import {logCapturedError} from './ReactFiberErrorLogger';
import {logComponentSuspended} from './DebugTracing';
import {markComponentSuspended} from './SchedulingProfiler';
import {
markComponentRenderStopped,
markComponentSuspended,
} from './SchedulingProfiler';
import {isDevToolsPresent} from './ReactFiberDevToolsHook.new';
import {
SyncLane,
Expand Down Expand Up @@ -244,6 +247,7 @@ function throwException(
}

if (enableSchedulingProfiler) {
markComponentRenderStopped();
markComponentSuspended(sourceFiber, wakeable, rootRenderLanes);
}

Expand Down
6 changes: 5 additions & 1 deletion packages/react-reconciler/src/ReactFiberThrow.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ import {
import {propagateParentContextChangesToDeferredTree} from './ReactFiberNewContext.old';
import {logCapturedError} from './ReactFiberErrorLogger';
import {logComponentSuspended} from './DebugTracing';
import {markComponentSuspended} from './SchedulingProfiler';
import {
markComponentRenderStopped,
markComponentSuspended,
} from './SchedulingProfiler';
import {isDevToolsPresent} from './ReactFiberDevToolsHook.old';
import {
SyncLane,
Expand Down Expand Up @@ -244,6 +247,7 @@ function throwException(
}

if (enableSchedulingProfiler) {
markComponentRenderStopped();
markComponentSuspended(sourceFiber, wakeable, rootRenderLanes);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ describe('SchedulingProfiler', () => {
`--react-init-${ReactVersion}`,
`--schedule-render-${formatLanes(ReactFiberLane.TransitionLane1)}`,
`--render-start-${formatLanes(ReactFiberLane.TransitionLane1)}`,
'--component-render-start-Foo',
'--component-render-stop',
'--render-yield',
]);
} else {
Expand Down Expand Up @@ -208,6 +210,8 @@ describe('SchedulingProfiler', () => {
`--react-init-${ReactVersion}`,
`--schedule-render-${formatLanes(ReactFiberLane.SyncLane)}`,
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--suspense-suspend-0-Example-mount-1-Sync',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
Expand Down Expand Up @@ -239,6 +243,8 @@ describe('SchedulingProfiler', () => {
`--react-init-${ReactVersion}`,
`--schedule-render-${formatLanes(ReactFiberLane.SyncLane)}`,
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--suspense-suspend-0-Example-mount-1-Sync',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
Expand Down Expand Up @@ -278,6 +284,8 @@ describe('SchedulingProfiler', () => {

expectMarksToEqual([
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--suspense-suspend-0-Example-mount-16-Default',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
Expand Down Expand Up @@ -317,6 +325,8 @@ describe('SchedulingProfiler', () => {

expectMarksToEqual([
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--suspense-suspend-0-Example-mount-16-Default',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
Expand Down Expand Up @@ -356,12 +366,16 @@ describe('SchedulingProfiler', () => {

expectMarksToEqual([
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
`--layout-effects-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
`--schedule-state-update-${formatLanes(ReactFiberLane.SyncLane)}-Example`,
'--layout-effects-stop',
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
'--commit-stop',
Expand Down Expand Up @@ -393,6 +407,8 @@ describe('SchedulingProfiler', () => {

expectMarksToEqual([
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
`--layout-effects-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
Expand All @@ -401,6 +417,8 @@ describe('SchedulingProfiler', () => {
)}-Example`,
'--layout-effects-stop',
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
'--commit-stop',
Expand Down Expand Up @@ -495,12 +513,16 @@ describe('SchedulingProfiler', () => {

expectMarksToEqual([
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
`--layout-effects-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
`--schedule-state-update-${formatLanes(ReactFiberLane.SyncLane)}-Example`,
'--layout-effects-stop',
`--render-start-${formatLanes(ReactFiberLane.SyncLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.SyncLane)}`,
'--commit-stop',
Expand Down Expand Up @@ -528,6 +550,8 @@ describe('SchedulingProfiler', () => {
`--react-init-${ReactVersion}`,
`--schedule-render-${formatLanes(ReactFiberLane.DefaultLane)}`,
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
`--layout-effects-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
Expand All @@ -539,6 +563,8 @@ describe('SchedulingProfiler', () => {
)}-Example`,
'--passive-effects-stop',
`--render-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
'--component-render-start-Example',
'--component-render-stop',
'--render-stop',
`--commit-start-${formatLanes(ReactFiberLane.DefaultLane)}`,
'--commit-stop',
Expand Down

0 comments on commit cd3b12e

Please sign in to comment.