Skip to content

Commit

Permalink
Add native function to determine if systrace is enabled
Browse files Browse the repository at this point in the history
Summary:
We're currently using `global.__RCTProfileIsProfiling` to determine if the app is currently profiling to forward calls to Systrace to native.

We're defining `global.__RCTProfileIsProfiling` when the React Native runtime is initialized (which, in most cases, is on startup or shortly after startup), which means that enabling profiling in the middle of the session doesn't set this value to `true`.

This diff adds a new method (in the global scope for now, as the rest of bindings for Systrace) to check if we're profiling in real time. This call should be very cheap as it's implemented as a JSI function that calls into a C++ API directly.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D40095840

fbshipit-source-id: e7030d6370ecb43d56478b03cb63806ffa0cd0cf
  • Loading branch information
rubennorte authored and facebook-github-bot committed Oct 5, 2022
1 parent 3d8c097 commit 1dde374
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/hermes/VM/PredefinedStrings.def
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ STR(__rnReserved17, "nativeQPLMarkerTag")
STR(__rnReserved18, "nativeQPLMarkerAnnotate")
STR(__rnReserved20, "nativeGetThreadMajorPageFaults")
STR(__rnReserved21, "__jsiExecutorDescription")
STR(__rnReserved22, "nativeTraceIsTracing")

#ifdef HERMES_ENABLE_FUZZILLI
STR(fuzzilli, "fuzzilli")
Expand Down

0 comments on commit 1dde374

Please sign in to comment.