[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.
This commit is contained in:
@@ -411,7 +411,13 @@ const bundles = [
|
||||
|
||||
/******* React Scheduler (experimental) *******/
|
||||
{
|
||||
bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD],
|
||||
bundleTypes: [
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
FB_WWW_PROFILING,
|
||||
],
|
||||
moduleType: ISOMORPHIC,
|
||||
entry: 'scheduler',
|
||||
global: 'Scheduler',
|
||||
|
||||
@@ -21,6 +21,11 @@ module.exports = {
|
||||
process: true,
|
||||
setImmediate: true,
|
||||
Buffer: true,
|
||||
|
||||
// Scheduler profiling
|
||||
SharedArrayBuffer: true,
|
||||
Int32Array: true,
|
||||
ArrayBuffer: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 5,
|
||||
|
||||
@@ -22,6 +22,11 @@ module.exports = {
|
||||
// Node.js Server Rendering
|
||||
setImmediate: true,
|
||||
Buffer: true,
|
||||
|
||||
// Scheduler profiling
|
||||
SharedArrayBuffer: true,
|
||||
Int32Array: true,
|
||||
ArrayBuffer: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 5,
|
||||
|
||||
@@ -21,6 +21,11 @@ module.exports = {
|
||||
// Fabric. See https://github.com/facebook/react/pull/15490
|
||||
// for more information
|
||||
nativeFabricUIManager: true,
|
||||
|
||||
// Scheduler profiling
|
||||
SharedArrayBuffer: true,
|
||||
Int32Array: true,
|
||||
ArrayBuffer: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 5,
|
||||
|
||||
@@ -24,6 +24,11 @@ module.exports = {
|
||||
define: true,
|
||||
require: true,
|
||||
global: true,
|
||||
|
||||
// Scheduler profiling
|
||||
SharedArrayBuffer: true,
|
||||
Int32Array: true,
|
||||
ArrayBuffer: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 5,
|
||||
|
||||
Reference in New Issue
Block a user