dillon1000/react

Commit

[Scheduler] Profiling features (#16145)

* [Scheduler] Mark user-timing events

Marks when Scheduler starts and stops running a task. Also marks when
a task is initially scheduled, and when Scheduler is waiting for a
callback, which can't be inferred from a sample-based JavaScript CPU
profile alone.

The plan is to use the user-timing events to build a Scheduler profiler
that shows how the lifetime of tasks interact with each other and
with unscheduled main thread work.

The test suite works by printing an text representation of a
Scheduler flamegraph.

* Expose shared array buffer with profiling info

Array contains

- the priority Scheduler is currently running
- the size of the queue
- the id of the currently running task

* Replace user-timing calls with event log

Events are written to an array buffer using a custom instruction format.
For now, this is only meant to be used during page start up, before the
profiler worker has a chance to start up. Once the worker is ready, call
`stopLoggingProfilerEvents` to return the log up to that point, then
send the array buffer to the worker.

Then switch to the sampling based approach.

* Record the current run ID

Each synchronous block of Scheduler work is given a unique run ID. This
is different than a task ID because a single task will have more than
one run if it yields with a continuation.
Browse files
Changed paths18 files
First-parent comparison
M .eslintrc.js ModifiedM packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js ModifiedM packages/scheduler/npm/umd/scheduler.development.js ModifiedM packages/scheduler/npm/umd/scheduler.production.min.js ModifiedM packages/scheduler/npm/umd/scheduler.profiling.min.js ModifiedM packages/scheduler/src/Scheduler.js ModifiedM packages/scheduler/src/SchedulerFeatureFlags.js ModifiedA packages/scheduler/src/SchedulerPriorities.js AddedA packages/scheduler/src/SchedulerProfiling.js AddedM packages/scheduler/src/__tests__/SchedulerDOM-test.js ModifiedA packages/scheduler/src/__tests__/SchedulerProfiling-test.js AddedM packages/scheduler/src/forks/SchedulerFeatureFlags.www.js ModifiedM packages/scheduler/src/forks/SchedulerHostConfig.default.js ModifiedM scripts/rollup/bundles.js ModifiedM scripts/rollup/validate/eslintrc.cjs.js ModifiedM scripts/rollup/validate/eslintrc.fb.js ModifiedM scripts/rollup/validate/eslintrc.rn.js ModifiedM scripts/rollup/validate/eslintrc.umd.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…