MCPcopy
hub / github.com/facebook/react / recordEffectDuration

Function recordEffectDuration

packages/react-reconciler/src/ReactProfilerTimer.js:635–654  ·  view source on GitHub ↗
(fiber: Fiber)

Source from the content-addressed store, hash-verified

633}
634
635export function recordEffectDuration(fiber: Fiber): void {
636 if (!enableProfilerTimer || !enableProfilerCommitHooks) {
637 return;
638 }
639
640 if (profilerStartTime >= 0) {
641 const endTime = now();
642 const elapsedTime = endTime - profilerStartTime;
643
644 profilerStartTime = -1;
645
646 // Store duration on the next nearest Profiler ancestor
647 // Or the root (for the DevTools Profiler to read)
648 profilerEffectDuration += elapsedTime;
649 componentEffectDuration += elapsedTime;
650
651 // Keep track of the last end time of the effects.
652 componentEffectEndTime = endTime;
653 }
654}
655
656export function recordEffectError(errorInfo: CapturedValue<mixed>): void {
657 if (!enableProfilerTimer || !enableProfilerCommitHooks) {

Callers 8

commitHookLayoutEffectsFunction · 0.90
commitAttachRefFunction · 0.90
safelyDetachRefFunction · 0.90

Calls 1

nowFunction · 0.50

Tested by

no test coverage detected