SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 155 C++

Add `trace` helper to Systrace (#56936)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56936

Adds a new `trace` helper to the `Systrace` module that wraps a function call between `beginEvent` and `endEvent`, ensuring the trace section is closed even if the function throws.

Usage:

```
Systrace.trace('name', () => {
  // logic to trace
});
```

The implementation is guarded with `isEnabled()` and inlines `beginEvent`/`endEvent` so that the no-op path avoids redundant work when tracing is disabled.

Changelog:
[General][Added] - Add `Systrace.trace` helper that wraps a function with begin/end events using try/finally

Reviewed By: javache

Differential Revision: D106071568

fbshipit-source-id: 98ee7b708a38c8b1bac39f7032eb6c02b82563c1
R
Rubén Norte committed
e6c7a269d2b31aea770470078ae5ae1887326c7c
Parent: 1632b74
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 5/22/2026, 1:46:02 PM