Import
Profiler
Accumulates named timing measurements and produces a summary.
Constructor
Methods
Example
Debug utilities
Standalone timing functions frombytekit/debug for one-off measurements without managing a Profiler instance.
createStopwatch
Creates a manual stopwatch for fine-grained control.
Options
Stopwatch methods
Example
withTiming
Wraps an async function and logs its execution time.
Example
measureSync
Measures a synchronous function and returns its result.
Example
measureAsync
Measures an async function and returns both the result and the duration.
Example
captureDebug
Captures timing information for an async operation without a label.
Example
Choosing the right tool
Use Profiler when…
Use Profiler when…
You need to accumulate multiple named measurements across a workflow and produce a summary at the end — for example, profiling an entire request lifecycle.
Use createStopwatch when…
Use createStopwatch when…
You want manual start/stop control over a single measurement with optional automatic logging.
Use withTiming / measureSync / measureAsync when…
Use withTiming / measureSync / measureAsync when…
You want a one-liner that wraps an existing function call and logs or returns the duration.
Use captureDebug when…
Use captureDebug when…
You need a quick timing capture without labels or logging — useful in tests and diagnostics.