Skip to content

Commit

Permalink
Disable (unstable) scheduler sampling profiler for OSS builds (facebo…
Browse files Browse the repository at this point in the history
…ok#20832)

* Disabled Scheduler sampling profiler for OSS builds
* Added missing conditional feature flag around profiling calls
  • Loading branch information
Brian Vaughn authored and gaearon committed Mar 22, 2021
1 parent 8cc6ff2 commit b2bbee7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/scheduler/src/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,16 @@ function workLoop(hasTimeRemaining, initialTime) {
currentTask.callback = null;
currentPriorityLevel = currentTask.priorityLevel;
const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
markTaskRun(currentTask, currentTime);
if (enableProfiling) {
markTaskRun(currentTask, currentTime);
}
const continuationCallback = callback(didUserCallbackTimeout);
currentTime = getCurrentTime();
if (typeof continuationCallback === 'function') {
currentTask.callback = continuationCallback;
markTaskYield(currentTask, currentTime);
if (enableProfiling) {
markTaskYield(currentTask, currentTime);
}
} else {
if (enableProfiling) {
markTaskCompleted(currentTask, currentTime);
Expand Down
2 changes: 1 addition & 1 deletion packages/scheduler/src/SchedulerFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

export const enableSchedulerDebugging = false;
export const enableIsInputPending = false;
export const enableProfiling = __PROFILE__;
export const enableProfiling = false;
3 changes: 2 additions & 1 deletion packages/scheduler/src/__tests__/SchedulerProfiling-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ function priorityLevelToString(priorityLevel) {
}

describe('Scheduler', () => {
if (!__PROFILE__) {
const {enableProfiling} = require('scheduler/src/SchedulerFeatureFlags');
if (!enableProfiling) {
// The tests in this suite only apply when profiling is on
it('profiling APIs are not available', () => {
Scheduler = require('scheduler');
Expand Down

0 comments on commit b2bbee7

Please sign in to comment.