Class: TSegmentTimingContext
Defined in: debug/segment-timer.ts:33
Context object for timing a segment. Allows creating child segments and properly tracking hierarchical timing even with concurrent operations.
Constructors
Constructor
new TSegmentTimingContext(
timer,segment,parentContext):TSegmentTimingContext
Defined in: debug/segment-timer.ts:38
Parameters
timer
segment
TSegment
parentContext
TSegmentTimingContext | null
Returns
TSegmentTimingContext
Methods
addChildTime()
addChildTime(
duration):void
Defined in: debug/segment-timer.ts:125
Internal method to track time spent in child segments
Parameters
duration
number
Returns
void
end()
end():
void
Defined in: debug/segment-timer.ts:75
End timing for this segment and record the results. Can be called multiple times safely (subsequent calls are no-ops).
Returns
void
getSegment()
getSegment():
Readonly<TSegment>
Defined in: debug/segment-timer.ts:132
Get the segment being timed by this context
Returns
Readonly<TSegment>
startSegment()
startSegment(
name):TSegmentTimingContext
Defined in: debug/segment-timer.ts:62
Start timing a child segment within this segment's context.
Parameters
name
string
Name of the child segment
Returns
TSegmentTimingContext
A new timing context for the child segment
Example
const updateSegment = segmentTimer.startSegment("Update");
const physicsSegment = updateSegment.startSegment("Physics");
// ... physics work ...
physicsSegment.end();
updateSegment.end();