@codingame/monaco-vscode-performance-service-override 3.2.3 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-performance-service-override",
3
- "version": "3.2.3",
3
+ "version": "4.1.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,6 +18,6 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@3.2.3"
21
+ "vscode": "npm:@codingame/monaco-vscode-api@4.1.0"
22
22
  }
23
23
  }
package/performance.js CHANGED
@@ -1,5 +1,5 @@
1
- import './vscode/src/vs/workbench/contrib/performance/browser/performance.contribution.js';
2
- import './vscode/src/vs/workbench/contrib/performance/browser/performance.web.contribution.js';
1
+ import 'vscode/vscode/vs/workbench/contrib/performance/browser/performance.contribution';
2
+ import 'vscode/vscode/vs/workbench/contrib/performance/browser/performance.web.contribution';
3
3
 
4
4
  function getServiceOverride() {
5
5
  return {};
@@ -1,11 +0,0 @@
1
- function __decorate(decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- }
7
- function __param(paramIndex, decorator) {
8
- return function (target, key) { decorator(target, key, paramIndex); }
9
- }
10
-
11
- export { __decorate, __param };
@@ -1,102 +0,0 @@
1
- class LoaderStats {
2
- static get() {
3
- const amdLoadScript = ( new Map());
4
- const amdInvokeFactory = ( new Map());
5
- const nodeRequire = ( new Map());
6
- const nodeEval = ( new Map());
7
- function mark(map, stat) {
8
- if (( map.has(stat.detail))) {
9
- return;
10
- }
11
- map.set(stat.detail, -stat.timestamp);
12
- }
13
- function diff(map, stat) {
14
- const duration = map.get(stat.detail);
15
- if (!duration) {
16
- return;
17
- }
18
- if (duration >= 0) {
19
- return;
20
- }
21
- map.set(stat.detail, duration + stat.timestamp);
22
- }
23
- let stats = [];
24
- if (typeof require === 'function' && typeof require.getStats === 'function') {
25
- stats = require.getStats().slice(0).sort((a, b) => a.timestamp - b.timestamp);
26
- }
27
- for (const stat of stats) {
28
- switch (stat.type) {
29
- case 10 :
30
- mark(amdLoadScript, stat);
31
- break;
32
- case 11 :
33
- case 12 :
34
- diff(amdLoadScript, stat);
35
- break;
36
- case 21 :
37
- mark(amdInvokeFactory, stat);
38
- break;
39
- case 22 :
40
- diff(amdInvokeFactory, stat);
41
- break;
42
- case 33 :
43
- mark(nodeRequire, stat);
44
- break;
45
- case 34 :
46
- diff(nodeRequire, stat);
47
- break;
48
- case 31 :
49
- mark(nodeEval, stat);
50
- break;
51
- case 32 :
52
- diff(nodeEval, stat);
53
- break;
54
- }
55
- }
56
- let nodeRequireTotal = 0;
57
- nodeRequire.forEach(value => nodeRequireTotal += value);
58
- function to2dArray(map) {
59
- const res = [];
60
- map.forEach((value, index) => res.push([index, value]));
61
- return res;
62
- }
63
- return {
64
- amdLoad: to2dArray(amdLoadScript),
65
- amdInvoke: to2dArray(amdInvokeFactory),
66
- nodeRequire: to2dArray(nodeRequire),
67
- nodeEval: to2dArray(nodeEval),
68
- nodeRequireTotal
69
- };
70
- }
71
- static toMarkdownTable(header, rows) {
72
- let result = '';
73
- const lengths = [];
74
- header.forEach((cell, ci) => {
75
- lengths[ci] = cell.length;
76
- });
77
- rows.forEach(row => {
78
- row.forEach((cell, ci) => {
79
- if (typeof cell === 'undefined') {
80
- cell = row[ci] = '-';
81
- }
82
- const len = ( cell.toString()).length;
83
- lengths[ci] = Math.max(len, lengths[ci]);
84
- });
85
- });
86
- header.forEach((cell, ci) => { result += `| ${cell + ' '.repeat(lengths[ci] - ( cell.toString()).length)} `; });
87
- result += '|\n';
88
- header.forEach((_cell, ci) => { result += `| ${'-'.repeat(lengths[ci])} `; });
89
- result += '|\n';
90
- rows.forEach(row => {
91
- row.forEach((cell, ci) => {
92
- if (typeof cell !== 'undefined') {
93
- result += `| ${cell + ' '.repeat(lengths[ci] - ( cell.toString()).length)} `;
94
- }
95
- });
96
- result += '|\n';
97
- });
98
- return result;
99
- }
100
- }
101
-
102
- export { LoaderStats };
@@ -1,43 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { inputLatency } from 'vscode/vscode/vs/base/browser/performance';
3
- import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
4
- import { Event } from 'vscode/vscode/vs/base/common/event';
5
- import { Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
6
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
7
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
8
-
9
- let InputLatencyContrib = class InputLatencyContrib extends Disposable {
10
- constructor(_editorService, _telemetryService) {
11
- super();
12
- this._editorService = _editorService;
13
- this._telemetryService = _telemetryService;
14
- this._listener = this._register(( new MutableDisposable()));
15
- this._scheduler = this._register(( new RunOnceScheduler(() => {
16
- this._logSamples();
17
- this._setupListener();
18
- }, 60000)));
19
- this._setupListener();
20
- }
21
- _setupListener() {
22
- this._listener.value = Event.once(this._editorService.onDidActiveEditorChange)(() => this._scheduler.schedule());
23
- }
24
- _logSamples() {
25
- const measurements = inputLatency.getAndClearMeasurements();
26
- if (!measurements) {
27
- return;
28
- }
29
- this._telemetryService.publicLog2('performance.inputLatency', {
30
- keydown: measurements.keydown,
31
- input: measurements.input,
32
- render: measurements.render,
33
- total: measurements.total,
34
- sampleCount: measurements.sampleCount
35
- });
36
- }
37
- };
38
- InputLatencyContrib = ( __decorate([
39
- ( __param(0, IEditorService)),
40
- ( __param(1, ITelemetryService))
41
- ], InputLatencyContrib));
42
-
43
- export { InputLatencyContrib };
@@ -1,117 +0,0 @@
1
- import { localize2WithPath } from 'vscode/vscode/vs/nls';
2
- import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
3
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
4
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
5
- import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
6
- import { registerWorkbenchContribution2, Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
7
- import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
8
- import { PerfviewContrib, PerfviewInput } from './perfviewEditor.js';
9
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
10
- import { InstantiationService, Trace } from 'vscode/vscode/vs/platform/instantiation/common/instantiationService';
11
- import { EventProfiling } from 'vscode/vscode/vs/base/common/event';
12
- import { InputLatencyContrib } from './inputLatencyContrib.js';
13
-
14
- registerWorkbenchContribution2(PerfviewContrib.ID, PerfviewContrib, { lazy: true });
15
- ( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(PerfviewInput.Id, class {
16
- canSerialize() {
17
- return true;
18
- }
19
- serialize() {
20
- return '';
21
- }
22
- deserialize(instantiationService) {
23
- return instantiationService.createInstance(PerfviewInput);
24
- }
25
- });
26
- registerAction2(class extends Action2 {
27
- constructor() {
28
- super({
29
- id: 'perfview.show',
30
- title: ( localize2WithPath(
31
- 'vs/workbench/contrib/performance/browser/performance.contribution',
32
- 'show.label',
33
- 'Startup Performance'
34
- )),
35
- category: Categories.Developer,
36
- f1: true
37
- });
38
- }
39
- run(accessor) {
40
- const editorService = accessor.get(IEditorService);
41
- const contrib = PerfviewContrib.get();
42
- return editorService.openEditor(contrib.getEditorInput(), { pinned: true });
43
- }
44
- });
45
- registerAction2(class PrintServiceCycles extends Action2 {
46
- constructor() {
47
- super({
48
- id: 'perf.insta.printAsyncCycles',
49
- title: ( localize2WithPath(
50
- 'vs/workbench/contrib/performance/browser/performance.contribution',
51
- 'cycles',
52
- 'Print Service Cycles'
53
- )),
54
- category: Categories.Developer,
55
- f1: true
56
- });
57
- }
58
- run(accessor) {
59
- const instaService = accessor.get(IInstantiationService);
60
- if (instaService instanceof InstantiationService) {
61
- const cycle = instaService._globalGraph?.findCycleSlow();
62
- if (cycle) {
63
- console.warn(`CYCLE`, cycle);
64
- }
65
- else {
66
- console.warn(`YEAH, no more cycles`);
67
- }
68
- }
69
- }
70
- });
71
- registerAction2(class PrintServiceTraces extends Action2 {
72
- constructor() {
73
- super({
74
- id: 'perf.insta.printTraces',
75
- title: ( localize2WithPath(
76
- 'vs/workbench/contrib/performance/browser/performance.contribution',
77
- 'insta.trace',
78
- 'Print Service Traces'
79
- )),
80
- category: Categories.Developer,
81
- f1: true
82
- });
83
- }
84
- run() {
85
- if (Trace.all.size === 0) {
86
- console.log('Enable via `instantiationService.ts#_enableAllTracing`');
87
- return;
88
- }
89
- for (const item of Trace.all) {
90
- console.log(item);
91
- }
92
- }
93
- });
94
- registerAction2(class PrintEventProfiling extends Action2 {
95
- constructor() {
96
- super({
97
- id: 'perf.event.profiling',
98
- title: ( localize2WithPath(
99
- 'vs/workbench/contrib/performance/browser/performance.contribution',
100
- 'emitter',
101
- 'Print Emitter Profiles'
102
- )),
103
- category: Categories.Developer,
104
- f1: true
105
- });
106
- }
107
- run() {
108
- if (EventProfiling.all.size === 0) {
109
- console.log('USE `EmitterOptions._profName` to enable profiling');
110
- return;
111
- }
112
- for (const item of EventProfiling.all) {
113
- console.log(`${item.name}: ${item.invocationCount} invocations COST ${item.elapsedOverall}ms, ${item.listenerCount} listeners, avg cost is ${item.durations.reduce((a, b) => a + b, 0) / item.durations.length}ms`);
114
- }
115
- }
116
- });
117
- ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(InputLatencyContrib, 4 );
@@ -1,6 +0,0 @@
1
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
2
- import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
3
- import { BrowserResourcePerformanceMarks, BrowserStartupTimings } from './startupTimings.js';
4
-
5
- ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(BrowserResourcePerformanceMarks, 4 );
6
- ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(BrowserStartupTimings, 4 );
@@ -1,340 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { URI } from 'vscode/vscode/vs/base/common/uri';
4
- import { TextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
5
- import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
6
- import { StartupKindToString, ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
7
- import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
8
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
9
- import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
10
- import { ITimerService } from 'vscode/vscode/vs/workbench/services/timer/browser/timerService';
11
- import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
12
- import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
13
- import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
14
- import { writeTransientState } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/toggleWordWrap';
15
- import { LoaderStats } from '../../../../base/common/amd.js';
16
- import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
17
- import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
18
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
19
- import { ByteSize, IFileService } from 'vscode/vscode/vs/platform/files/common/files';
20
- import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
21
- import { isWeb } from 'vscode/vscode/vs/base/common/platform';
22
- import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
23
- import { ITerminalService } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminal';
24
- import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
25
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
26
- import { getWorkbenchContribution, Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
27
-
28
- var PerfviewContrib_1, PerfviewInput_1;
29
- let PerfviewContrib = class PerfviewContrib {
30
- static { PerfviewContrib_1 = this; }
31
- static get() {
32
- return getWorkbenchContribution(PerfviewContrib_1.ID);
33
- }
34
- static { this.ID = 'workbench.contrib.perfview'; }
35
- constructor(_instaService, textModelResolverService) {
36
- this._instaService = _instaService;
37
- this._inputUri = ( URI.from({ scheme: 'perf', path: 'Startup Performance' }));
38
- this._registration = textModelResolverService.registerTextModelContentProvider('perf', _instaService.createInstance(PerfModelContentProvider));
39
- }
40
- dispose() {
41
- this._registration.dispose();
42
- }
43
- getInputUri() {
44
- return this._inputUri;
45
- }
46
- getEditorInput() {
47
- return this._instaService.createInstance(PerfviewInput);
48
- }
49
- };
50
- PerfviewContrib = PerfviewContrib_1 = ( __decorate([
51
- ( __param(0, IInstantiationService)),
52
- ( __param(1, ITextModelService))
53
- ], PerfviewContrib));
54
- let PerfviewInput = class PerfviewInput extends TextResourceEditorInput {
55
- static { PerfviewInput_1 = this; }
56
- static { this.Id = 'PerfviewInput'; }
57
- get typeId() {
58
- return PerfviewInput_1.Id;
59
- }
60
- constructor(textModelResolverService, textFileService, editorService, fileService, labelService, filesConfigurationService, textResourceConfigurationService) {
61
- super(PerfviewContrib.get().getInputUri(), ( localizeWithPath(
62
- 'vs/workbench/contrib/performance/browser/perfviewEditor',
63
- 'name',
64
- "Startup Performance"
65
- )), undefined, undefined, undefined, textModelResolverService, textFileService, editorService, fileService, labelService, filesConfigurationService, textResourceConfigurationService);
66
- }
67
- };
68
- PerfviewInput = PerfviewInput_1 = ( __decorate([
69
- ( __param(0, ITextModelService)),
70
- ( __param(1, ITextFileService)),
71
- ( __param(2, IEditorService)),
72
- ( __param(3, IFileService)),
73
- ( __param(4, ILabelService)),
74
- ( __param(5, IFilesConfigurationService)),
75
- ( __param(6, ITextResourceConfigurationService))
76
- ], PerfviewInput));
77
- let PerfModelContentProvider = class PerfModelContentProvider {
78
- constructor(_modelService, _languageService, _editorService, _lifecycleService, _timerService, _extensionService, _productService, _terminalService) {
79
- this._modelService = _modelService;
80
- this._languageService = _languageService;
81
- this._editorService = _editorService;
82
- this._lifecycleService = _lifecycleService;
83
- this._timerService = _timerService;
84
- this._extensionService = _extensionService;
85
- this._productService = _productService;
86
- this._terminalService = _terminalService;
87
- this._modelDisposables = [];
88
- }
89
- provideTextContent(resource) {
90
- if (!this._model || this._model.isDisposed()) {
91
- dispose(this._modelDisposables);
92
- const langId = this._languageService.createById('markdown');
93
- this._model = this._modelService.getModel(resource) || this._modelService.createModel('Loading...', langId, resource);
94
- this._modelDisposables.push(langId.onDidChange(e => {
95
- this._model?.setLanguage(e);
96
- }));
97
- this._modelDisposables.push(this._extensionService.onDidChangeExtensionsStatus(this._updateModel, this));
98
- writeTransientState(this._model, { wordWrapOverride: 'off' }, this._editorService);
99
- }
100
- this._updateModel();
101
- return Promise.resolve(this._model);
102
- }
103
- _updateModel() {
104
- Promise.all([
105
- this._timerService.whenReady(),
106
- this._lifecycleService.when(4 ),
107
- this._extensionService.whenInstalledExtensionsRegistered(),
108
- this._terminalService.whenConnected
109
- ]).then(() => {
110
- if (this._model && !this._model.isDisposed()) {
111
- const stats = LoaderStats.get();
112
- const md = ( new MarkdownBuilder());
113
- this._addSummary(md);
114
- md.blank();
115
- this._addSummaryTable(md, stats);
116
- md.blank();
117
- this._addExtensionsTable(md);
118
- md.blank();
119
- this._addPerfMarksTable('Terminal Stats', md, this._timerService.getPerformanceMarks().find(e => e[0] === 'renderer')?.[1].filter(e => e.name.startsWith('code/terminal/')));
120
- md.blank();
121
- this._addWorkbenchContributionsPerfMarksTable(md);
122
- md.blank();
123
- this._addRawPerfMarks(md);
124
- md.blank();
125
- this._addResourceTimingStats(md);
126
- this._model.setValue(md.value);
127
- }
128
- });
129
- }
130
- _addSummary(md) {
131
- const metrics = this._timerService.startupMetrics;
132
- md.heading(2, 'System Info');
133
- md.li(`${this._productService.nameShort}: ${this._productService.version} (${this._productService.commit || '0000000'})`);
134
- md.li(`OS: ${metrics.platform}(${metrics.release})`);
135
- if (metrics.cpus) {
136
- md.li(`CPUs: ${metrics.cpus.model}(${metrics.cpus.count} x ${metrics.cpus.speed})`);
137
- }
138
- if (typeof metrics.totalmem === 'number' && typeof metrics.freemem === 'number') {
139
- md.li(`Memory(System): ${(metrics.totalmem / (ByteSize.GB)).toFixed(2)} GB(${(metrics.freemem / (ByteSize.GB)).toFixed(2)}GB free)`);
140
- }
141
- if (metrics.meminfo) {
142
- md.li(`Memory(Process): ${(metrics.meminfo.workingSetSize / ByteSize.KB).toFixed(2)} MB working set(${(metrics.meminfo.privateBytes / ByteSize.KB).toFixed(2)}MB private, ${(metrics.meminfo.sharedBytes / ByteSize.KB).toFixed(2)}MB shared)`);
143
- }
144
- md.li(`VM(likelihood): ${metrics.isVMLikelyhood}%`);
145
- md.li(`Initial Startup: ${metrics.initialStartup}`);
146
- md.li(`Has ${metrics.windowCount - 1} other windows`);
147
- md.li(`Screen Reader Active: ${metrics.hasAccessibilitySupport}`);
148
- md.li(`Empty Workspace: ${metrics.emptyWorkbench}`);
149
- }
150
- _addSummaryTable(md, stats) {
151
- const metrics = this._timerService.startupMetrics;
152
- const contribTimings = ( Registry.as(Extensions.Workbench)).timings;
153
- const table = [];
154
- table.push(['start => app.isReady', metrics.timers.ellapsedAppReady, '[main]', `initial startup: ${metrics.initialStartup}`]);
155
- table.push(['nls:start => nls:end', metrics.timers.ellapsedNlsGeneration, '[main]', `initial startup: ${metrics.initialStartup}`]);
156
- table.push(['require(main.bundle.js)', metrics.timers.ellapsedLoadMainBundle, '[main]', `initial startup: ${metrics.initialStartup}`]);
157
- table.push(['start crash reporter', metrics.timers.ellapsedCrashReporter, '[main]', `initial startup: ${metrics.initialStartup}`]);
158
- table.push(['serve main IPC handle', metrics.timers.ellapsedMainServer, '[main]', `initial startup: ${metrics.initialStartup}`]);
159
- table.push(['create window', metrics.timers.ellapsedWindowCreate, '[main]', `initial startup: ${metrics.initialStartup}, ${metrics.initialStartup ? `state: ${metrics.timers.ellapsedWindowRestoreState}ms, widget: ${metrics.timers.ellapsedBrowserWindowCreate}ms, show: ${metrics.timers.ellapsedWindowMaximize}ms` : ''}`]);
160
- table.push(['app.isReady => window.loadUrl()', metrics.timers.ellapsedWindowLoad, '[main]', `initial startup: ${metrics.initialStartup}`]);
161
- table.push(['window.loadUrl() => begin to require(workbench.desktop.main.js)', metrics.timers.ellapsedWindowLoadToRequire, '[main->renderer]', StartupKindToString(metrics.windowKind)]);
162
- table.push(['require(workbench.desktop.main.js)', metrics.timers.ellapsedRequire, '[renderer]', `cached data: ${(metrics.didUseCachedData ? 'YES' : 'NO')}${stats ? `, node_modules took ${stats.nodeRequireTotal}ms` : ''}`]);
163
- table.push(['wait for window config', metrics.timers.ellapsedWaitForWindowConfig, '[renderer]', undefined]);
164
- table.push(['init storage (global & workspace)', metrics.timers.ellapsedStorageInit, '[renderer]', undefined]);
165
- table.push(['init workspace service', metrics.timers.ellapsedWorkspaceServiceInit, '[renderer]', undefined]);
166
- if (isWeb) {
167
- table.push(['init settings and global state from settings sync service', metrics.timers.ellapsedRequiredUserDataInit, '[renderer]', undefined]);
168
- table.push(['init keybindings, snippets & extensions from settings sync service', metrics.timers.ellapsedOtherUserDataInit, '[renderer]', undefined]);
169
- }
170
- table.push(['register extensions & spawn extension host', metrics.timers.ellapsedExtensions, '[renderer]', undefined]);
171
- table.push(['restore viewlet', metrics.timers.ellapsedViewletRestore, '[renderer]', metrics.viewletId]);
172
- table.push(['restore panel', metrics.timers.ellapsedPanelRestore, '[renderer]', metrics.panelId]);
173
- table.push(['restore & resolve visible editors', metrics.timers.ellapsedEditorRestore, '[renderer]', `${metrics.editorIds.length}: ${metrics.editorIds.join(', ')}`]);
174
- table.push(['create workbench contributions', metrics.timers.ellapsedWorkbenchContributions, '[renderer]', `${(contribTimings.get(1 )?.length ?? 0) + (contribTimings.get(1 )?.length ?? 0)} blocking startup`]);
175
- table.push(['overall workbench load', metrics.timers.ellapsedWorkbench, '[renderer]', undefined]);
176
- table.push(['workbench ready', metrics.ellapsed, '[main->renderer]', undefined]);
177
- table.push(['renderer ready', metrics.timers.ellapsedRenderer, '[renderer]', undefined]);
178
- table.push(['shared process connection ready', metrics.timers.ellapsedSharedProcesConnected, '[renderer->sharedprocess]', undefined]);
179
- table.push(['extensions registered', metrics.timers.ellapsedExtensionsReady, '[renderer]', undefined]);
180
- md.heading(2, 'Performance Marks');
181
- md.table(['What', 'Duration', 'Process', 'Info'], table);
182
- }
183
- _addExtensionsTable(md) {
184
- const eager = [];
185
- const normal = [];
186
- const extensionsStatus = this._extensionService.getExtensionsStatus();
187
- for (const id in extensionsStatus) {
188
- const { activationTimes: times } = extensionsStatus[id];
189
- if (!times) {
190
- continue;
191
- }
192
- if (times.activationReason.startup) {
193
- eager.push([id, times.activationReason.startup, times.codeLoadingTime, times.activateCallTime, times.activateResolvedTime, times.activationReason.activationEvent, times.activationReason.extensionId.value]);
194
- }
195
- else {
196
- normal.push([id, times.activationReason.startup, times.codeLoadingTime, times.activateCallTime, times.activateResolvedTime, times.activationReason.activationEvent, times.activationReason.extensionId.value]);
197
- }
198
- }
199
- const table = eager.concat(normal);
200
- if (table.length > 0) {
201
- md.heading(2, 'Extension Activation Stats');
202
- md.table(['Extension', 'Eager', 'Load Code', 'Call Activate', 'Finish Activate', 'Event', 'By'], table);
203
- }
204
- }
205
- _addPerfMarksTable(name, md, marks) {
206
- if (!marks) {
207
- return;
208
- }
209
- const table = [];
210
- let lastStartTime = -1;
211
- let total = 0;
212
- for (const { name, startTime } of marks) {
213
- const delta = lastStartTime !== -1 ? startTime - lastStartTime : 0;
214
- total += delta;
215
- table.push([name, Math.round(startTime), Math.round(delta), Math.round(total)]);
216
- lastStartTime = startTime;
217
- }
218
- if (name) {
219
- md.heading(2, name);
220
- }
221
- md.table(['Name', 'Timestamp', 'Delta', 'Total'], table);
222
- }
223
- _addWorkbenchContributionsPerfMarksTable(md) {
224
- md.heading(2, 'Workbench Contributions Blocking Restore');
225
- const timings = ( Registry.as(Extensions.Workbench)).timings;
226
- md.li(`Total (LifecyclePhase.Starting): ${timings.get(1 )?.length} (${timings.get(1 )?.reduce((p, c) => p + c[1], 0)}ms)`);
227
- md.li(`Total (LifecyclePhase.Ready): ${timings.get(2 )?.length} (${timings.get(2 )?.reduce((p, c) => p + c[1], 0)}ms)`);
228
- md.blank();
229
- const marks = this._timerService.getPerformanceMarks().find(e => e[0] === 'renderer')?.[1].filter(e => e.name.startsWith('code/willCreateWorkbenchContribution/1') ||
230
- e.name.startsWith('code/didCreateWorkbenchContribution/1') ||
231
- e.name.startsWith('code/willCreateWorkbenchContribution/2') ||
232
- e.name.startsWith('code/didCreateWorkbenchContribution/2'));
233
- this._addPerfMarksTable(undefined, md, marks);
234
- }
235
- _addRawPerfMarks(md) {
236
- for (const [source, marks] of this._timerService.getPerformanceMarks()) {
237
- md.heading(2, `Raw Perf Marks: ${source}`);
238
- md.value += '```\n';
239
- md.value += `Name\tTimestamp\tDelta\tTotal\n`;
240
- let lastStartTime = -1;
241
- let total = 0;
242
- for (const { name, startTime } of marks) {
243
- const delta = lastStartTime !== -1 ? startTime - lastStartTime : 0;
244
- total += delta;
245
- md.value += `${name}\t${startTime}\t${delta}\t${total}\n`;
246
- lastStartTime = startTime;
247
- }
248
- md.value += '```\n';
249
- }
250
- }
251
- _addLoaderStats(md, stats) {
252
- md.heading(2, 'Loader Stats');
253
- md.heading(3, 'Load AMD-module');
254
- md.table(['Module', 'Duration'], stats.amdLoad);
255
- md.blank();
256
- md.heading(3, 'Load commonjs-module');
257
- md.table(['Module', 'Duration'], stats.nodeRequire);
258
- md.blank();
259
- md.heading(3, 'Invoke AMD-module factory');
260
- md.table(['Module', 'Duration'], stats.amdInvoke);
261
- md.blank();
262
- md.heading(3, 'Invoke commonjs-module');
263
- md.table(['Module', 'Duration'], stats.nodeEval);
264
- }
265
- _addCachedDataStats(md) {
266
- const map = ( new Map());
267
- map.set(63 , []);
268
- map.set(60 , []);
269
- map.set(61 , []);
270
- map.set(62 , []);
271
- if (typeof require.getStats === 'function') {
272
- for (const stat of require.getStats()) {
273
- if (( map.has(stat.type))) {
274
- map.get(stat.type).push(stat.detail);
275
- }
276
- }
277
- }
278
- const printLists = (arr) => {
279
- if (arr) {
280
- arr.sort();
281
- for (const e of arr) {
282
- md.li(`${e}`);
283
- }
284
- md.blank();
285
- }
286
- };
287
- md.heading(2, 'Node Cached Data Stats');
288
- md.blank();
289
- md.heading(3, 'cached data used');
290
- printLists(map.get(60 ));
291
- md.heading(3, 'cached data missed');
292
- printLists(map.get(61 ));
293
- md.heading(3, 'cached data rejected');
294
- printLists(map.get(62 ));
295
- md.heading(3, 'cached data created (lazy, might need refreshes)');
296
- printLists(map.get(63 ));
297
- }
298
- _addResourceTimingStats(md) {
299
- const stats = ( performance.getEntriesByType('resource').map(entry => {
300
- return [entry.name, entry.duration];
301
- }));
302
- if (!stats.length) {
303
- return;
304
- }
305
- md.heading(2, 'Resource Timing Stats');
306
- md.table(['Name', 'Duration'], stats);
307
- }
308
- };
309
- PerfModelContentProvider = ( __decorate([
310
- ( __param(0, IModelService)),
311
- ( __param(1, ILanguageService)),
312
- ( __param(2, ICodeEditorService)),
313
- ( __param(3, ILifecycleService)),
314
- ( __param(4, ITimerService)),
315
- ( __param(5, IExtensionService)),
316
- ( __param(6, IProductService)),
317
- ( __param(7, ITerminalService))
318
- ], PerfModelContentProvider));
319
- class MarkdownBuilder {
320
- constructor() {
321
- this.value = '';
322
- }
323
- heading(level, value) {
324
- this.value += `${'#'.repeat(level)} ${value}\n\n`;
325
- return this;
326
- }
327
- blank() {
328
- this.value += '\n';
329
- return this;
330
- }
331
- li(value) {
332
- this.value += `* ${value}\n`;
333
- return this;
334
- }
335
- table(header, rows) {
336
- this.value += LoaderStats.toMarkdownTable(header, rows);
337
- }
338
- }
339
-
340
- export { PerfviewContrib, PerfviewInput };
@@ -1,116 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
3
- import { StartupKindToString, ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
4
- import { IUpdateService } from 'vscode/vscode/vs/platform/update/common/update';
5
- import { VIEWLET_ID } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
6
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
7
- import { IWorkspaceTrustManagementService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust';
8
- import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
9
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
10
- import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
11
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
12
- import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService';
13
- import { ITimerService } from 'vscode/vscode/vs/workbench/services/timer/browser/timerService';
14
- import { posix } from 'vscode/vscode/vs/base/common/path';
15
- import { hash } from 'vscode/vscode/vs/base/common/hash';
16
-
17
- let StartupTimings = class StartupTimings {
18
- constructor(_editorService, _paneCompositeService, _lifecycleService, _updateService, _workspaceTrustService) {
19
- this._editorService = _editorService;
20
- this._paneCompositeService = _paneCompositeService;
21
- this._lifecycleService = _lifecycleService;
22
- this._updateService = _updateService;
23
- this._workspaceTrustService = _workspaceTrustService;
24
- }
25
- async _isStandardStartup() {
26
- if (this._lifecycleService.startupKind !== 1 ) {
27
- return StartupKindToString(this._lifecycleService.startupKind);
28
- }
29
- if (!this._workspaceTrustService.isWorkspaceTrusted()) {
30
- return 'Workspace not trusted';
31
- }
32
- const activeViewlet = this._paneCompositeService.getActivePaneComposite(0 );
33
- if (!activeViewlet || activeViewlet.getId() !== VIEWLET_ID) {
34
- return 'Explorer viewlet not visible';
35
- }
36
- const visibleEditorPanes = this._editorService.visibleEditorPanes;
37
- if (visibleEditorPanes.length !== 1) {
38
- return `Expected text editor count : 1, Actual : ${visibleEditorPanes.length}`;
39
- }
40
- if (!isCodeEditor(visibleEditorPanes[0].getControl())) {
41
- return 'Active editor is not a text editor';
42
- }
43
- const activePanel = this._paneCompositeService.getActivePaneComposite(1 );
44
- if (activePanel) {
45
- return `Current active panel : ${this._paneCompositeService.getPaneComposite(activePanel.getId(), 1 )?.name}`;
46
- }
47
- const isLatestVersion = await this._updateService.isLatestVersion();
48
- if (isLatestVersion === false) {
49
- return 'Not on latest version, updates available';
50
- }
51
- return undefined;
52
- }
53
- };
54
- StartupTimings = ( __decorate([
55
- ( __param(0, IEditorService)),
56
- ( __param(1, IPaneCompositePartService)),
57
- ( __param(2, ILifecycleService)),
58
- ( __param(3, IUpdateService)),
59
- ( __param(4, IWorkspaceTrustManagementService))
60
- ], StartupTimings));
61
- let BrowserStartupTimings = class BrowserStartupTimings extends StartupTimings {
62
- constructor(editorService, paneCompositeService, lifecycleService, updateService, workspaceTrustService, timerService, logService, environmentService, telemetryService, productService) {
63
- super(editorService, paneCompositeService, lifecycleService, updateService, workspaceTrustService);
64
- this.timerService = timerService;
65
- this.logService = logService;
66
- this.environmentService = environmentService;
67
- this.telemetryService = telemetryService;
68
- this.productService = productService;
69
- this.logPerfMarks();
70
- }
71
- async logPerfMarks() {
72
- if (!this.environmentService.profDurationMarkers) {
73
- return;
74
- }
75
- await this.timerService.whenReady();
76
- const standardStartupError = await this._isStandardStartup();
77
- const perfBaseline = await this.timerService.perfBaseline;
78
- const [from, to] = this.environmentService.profDurationMarkers;
79
- const content = `${this.timerService.getDuration(from, to)}\t${this.productService.nameShort}\t${(this.productService.commit || '').slice(0, 10) || '0000000000'}\t${this.telemetryService.sessionId}\t${standardStartupError === undefined ? 'standard_start' : 'NO_standard_start : ' + standardStartupError}\t${String(perfBaseline).padStart(4, '0')}ms\n`;
80
- this.logService.info(`[prof-timers] ${content}`);
81
- }
82
- };
83
- BrowserStartupTimings = ( __decorate([
84
- ( __param(0, IEditorService)),
85
- ( __param(1, IPaneCompositePartService)),
86
- ( __param(2, ILifecycleService)),
87
- ( __param(3, IUpdateService)),
88
- ( __param(4, IWorkspaceTrustManagementService)),
89
- ( __param(5, ITimerService)),
90
- ( __param(6, ILogService)),
91
- ( __param(7, IBrowserWorkbenchEnvironmentService)),
92
- ( __param(8, ITelemetryService)),
93
- ( __param(9, IProductService))
94
- ], BrowserStartupTimings));
95
- let BrowserResourcePerformanceMarks = class BrowserResourcePerformanceMarks {
96
- constructor(telemetryService) {
97
- for (const item of performance.getEntriesByType('resource')) {
98
- try {
99
- const url = ( new URL(item.name));
100
- const name = posix.basename(url.pathname);
101
- telemetryService.publicLog2('startup.resource.perf', {
102
- hosthash: `H${( hash(url.host).toString(16))}`,
103
- name,
104
- duration: item.duration
105
- });
106
- }
107
- catch {
108
- }
109
- }
110
- }
111
- };
112
- BrowserResourcePerformanceMarks = ( __decorate([
113
- ( __param(0, ITelemetryService))
114
- ], BrowserResourcePerformanceMarks));
115
-
116
- export { BrowserResourcePerformanceMarks, BrowserStartupTimings, StartupTimings };