Skip to content

Record React Native process and Main thread#49370

Closed
hoxyq wants to merge 4 commits into
facebook:mainfrom
hoxyq:export-D69465926
Closed

Record React Native process and Main thread#49370
hoxyq wants to merge 4 commits into
facebook:mainfrom
hoxyq:export-D69465926

Conversation

@hoxyq
Copy link
Copy Markdown
Contributor

@hoxyq hoxyq commented Feb 12, 2025

Summary:

Changelog: [Internal]

When we start tracing, we will record metadata events for current process and thread.

Important: This is based off the assumption that Tracing.start CDP method will be handled on main thread.

Once we have a separate thread for inspector, we should move this code to be explicitly run on Main thread.

Differential Revision: D69465926

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Feb 12, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D69465926

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D69465926

Summary:

# Changelog: [Internal]

Added OS-agnostic module that will implement 2 basic capabilities:
- Getting current process id
- Getting current thread id

Reviewed By: javache

Differential Revision: D69316093
Summary:

# Changelog: [Internal]

Use newly added module to get real OS-level process and thread ids.

We will keep process id on an instance, because I don't think it could change over time? For thread id, we will get it at the time of event registration.

Reviewed By: rozele

Differential Revision: D69316094
…k#49083)

Summary:

# Changelog: [Internal]

> NOTE: Some CI jobs are expected to fail, because changes in Hermes D67353585 should be landed first, and then grafted to Static Hermes.

Added 2 new public methods to `PerformanceTracer` instance for registering metadata Trace Events for processes and threads.

Reviewed By: huntie

Differential Revision: D68439733
Summary:

# Changelog: [Internal]

When we start tracing, we will record metadata event for current process.

We will base it off the assumption that the thread where we handle `Tracing.start` event is the main one.

We can't register the main thread yet:
1. We can't assume that CDP messages are handled on it - this is not the case for Windows and in a long term Inspector will be moved to its own thread
2. We don't have any similar mechanism as Runtime Executor, but for Main thread. This will require Host providing an executor for it.

I've validated at the top of the stack that not registering the main thread should not affect how trace is displayed in CDT.

Reviewed By: rozele

Differential Revision: D69465926
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D69465926

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 17, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 13dae06.

ghost pushed a commit to discord/react-native that referenced this pull request Jul 29, 2025
Summary:
Pull Request resolved: facebook#49370

# Changelog: [Internal]

When we start tracing, we will record metadata event for current process.

We will base it off the assumption that the thread where we handle `Tracing.start` event is the main one.

We can't register the main thread yet:
1. We can't assume that CDP messages are handled on it - this is not the case for Windows and in a long term Inspector will be moved to its own thread
2. We don't have any similar mechanism as Runtime Executor, but for Main thread. This will require Host providing an executor for it.

I've validated at the top of the stack that not registering the main thread should not affect how trace is displayed in CDT.

Reviewed By: rozele

Differential Revision: D69465926

fbshipit-source-id: 103de1da9d00564bf201456ad04a465387c1d542
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. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants