diff --git a/src/vs/workbench/contrib/performance/browser/performance.contribution.ts b/src/vs/workbench/contrib/performance/browser/performance.contribution.ts new file mode 100644 index 00000000000..86fb86ecade --- /dev/null +++ b/src/vs/workbench/contrib/performance/browser/performance.contribution.ts @@ -0,0 +1,55 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { localize } from 'vs/nls'; +import { registerAction2, Action2 } from 'vs/platform/actions/common/actions'; +import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; +import { Extensions as Input, IEditorInputFactory, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor'; +import { PerfviewContrib, PerfviewInput } from 'vs/workbench/contrib/performance/browser/perfviewEditor'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; + +// -- startup performance view + +Registry.as(Extensions.Workbench).registerWorkbenchContribution( + PerfviewContrib, + LifecyclePhase.Ready +); + +Registry.as(Input.EditorInputFactories).registerEditorInputFactory( + PerfviewInput.Id, + class implements IEditorInputFactory { + canSerialize(): boolean { + return true; + } + serialize(): string { + return ''; + } + deserialize(instantiationService: IInstantiationService): PerfviewInput { + return instantiationService.createInstance(PerfviewInput); + } + } +); + + +registerAction2(class extends Action2 { + + constructor() { + super({ + id: 'perfview.show', + title: localize('show.label', "Startup Performance"), + category: localize({ key: 'show.cat', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"), + f1: true + }); + } + + run(accessor: ServicesAccessor) { + const editorService = accessor.get(IEditorService); + const instaService = accessor.get(IInstantiationService); + return editorService.openEditor(instaService.createInstance(PerfviewInput)); + } +}); diff --git a/src/vs/workbench/contrib/performance/electron-browser/perfviewEditor.ts b/src/vs/workbench/contrib/performance/browser/perfviewEditor.ts similarity index 99% rename from src/vs/workbench/contrib/performance/electron-browser/perfviewEditor.ts rename to src/vs/workbench/contrib/performance/browser/perfviewEditor.ts index c90935ed728..011b2bd13ab 100644 --- a/src/vs/workbench/contrib/performance/electron-browser/perfviewEditor.ts +++ b/src/vs/workbench/contrib/performance/browser/perfviewEditor.ts @@ -421,6 +421,5 @@ class MarkdownBuilder { }); this.value += '|\n'; }); - } } diff --git a/src/vs/workbench/contrib/performance/electron-browser/performance.contribution.ts b/src/vs/workbench/contrib/performance/electron-browser/performance.contribution.ts index 1e2e837e13d..5a2a4182404 100644 --- a/src/vs/workbench/contrib/performance/electron-browser/performance.contribution.ts +++ b/src/vs/workbench/contrib/performance/electron-browser/performance.contribution.ts @@ -3,54 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { localize } from 'vs/nls'; -import { MenuRegistry } from 'vs/platform/actions/common/actions'; -import { CommandsRegistry } from 'vs/platform/commands/common/commands'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { Registry } from 'vs/platform/registry/common/platform'; import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; -import { Extensions as Input, IEditorInputFactory, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor'; -import { PerfviewContrib, PerfviewInput } from 'vs/workbench/contrib/performance/electron-browser/perfviewEditor'; -import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { StartupProfiler } from './startupProfiler'; import { StartupTimings } from './startupTimings'; -// -- startup performance view - -Registry.as(Extensions.Workbench).registerWorkbenchContribution( - PerfviewContrib, - LifecyclePhase.Ready -); - -Registry.as(Input.EditorInputFactories).registerEditorInputFactory( - PerfviewInput.Id, - class implements IEditorInputFactory { - canSerialize(): boolean { - return true; - } - serialize(): string { - return ''; - } - deserialize(instantiationService: IInstantiationService): PerfviewInput { - return instantiationService.createInstance(PerfviewInput); - } - } -); - -CommandsRegistry.registerCommand('perfview.show', accessor => { - const editorService = accessor.get(IEditorService); - const instaService = accessor.get(IInstantiationService); - return editorService.openEditor(instaService.createInstance(PerfviewInput)); -}); - -MenuRegistry.addCommand({ - id: 'perfview.show', - category: localize({ key: 'show.cat', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"), - title: localize('show.label', "Startup Performance") -}); - - // -- startup profiler Registry.as(Extensions.Workbench).registerWorkbenchContribution( diff --git a/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts b/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts index 3198b95164e..9bc3cc13ee0 100644 --- a/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts +++ b/src/vs/workbench/contrib/performance/electron-browser/startupProfiler.ts @@ -12,7 +12,7 @@ import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/enviro import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; -import { PerfviewInput } from 'vs/workbench/contrib/performance/electron-browser/perfviewEditor'; +import { PerfviewInput } from 'vs/workbench/contrib/performance/browser/perfviewEditor'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { URI } from 'vs/base/common/uri'; diff --git a/src/vs/workbench/services/timer/browser/timerService.ts b/src/vs/workbench/services/timer/browser/timerService.ts index e0aa0c68f70..0bd5426b404 100644 --- a/src/vs/workbench/services/timer/browser/timerService.ts +++ b/src/vs/workbench/services/timer/browser/timerService.ts @@ -399,5 +399,9 @@ export class TimerService extends AbstractTimerService { protected async _getWindowCount(): Promise { return 1; } - protected async _extendStartupInfo(_info: Writeable): Promise { } + protected async _extendStartupInfo(info: Writeable): Promise { + info.isVMLikelyhood = 0; + info.platform = navigator.userAgent; + info.release = navigator.appVersion; + } } diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts index 6ba5cea20fe..6d6d66e1381 100644 --- a/src/vs/workbench/workbench.common.main.ts +++ b/src/vs/workbench/workbench.common.main.ts @@ -144,6 +144,9 @@ import 'vs/workbench/contrib/preferences/browser/preferences.contribution'; import 'vs/workbench/contrib/preferences/browser/keybindingsEditorContribution'; import 'vs/workbench/contrib/preferences/browser/preferencesSearch'; +// Performance +import 'vs/workbench/contrib/performance/browser/performance.contribution'; + // Notebook import 'vs/workbench/contrib/notebook/browser/notebook.contribution';