提交 b778e7f5 编写于 作者: J Johannes Rieken

debt - add switch to append the ellased-time to a file and then shutdown

上级 3bf2a074
......@@ -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';
/*---------------------------------------------------------------------------------------------
* 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);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册