Skip to content

Commit

Permalink
Add ReactVersion to SchedulingProfiler render scheduled marks
Browse files Browse the repository at this point in the history
  • Loading branch information
taneliang committed Aug 6, 2020
1 parent e67a6b1 commit 8a75dc4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
5 changes: 4 additions & 1 deletion packages/react-reconciler/src/SchedulingProfiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
enableSchedulingProfiler,
enableSchedulingProfilerComponentStacks,
} from 'shared/ReactFeatureFlags';
import ReactVersion from 'shared/ReactVersion';
import getComponentName from 'shared/getComponentName';
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';

Expand Down Expand Up @@ -166,7 +167,9 @@ export function markRenderStopped(): void {
export function markRenderScheduled(lane: Lane): void {
if (enableSchedulingProfiler) {
if (supportsUserTiming) {
performance.mark(`--schedule-render-${formatLanes(lane)}`);
performance.mark(
`--schedule-render-${formatLanes(lane)}-${ReactVersion}`,
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

'use strict';

import ReactVersion from 'shared/ReactVersion';

function normalizeCodeLocInfo(str) {
return (
str &&
Expand Down Expand Up @@ -81,7 +83,7 @@ describe('SchedulingProfiler', () => {
ReactTestRenderer.create(<div />);

expect(marks).toEqual([
'--schedule-render-1',
`--schedule-render-1-${ReactVersion}`,
'--render-start-1',
'--render-stop',
'--commit-start-1',
Expand All @@ -95,7 +97,7 @@ describe('SchedulingProfiler', () => {
it('should mark concurrent render without suspends or state updates', () => {
ReactTestRenderer.create(<div />, {unstable_isConcurrent: true});

expect(marks).toEqual(['--schedule-render-512']);
expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]);

marks.splice(0);

Expand Down Expand Up @@ -128,7 +130,7 @@ describe('SchedulingProfiler', () => {
expect(ReactNoop.flushNextYield()).toEqual(['Foo']);

expect(marks).toEqual([
'--schedule-render-512',
`--schedule-render-512-${ReactVersion}`,
'--render-start-512',
'--render-yield',
]);
Expand All @@ -148,7 +150,7 @@ describe('SchedulingProfiler', () => {
);

expect(marks).toEqual([
'--schedule-render-1',
`--schedule-render-1-${ReactVersion}`,
'--render-start-1',
toggleComponentStacks(
'--suspense-suspend-0-Example-\n at Example\n at Suspense',
Expand Down Expand Up @@ -184,7 +186,7 @@ describe('SchedulingProfiler', () => {
);

expect(marks).toEqual([
'--schedule-render-1',
`--schedule-render-1-${ReactVersion}`,
'--render-start-1',
toggleComponentStacks(
'--suspense-suspend-0-Example-\n at Example\n at Suspense',
Expand Down Expand Up @@ -220,7 +222,7 @@ describe('SchedulingProfiler', () => {
{unstable_isConcurrent: true},
);

expect(marks).toEqual(['--schedule-render-512']);
expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]);

marks.splice(0);

Expand Down Expand Up @@ -262,7 +264,7 @@ describe('SchedulingProfiler', () => {
{unstable_isConcurrent: true},
);

expect(marks).toEqual(['--schedule-render-512']);
expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]);

marks.splice(0);

Expand Down Expand Up @@ -304,7 +306,7 @@ describe('SchedulingProfiler', () => {

ReactTestRenderer.create(<Example />, {unstable_isConcurrent: true});

expect(marks).toEqual(['--schedule-render-512']);
expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]);

marks.splice(0);

Expand Down Expand Up @@ -340,7 +342,7 @@ describe('SchedulingProfiler', () => {

ReactTestRenderer.create(<Example />, {unstable_isConcurrent: true});

expect(marks).toEqual(['--schedule-render-512']);
expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]);

marks.splice(0);

Expand Down Expand Up @@ -377,7 +379,7 @@ describe('SchedulingProfiler', () => {

ReactTestRenderer.create(<Example />, {unstable_isConcurrent: true});

expect(marks).toEqual(['--schedule-render-512']);
expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]);

marks.splice(0);

Expand Down Expand Up @@ -414,7 +416,7 @@ describe('SchedulingProfiler', () => {

ReactTestRenderer.create(<Example />, {unstable_isConcurrent: true});

expect(marks).toEqual(['--schedule-render-512']);
expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]);

marks.splice(0);

Expand Down Expand Up @@ -449,7 +451,7 @@ describe('SchedulingProfiler', () => {

ReactTestRenderer.create(<Example />, {unstable_isConcurrent: true});

expect(marks).toEqual(['--schedule-render-512']);
expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]);

marks.splice(0);

Expand Down Expand Up @@ -489,7 +491,7 @@ describe('SchedulingProfiler', () => {
gate(({old}) => {
if (old) {
expect(marks.map(normalizeCodeLocInfo)).toEqual([
'--schedule-render-512',
`--schedule-render-512-${ReactVersion}`,
'--render-start-512',
'--render-stop',
'--commit-start-512',
Expand All @@ -508,7 +510,7 @@ describe('SchedulingProfiler', () => {
]);
} else {
expect(marks.map(normalizeCodeLocInfo)).toEqual([
'--schedule-render-512',
`--schedule-render-512-${ReactVersion}`,
'--render-start-512',
'--render-stop',
'--commit-start-512',
Expand Down

0 comments on commit 8a75dc4

Please sign in to comment.