Skip to content

sueLan/react-native-bridge-instrument

Repository files navigation

ReactNativeBridgeInstrument

CI Status Version License Platform

Usage

Basically, you have to write a method in mm file to use these C++ functions.

#include <ReactNativeBridgeInstrument/CxxNativeModulePerfLogger.h>
// make sure `CXXFLAGS += -std=c++14` or 14 above in your Xcode building settings
#include <memory>

- (void)initializeInstrument
{
  facebook::react::CxxNativeModulePerfLogger logger = facebook::react::CxxNativeModulePerfLogger();
  facebook::react::BridgeNativeModulePerfLogger::enableLogging(std::make_unique<facebook::react::CxxNativeModulePerfLogger>(logger));
}

In Instrument

  1. Open the instrument, choose Blank template in Instrument

    image-20210926173249306

  2. Then , add os_signpost to current template, and start recording.

    image-20210926173031427

  3. pay attention to our customed logger Volume. There are 4 parts,

  • async_method_call: collect data for asynchronous methods running through JSBridge
  • js_require : used to calculate time interval to initialize modules
  • module : used to calculate time interval to create RCTModuleData
  • sync_method_call : collect data for synchronous methods running through JSBridgeimage-20210926174136104image-20210926175209847

About

Use `SignPost` supported by iOS to monitor activity from JavaScript to iOS native modules. https://suelan.github.io/2021/08/13/20210813-react-native-instrument-profile/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published