Skip to content

Commit b2bbee7

Browse files
Brian Vaughngaearon
authored andcommitted
Disable (unstable) scheduler sampling profiler for OSS builds (facebook#20832)
* Disabled Scheduler sampling profiler for OSS builds * Added missing conditional feature flag around profiling calls
1 parent 8cc6ff2 commit b2bbee7

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

packages/scheduler/src/Scheduler.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,16 @@ function workLoop(hasTimeRemaining, initialTime) {
181181
currentTask.callback = null;
182182
currentPriorityLevel = currentTask.priorityLevel;
183183
const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
184-
markTaskRun(currentTask, currentTime);
184+
if (enableProfiling) {
185+
markTaskRun(currentTask, currentTime);
186+
}
185187
const continuationCallback = callback(didUserCallbackTimeout);
186188
currentTime = getCurrentTime();
187189
if (typeof continuationCallback === 'function') {
188190
currentTask.callback = continuationCallback;
189-
markTaskYield(currentTask, currentTime);
191+
if (enableProfiling) {
192+
markTaskYield(currentTask, currentTime);
193+
}
190194
} else {
191195
if (enableProfiling) {
192196
markTaskCompleted(currentTask, currentTime);

packages/scheduler/src/SchedulerFeatureFlags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
export const enableSchedulerDebugging = false;
1010
export const enableIsInputPending = false;
11-
export const enableProfiling = __PROFILE__;
11+
export const enableProfiling = false;

packages/scheduler/src/__tests__/SchedulerProfiling-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ function priorityLevelToString(priorityLevel) {
4444
}
4545

4646
describe('Scheduler', () => {
47-
if (!__PROFILE__) {
47+
const {enableProfiling} = require('scheduler/src/SchedulerFeatureFlags');
48+
if (!enableProfiling) {
4849
// The tests in this suite only apply when profiling is on
4950
it('profiling APIs are not available', () => {
5051
Scheduler = require('scheduler');

0 commit comments

Comments
 (0)