Skip to content

Commit

Permalink
Telemetry: We should log startup times (fixes #707)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Dec 2, 2015
1 parent e2341f6 commit 65d8505
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/electron-main/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* global __filename, __dirname, global, process */

// Perf measurements
global.vscodeStart = new Date().getTime();
global.vscodeStart = Date.now();

var app = require('app');
var path = require('path');
Expand Down
6 changes: 1 addition & 5 deletions src/vs/workbench/electron-main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ function setupIPC(): TPromise<Server> {
return setup(true);
}

function setupMutex() {
}

// On some platforms we need to manually read from the global environment variables
// and assign them to the process environment (e.g. when doubleclick app on Mac)
getUserEnvironment()
Expand All @@ -255,7 +252,6 @@ getUserEnvironment()

return timebomb()
.then(setupIPC)
.then(ipcServer => { setupMutex(); return ipcServer; })
.then(ipcServer => main(ipcServer, userEnv));
})
.done(null, quit);
.done(null, quit);
11 changes: 11 additions & 0 deletions src/vs/workbench/electron-main/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ export class WindowsManager {
app.on('will-quit', () => {
storage.setItem(WindowsManager.windowsStateStorageKey, this.windowsState);
});

let loggedStartupTimes = false;
onReady(window => {
if (loggedStartupTimes) {
return; // only for the first window
}

loggedStartupTimes = true;

window.send('vscode:telemetry', { eventName: 'startupTime', data: { ellapsed: Date.now() - global.vscodeStart } });
});
}

public reload(win: window.VSCodeWindow, cli?: env.ICommandLineArguments): void {
Expand Down

0 comments on commit 65d8505

Please sign in to comment.