Skip to content

Commit

Permalink
Merge pull request #11206 from hannojg/chore/make-TTI-more-accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham authored Sep 22, 2022
2 parents f76f708 + 415ce3e commit 672aca3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/libs/Performance.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'underscore';
import lodashTransform from 'lodash/transform';
import React, {Profiler, forwardRef} from 'react';
import {Alert} from 'react-native';
import {Alert, InteractionManager} from 'react-native';

import * as Metrics from './Metrics';
import getComponentDisplayName from './getComponentDisplayName';
Expand Down Expand Up @@ -92,8 +92,13 @@ if (Metrics.canCapturePerformanceMetrics()) {

// Capture any custom measures or metrics below
if (mark.name === `${CONST.TIMING.SIDEBAR_LOADED}_end`) {
rnPerformance.measure('TTI', 'nativeLaunchStart', mark.name);
Performance.printPerformanceMetrics();
// Make sure TTI is captured when the app is really usable
InteractionManager.runAfterInteractions(() => {
requestAnimationFrame(() => {
rnPerformance.measure('TTI', 'nativeLaunchStart', mark.name);
Performance.printPerformanceMetrics();
});
});
}
} catch (error) {
// Sometimes there might be no start mark recorded and the measure will fail with an error
Expand Down

0 comments on commit 672aca3

Please sign in to comment.