This utility is a simple charting utility that allows you to export logs from Flipper and view them in a timeline chart. It was created using create-react-app.
- Flipper (https://fbflipper.com/)
- Inkitt Flash App (https://github.com/inkitt/flash)
- Startup Flipper and select the 'React Native Logs' tab
- Use console.log in the inkitt/flash app formatted like this
const startTime = launchAppTimeStore.currentTimeFromAppStart
methodToProfileHere()
const logTitle = "withBootstrapper-init"
const endTime = launchAppTimeStore.currentTimeFromAppStart
console.log(
`PERF-MONITOR-LOG|${logTitle}|${startTime}|${endTime}`,
);
Note:
( TODO: Provide utility method in inkitt/flash to wrap this logic )
- Each element in this console must be
|deliniated and follow the format below. PERF-MONITOR-LOGis a hardcoded string that you should not change.logTitleoften the name of the method to be profiledstartTimethe best way to get this is to use the launchAppTimeStore as demonstrated aboveendTimethe best way to get this is to use the launchAppTimeStore as demonstrated above
- Run the inkitt/flash app
- Enter
PERF-MONITOR-LOGin the "Search" bar in flipper to filter the logs to only perf monitoring logs - Highlight all rows and select
Copy Row(s) -> Copy Row(s) JSON - Add a new file to
src/data/logs/<FILE_NAME_HERE>.json. File name can be anything you want it to be but should be unique across all files in this directory. - Run
npm run startto start the app. - Select the
View Logsbutton. - All files that exist in the
logsdirectory will be available in the dropdown above the chart.
- Startup Flipper and select the 'Network' tab (it may be disabled)
- Run the inkitt/flash app
- Highlight desired rows in Flipper network logs and select
Copy Row(s) -> Copy Row(s) JSON - Add a new file to
src/data/network/<FILE_NAME_HERE>.json. File name can be anything you want it to be but should be unique across all files in this directory. - Run
npm run startto start the app. - Select the
View Network Performancebutton. - All files that exist in the
networkdirectory will be available in the dropdown above the chart.