Skip to content

Conversation

@hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Apr 9, 2025

Summary:

Changelog: [Internal]

We've been using same function that formats chrono to unix timestamp in microseconds in multiple different places.

In this diff:

  • Introduced TracingTimeStamp that can be used in Tracing domain.
  • Moved the formatter to chronoToTracingTimeStamp in react/timing/primitives.h and re-used it.

Differential Revision: D72649815

@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 fb-exported labels Apr 9, 2025
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Apr 9, 2025
Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

We've been using same function that formats chrono to unix timestamp in microseconds in multiple different places.

In this diff:
- Introduced `TracingTimeStamp` that can be used  in Tracing domain.
- Moved the formatter to `chronoToTracingTimeStamp` in `react/timing/primitives.h` and re-used it.

Differential Revision: D72649815
hoxyq added a commit to hoxyq/react-native that referenced this pull request Apr 9, 2025
Summary:

# Changelog: [Internal]

We've been using same function that formats chrono to unix timestamp in microseconds in multiple different places.

In this diff:
- Introduced `TracingTimeStamp` that can be used  in Tracing domain.
- Moved the formatter to `chronoToTracingTimeStamp` in `react/timing/primitives.h` and re-used it.

Differential Revision: D72649815
@hoxyq hoxyq force-pushed the export-D72649815 branch from 3034e90 to 692356a Compare April 9, 2025 14:36
@facebook-github-bot
Copy link
Contributor

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request Apr 9, 2025
Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

We've been using same function that formats chrono to unix timestamp in microseconds in multiple different places.

In this diff:
- Introduced `TracingTimeStamp` that can be used  in Tracing domain.
- Moved the formatter to `chronoToTracingTimeStamp` in `react/timing/primitives.h` and re-used it.

Differential Revision: D72649815
@hoxyq hoxyq force-pushed the export-D72649815 branch from 692356a to bcd5473 Compare April 9, 2025 14:41
hoxyq added a commit to hoxyq/react-native that referenced this pull request Apr 9, 2025
Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

We've been using same function that formats chrono to unix timestamp in microseconds in multiple different places.

In this diff:
- Introduced `TracingTimeStamp` that can be used  in Tracing domain.
- Moved the formatter to `chronoToTracingTimeStamp` in `react/timing/primitives.h` and re-used it.

Differential Revision: D72649815
hoxyq added a commit to hoxyq/react-native that referenced this pull request Apr 10, 2025
Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

We've been using same function that formats chrono to unix timestamp in microseconds in multiple different places.

In this diff:
- Introduced `TracingTimeStamp` that can be used  in Tracing domain.
- Moved the formatter to `chronoToTracingTimeStamp` in `react/timing/primitives.h` and re-used it.

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

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request May 19, 2025
facebook#50585)

Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Differential Revision: D72649815
@hoxyq hoxyq force-pushed the export-D72649815 branch from bcd5473 to aa26951 Compare May 19, 2025 13:57
hoxyq added a commit to hoxyq/react-native that referenced this pull request May 20, 2025
facebook#50585)

Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

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

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

hoxyq added a commit to hoxyq/react-native that referenced this pull request May 20, 2025
facebook#50585)

Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Differential Revision: D72649815
@hoxyq hoxyq force-pushed the export-D72649815 branch from aa26951 to 84b8d43 Compare May 20, 2025 17:35
@facebook-github-bot
Copy link
Contributor

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

@hoxyq hoxyq force-pushed the export-D72649815 branch from 84b8d43 to d412ac1 Compare May 20, 2025 17:44
hoxyq added a commit to hoxyq/react-native that referenced this pull request May 20, 2025
facebook#50585)

Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Differential Revision: D72649815
hoxyq added a commit to hoxyq/react-native that referenced this pull request May 20, 2025
facebook#50585)

Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Differential Revision: D72649815
hoxyq added 2 commits May 21, 2025 05:58
…onverters (facebook#51455)

Summary:
Pull Request resolved: facebook#51455

# Changelog: [Internal]

The main idea is that subsystems who might use a different time origin (the starting point of the whole timeline of events), can use `toChronoSteadyClockTimePoint` method to get raw `std::chrono::steady_clock::time_point` and then offset it by some arbitrary epoch: be it unix time origin or `std::chrono::steady_clock::epoch`.

`fromChronoSteadyClockTimePoint` can be used to convert time stamps from external systems, like Hermes.

Differential Revision: D74892329
Summary:
Pull Request resolved: facebook#51454

# Changelog: [Internal]

There are multiple changes:
1. `PerformanceTracer` class, `TraceEvent` struct are moved to `tracing` namespace. These are parts of the Tracing subsystems of the jsinspector, this should bring more clarity and make things more explicit.
2. Added `Timing.h` class which defines conversion logic from `HighResTimeStamp` to absolute units that are expected by CDP.
3. `PerformanceTracer` will receive timestamps for Performance Web API entries in `HighResTimeStamp`.

Also, we will explicilty define a Tracking Clock time origin that will be epoch of the `steady_clock`. This aligns with the approach in Chromium and saves us from aligning custom DOMHighResTimeStamps that can be specified in performance.mark / performance.measure calls: these should not extend the timeline window. I've confirmed that this is the current behavior in Chromium.

Differential Revision: D74892330
hoxyq added a commit to hoxyq/react-native that referenced this pull request May 21, 2025
facebook#50585)

Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Differential Revision: D72649815
facebook#50585)

Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Reviewed By: rubennorte

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

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

@hoxyq hoxyq force-pushed the export-D72649815 branch from d412ac1 to 0f276f1 Compare May 21, 2025 13:21
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label May 21, 2025
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 84fa745.

@facebook-github-bot
Copy link
Contributor

This pull request has been reverted by 65ef8fe.

hoxyq added a commit to hoxyq/react-native that referenced this pull request May 22, 2025
facebook#50585)

Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Differential Revision: D75185613
hoxyq added a commit to hoxyq/react-native that referenced this pull request May 22, 2025
facebook#50585)

Summary:
Pull Request resolved: facebook#50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Reviewed By: rubennorte

Differential Revision: D75185613
facebook-github-bot pushed a commit that referenced this pull request May 22, 2025
#51512)

Summary:
Pull Request resolved: #51512

Pull Request resolved: #50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Reviewed By: rubennorte

Differential Revision: D75185613

fbshipit-source-id: 889719368de163e6f529689df6cc16d816fde66c
ghost pushed a commit to discord/react-native that referenced this pull request Jul 29, 2025
facebook#51512)

Summary:
Pull Request resolved: facebook#51512

Pull Request resolved: facebook#50585

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Reviewed By: rubennorte

Differential Revision: D75185613

fbshipit-source-id: 889719368de163e6f529689df6cc16d816fde66c
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 Reverted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants