Skip to content

RCTRenderingPerf does not expose ReactPerf.printExclusive() #13608

@beeglebug

Description

@beeglebug

Description

When calling RCTRenderingPerf.stop, we automatically get the output from ReactPerf.printInclusive() and ReactPerf.printWasted(), but have no way of getting ReactPerf.printExclusive(), as it is not exposed by the module.

Reproduction Steps and Sample Code

The following code will trigger the output from printInclusive and printWasted:

import PerfMonitor from 'react-native/Libraries/Performance/RCTRenderingPerf'

PerfMonitor.toggle()
PerfMonitor.start()
setTimeout(() => {
    PerfMonitor.stop()
}, 1000)

Solution

Expose the output functions to be called directly instead of automatically calling some inside stop.

import PerfMonitor from 'react-native/Libraries/Performance/RCTRenderingPerf'

PerfMonitor.toggle()
PerfMonitor.start()
setTimeout(() => {
    PerfMonitor.stop()
    PerfMonitor.printExclusive()
    PerfMonitor.printInclusive()
    PerfMonitor.printWasted()
}, 1000)

I am happy to do a merge request for this.

Additional Information

  • React Native version: 0.43.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions