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

@@ -4,7 +4,11 @@
* LICENSE file in the root directory of this source tree.
* @format
*/
const {app, BrowserWindow} = require('electron');
const [s, ns] = process.hrtime();
let launchStartTime = s * 1e3 + ns / 1e6;
const {app, BrowserWindow, ipcMain} = require('electron');
const path = require('path');
const url = require('url');
const fs = require('fs');
@@ -128,6 +132,16 @@ app.on('ready', function() {
installExtension(REDUX_DEVTOOLS.id);
}
});
ipcMain.on('getLaunchTime', event => {
if (launchStartTime) {
event.sender.send('getLaunchTime', launchStartTime);
// set launchTime to null to only report it once, to prevents reporting wrong
// launch times for example after reloading the renderer process
launchStartTime = null;
}
});
function tryCreateWindow() {
if (appReady && pluginsCompiled) {
win = new BrowserWindow({