This plugin is the platform-specific backend implementation for RN Ottrelite Core. On Android, it utilizes ATrace (Android tracing API), on iOS it utilizes the OSSignposter API.
Feature | Support level |
---|---|
synchronous traces ({begin,end}Event ) | Android: API level (Android M); |
asynchronous traces ({begin,end}AsyncEvent ) | Android: API level (Android Q) |
counter events (counterEvent ) | Android: API level (Android Q) |
This backend is designed to cover development-time use cases, such as:
This backend is not designed for production use cases and should not be installed in such builds - be sure to conditionally install it from JS when a feature flag is set, such as isProfilingEnabled
. To exclude it from the binary at build time, you can use the react-native.config.js
file to specify that it should only be included in debug builds as per the documentation (iOS, Android).
To use this package, you need to install it in your React Native project:
And register the backend with Ottrelite Core in your entrypoint file (e.g. index.js
):
You can record and view traces in two ways:
perfetto
CLI tool, which is distributed as part of the Android OS onboard most modern devices. More details can be found in the documentation; the resulting file can be viewed in Perfetto UI; this method works only on a physical deviceYou can view the traces in Xcode Instruments, as per the documentation.
The traces will be signpost-ed using the OSSignposter
API, using the default OS_LOG_DEFAULT
logger.