Skip to content

Commit

Permalink
Log renderApplication_React_render timespan to scoped performance log…
Browse files Browse the repository at this point in the history
…ger if available

Summary: Changelog: [Changed] Used scoped performance logger to mark the beginning and end of the call to the renderer, instead of using `GlobalPerformanceLogger`.

Reviewed By: lunaleaps

Differential Revision: D23240784

fbshipit-source-id: 7099f1a4b5da3f29596fcee289a715d295ae0a65
  • Loading branch information
rubennorte authored and facebook-github-bot committed Sep 3, 2020
1 parent 57b10f7 commit 38062cf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Libraries/ReactNative/renderApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ function renderApplication<Props: Object>(
) {
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);

const performanceLogger = scopedPerformanceLogger ?? GlobalPerformanceLogger;

const renderable = (
<PerformanceLoggerContext.Provider
value={scopedPerformanceLogger ?? GlobalPerformanceLogger}>
<PerformanceLoggerContext.Provider value={performanceLogger}>
<AppContainer
rootTag={rootTag}
fabric={fabric}
Expand All @@ -48,13 +49,13 @@ function renderApplication<Props: Object>(
</PerformanceLoggerContext.Provider>
);

GlobalPerformanceLogger.startTimespan('renderApplication_React_render');
performanceLogger.startTimespan('renderApplication_React_render');
if (fabric) {
require('../Renderer/shims/ReactFabric').render(renderable, rootTag);
} else {
require('../Renderer/shims/ReactNative').render(renderable, rootTag);
}
GlobalPerformanceLogger.stopTimespan('renderApplication_React_render');
performanceLogger.stopTimespan('renderApplication_React_render');
}

module.exports = renderApplication;

0 comments on commit 38062cf

Please sign in to comment.