Skip to content

refactor: well-defined behaviour #52187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Jun 23, 2025

Summary:

Changelog: [Internal]

  • tracing_ is now std::atomic<bool>.
  • performanceMeasureCount_ is nowstd::atomic<uint32_t>.
  • mutex_ -> bufferMutex_.

The biggest change is that we no longer read from tracing_ directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030

@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 Jun 23, 2025
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 23, 2025
Summary:

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `bufferMutex_`.


The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
@hoxyq hoxyq force-pushed the export-D77053030 branch from 3572790 to 7399b64 Compare June 23, 2025 12:06
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 23, 2025
Summary:

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `bufferMutex_`.


The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 23, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `bufferMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
@hoxyq hoxyq force-pushed the export-D77053030 branch from 7399b64 to e9e295b Compare June 23, 2025 12:09
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 23, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 23, 2025
Summary:

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.


The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
@hoxyq hoxyq force-pushed the export-D77053030 branch from e9e295b to 485fce7 Compare June 23, 2025 13:36
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 23, 2025
Summary:

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.


The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
@hoxyq hoxyq force-pushed the export-D77053030 branch from 485fce7 to c864d01 Compare June 23, 2025 14:12
@facebook-github-bot
Copy link
Contributor

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

@hoxyq hoxyq force-pushed the export-D77053030 branch from c864d01 to 07dc425 Compare June 23, 2025 14:16
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 23, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 23, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 23, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 24, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
@hoxyq hoxyq force-pushed the export-D77053030 branch from 07dc425 to ee13d92 Compare June 24, 2025 20:47
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 24, 2025
Summary:

# Changelog: [Internal]

- `bool tracing_` -> `std::atomic<bool> tracingAtomic_`.
- More doc-comments to explain the usage of mutex and atomics.
- `PerformanceTracer::isTracing()` -> `inline PerformanceTracer::isTracing()`.
- `uint64_t processId_` -> `const uint64_t processId_`.

The main change is that the boolean flag that controls "if we are tracing" is now atomic, which should eliminate potential data races. To avoid "logic" races, we are still going to lock mutex, and then check again. The use of `std::atomic` allows us to perform cheaper check first to avoid potentially unnecessary serializations from other systems that report events into `PerformanceTracer`.

Differential Revision: D77053030
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 24, 2025
Summary:

# Changelog: [Internal]

- `bool tracing_` -> `std::atomic<bool> tracingAtomic_`.
- More doc-comments to explain the usage of mutex and atomics.
- `PerformanceTracer::isTracing()` -> `inline PerformanceTracer::isTracing()`.
- `uint64_t processId_` -> `const uint64_t processId_`.

The main change is that the boolean flag that controls "if we are tracing" is now atomic, which should eliminate potential data races. To avoid "logic" races, we are still going to lock mutex, and then check again. The use of `std::atomic` allows us to perform cheaper check first to avoid potentially unnecessary serializations from other systems that report events into `PerformanceTracer`.

Differential Revision: D77053030
@hoxyq hoxyq force-pushed the export-D77053030 branch from ee13d92 to c468599 Compare June 24, 2025 22:33
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:

# Changelog: [Internal]

- `bool tracing_` -> `std::atomic<bool> tracingAtomic_`.
- More doc-comments to explain the usage of mutex and atomics.
- `PerformanceTracer::isTracing()` -> `inline PerformanceTracer::isTracing()`.
- `uint64_t processId_` -> `const uint64_t processId_`.

The main change is that the boolean flag that controls "if we are tracing" is now atomic, which should eliminate potential data races. To avoid "logic" races, we are still going to lock mutex, and then check again. The use of `std::atomic` allows us to perform cheaper check first to avoid potentially unnecessary serializations from other systems that report events into `PerformanceTracer`.

Reviewed By: rubennorte

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:

# Changelog: [Internal]

- `bool tracing_` -> `std::atomic<bool> tracingAtomic_`.
- More doc-comments to explain the usage of mutex and atomics.
- `PerformanceTracer::isTracing()` -> `inline PerformanceTracer::isTracing()`.
- `uint64_t processId_` -> `const uint64_t processId_`.

The main change is that the boolean flag that controls "if we are tracing" is now atomic, which should eliminate potential data races. To avoid "logic" races, we are still going to lock mutex, and then check again. The use of `std::atomic` allows us to perform cheaper check first to avoid potentially unnecessary serializations from other systems that report events into `PerformanceTracer`.

Reviewed By: rubennorte

Differential Revision: D77053030
@hoxyq hoxyq force-pushed the export-D77053030 branch 2 times, most recently from b04d020 to 286d96e Compare June 25, 2025 09:37
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
@facebook-github-bot
Copy link
Contributor

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

Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `bool tracing_` -> `std::atomic<bool> tracingAtomic_`.
- More doc-comments to explain the usage of mutex and atomics.
- `PerformanceTracer::isTracing()` -> `inline PerformanceTracer::isTracing()`.
- `uint64_t processId_` -> `const uint64_t processId_`.

The main change is that the boolean flag that controls "if we are tracing" is now atomic, which should eliminate potential data races. To avoid "logic" races, we are still going to lock mutex, and then check again. The use of `std::atomic` allows us to perform cheaper check first to avoid potentially unnecessary serializations from other systems that report events into `PerformanceTracer`.

Reviewed By: rubennorte

Differential Revision: D77053030
@facebook-github-bot
Copy link
Contributor

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

@hoxyq hoxyq force-pushed the export-D77053030 branch from 286d96e to c6c2d10 Compare June 25, 2025 09:43
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:

# Changelog: [Internal]

- `bool tracing_` -> `std::atomic<bool> tracingAtomic_`.
- More doc-comments to explain the usage of mutex and atomics.
- `PerformanceTracer::isTracing()` -> `inline PerformanceTracer::isTracing()`.
- `uint64_t processId_` -> `const uint64_t processId_`.

The main change is that the boolean flag that controls "if we are tracing" is now atomic, which should eliminate potential data races. To avoid "logic" races, we are still going to lock mutex, and then check again. The use of `std::atomic` allows us to perform cheaper check first to avoid potentially unnecessary serializations from other systems that report events into `PerformanceTracer`.

Reviewed By: rubennorte

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:

# Changelog: [Internal]

- `bool tracing_` -> `std::atomic<bool> tracingAtomic_`.
- More doc-comments to explain the usage of mutex and atomics.
- `PerformanceTracer::isTracing()` -> `inline PerformanceTracer::isTracing()`.
- `uint64_t processId_` -> `const uint64_t processId_`.

The main change is that the boolean flag that controls "if we are tracing" is now atomic, which should eliminate potential data races. To avoid "logic" races, we are still going to lock mutex, and then check again. The use of `std::atomic` allows us to perform cheaper check first to avoid potentially unnecessary serializations from other systems that report events into `PerformanceTracer`.

Reviewed By: rubennorte

Differential Revision: D77053030
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jun 25, 2025
Summary:
Pull Request resolved: facebook#52187

# Changelog: [Internal]

- `tracing_` is now `std::atomic<bool>`.
- `performanceMeasureCount_` is now`std::atomic<uint32_t>`.
- `mutex_` -> `tracingMutex_`.

The biggest change is that we no longer read from `tracing_` directly for an early-return when not tracing. This should not significantly regress performance of the subsystem, see the test plan for numbers.

Differential Revision: D77053030
@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @hoxyq in e504909

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

@react-native-bot react-native-bot added the Merged This PR has been merged. label Jun 25, 2025
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in e504909.

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.

3 participants