mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-28 16:39:00 +01:00
debt - add switch to append the ellased-time to a file and then shutdown
This commit is contained in:
@@ -25,6 +25,7 @@ export interface ParsedArgs {
|
||||
performance?: boolean;
|
||||
'prof-startup'?: string;
|
||||
'prof-startup-prefix'?: string;
|
||||
'prof-append-timers'?: string;
|
||||
verbose?: boolean;
|
||||
log?: string;
|
||||
logExtensionHostCommunication?: boolean;
|
||||
|
||||
@@ -7,4 +7,5 @@
|
||||
|
||||
import './startupProfiler';
|
||||
import './startupTimings';
|
||||
import './startupTimingsAppender';
|
||||
import './stats';
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkbenchContributionsRegistry, IWorkbenchContribution, Extensions } from 'vs/workbench/common/contributions';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { ITimerService } from 'vs/workbench/services/timer/common/timerService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { nfcall } from 'vs/base/common/async';
|
||||
import { appendFile } from 'fs';
|
||||
|
||||
class StartupTimingsAppender implements IWorkbenchContribution {
|
||||
|
||||
constructor(
|
||||
@ITimerService timerService: ITimerService,
|
||||
@IWindowsService windowsService: IWindowsService,
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService,
|
||||
) {
|
||||
|
||||
let appendTo = environmentService.args['prof-append-timers'];
|
||||
if (!appendTo) {
|
||||
return;
|
||||
}
|
||||
|
||||
Promise.all([
|
||||
lifecycleService.when(LifecyclePhase.Eventually),
|
||||
extensionService.whenInstalledExtensionsRegistered()
|
||||
]).then(() => {
|
||||
const { startupMetrics } = timerService;
|
||||
return nfcall(appendFile, appendTo, `${Date.now()}\t${startupMetrics.ellapsed}\n`);
|
||||
}).then(() => {
|
||||
windowsService.quit();
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
windowsService.quit();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const registry = Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench);
|
||||
registry.registerWorkbenchContribution(StartupTimingsAppender, LifecyclePhase.Running);
|
||||
Reference in New Issue
Block a user