startup time tracking

Summary: Adds tracking from opening the application to the interface being shown.

Reviewed By: passy

Differential Revision: D9239037

fbshipit-source-id: eba60a9e839f9cc2b7a3c8706c6b9d63acb854b4
This commit is contained in:
Daniel Büchele
2018-08-10 09:00:20 -07:00
committed by Facebook Github Bot
parent 2b98f05d03
commit a9b8c3d2c9
2 changed files with 30 additions and 9 deletions

View File

@@ -16,6 +16,7 @@ import BugReporterDialog from './chrome/BugReporterDialog.js';
import ErrorBar from './chrome/ErrorBar.js';
import PluginContainer from './PluginContainer.js';
import PluginManager from './chrome/PluginManager.js';
import {ipcRenderer} from 'electron';
import type Logger from './fb-stubs/Logger.js';
import type BugReporter from './fb-stubs/BugReporter.js';
@@ -33,13 +34,18 @@ type Props = {
};
export class App extends React.Component<Props> {
constructor(props: Props) {
performance.mark('init');
super(props);
}
componentDidMount() {
this.props.logger.trackTimeSince('init');
// track time since launch
const [s, ns] = process.hrtime();
const launchEndTime = s * 1e3 + ns / 1e6;
ipcRenderer.on('getLaunchTime', (event, launchStartTime) => {
this.props.logger.track(
'performance',
'launchTime',
launchEndTime - launchStartTime,
);
});
ipcRenderer.send('getLaunchTime');
}
render() {
@@ -65,7 +71,6 @@ export class App extends React.Component<Props> {
);
}
}
export default connect(
({
application: {pluginManagerVisible, bugDialogVisible, leftSidebarVisible},
@@ -77,5 +82,7 @@ export default connect(
selectedDevice,
error,
}),
{toggleBugDialogVisible},
{
toggleBugDialogVisible,
},
)(App);