Skip to content

Add trace helper to Systrace (#56936)#56936

Closed
rubennorte wants to merge 1 commit into
facebook:mainfrom
rubennorte:export-D106071568
Closed

Add trace helper to Systrace (#56936)#56936
rubennorte wants to merge 1 commit into
facebook:mainfrom
rubennorte:export-D106071568

Conversation

@rubennorte
Copy link
Copy Markdown
Contributor

@rubennorte rubennorte commented May 22, 2026

Summary:

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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 22, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 22, 2026

@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106071568.

@github-actions
Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

rubennorte added a commit to rubennorte/react-native that referenced this pull request May 22, 2026
Summary:

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
@meta-codesync meta-codesync Bot changed the title Add trace helper to Systrace Add trace helper to Systrace (#56936) May 22, 2026
@rubennorte rubennorte force-pushed the export-D106071568 branch from c892b41 to c8bab1f Compare May 22, 2026 11:25
Summary:

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
@rubennorte rubennorte force-pushed the export-D106071568 branch from c8bab1f to ba788c2 Compare May 22, 2026 11:46
@meta-codesync meta-codesync Bot closed this in e6c7a26 May 22, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label May 22, 2026
@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @rubennorte in e6c7a26

When will my fix make it into a release? | How to file a pick request?

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 22, 2026

This pull request has been merged in e6c7a26.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants