prefix our performance marks with code/, e.g code/didStartRenderer etc

This commit is contained in:
Johannes Rieken 2020-12-14 15:49:48 +01:00
parent 7381f53fd1
commit c87c95a1a0
22 changed files with 77 additions and 77 deletions

View file

@ -145,9 +145,9 @@
try {
// Wait for process environment being fully resolved
performance.mark('willWaitForShellEnv');
performance.mark('code/willWaitForShellEnv');
await whenEnvResolved;
performance.mark('didWaitForShellEnv');
performance.mark('code/didWaitForShellEnv');
// Callback only after process environment is resolved
const callbackResult = resultCallback(result, configuration);

View file

@ -7,7 +7,7 @@
'use strict';
const perf = require('./vs/base/common/performance');
perf.mark('main:started');
perf.mark('code/didStartMain');
const lp = require('./vs/base/node/languagePacks');
const path = require('path');
@ -193,14 +193,14 @@ function startup(cachedDataDir, nlsConfig) {
process.env['VSCODE_NODE_CACHED_DATA_DIR'] = cachedDataDir || '';
// Load main in AMD
perf.mark('willLoadMainBundle');
perf.mark('code/willLoadMainBundle');
require('./bootstrap-amd').load('vs/code/electron-main/main', () => {
perf.mark('didLoadMainBundle');
perf.mark('code/didLoadMainBundle');
});
}
async function onReady() {
perf.mark('main:appReady');
perf.mark('code/mainAppReady');
try {
const [cachedDataDir, nlsConfig] = await Promise.all([nodeCachedDataDir.ensureExists(), resolveNlsConfiguration()]);

View file

@ -186,10 +186,10 @@ function factory(nodeRequire, path, fs, perf) {
const initialLocale = locale;
perf.mark('nlsGeneration:start');
perf.mark('code/willGenerateNls');
const defaultResult = function (locale) {
perf.mark('nlsGeneration:end');
perf.mark('code/didGenerateNls');
return Promise.resolve({ locale: locale, availableLanguages: {} });
};
try {
@ -240,7 +240,7 @@ function factory(nodeRequire, path, fs, perf) {
if (fileExists) {
// We don't wait for this. No big harm if we can't touch
touch(coreLocation).catch(() => { });
perf.mark('nlsGeneration:end');
perf.mark('code/didGenerateNls');
return result;
}
return mkdirp(coreLocation).then(() => {
@ -279,7 +279,7 @@ function factory(nodeRequire, path, fs, perf) {
writes.push(writeFile(translationsConfigFile, JSON.stringify(packConfig.translations)));
return Promise.all(writes);
}).then(() => {
perf.mark('nlsGeneration:end');
perf.mark('code/didGenerateNls');
return result;
}).catch(err => {
console.error('Generating translation files failed.', err);

View file

@ -3,7 +3,7 @@
<html>
<head>
<script>
performance.mark('renderer/started')
performance.mark('code/didStartRenderer')
</script>
<meta charset="utf-8" />
@ -55,7 +55,7 @@
</script>
<script src="./static/out/vs/loader.js"></script>
<script>
performance.mark('willLoadWorkbenchMain');
performance.mark('code/willLoadWorkbenchMain');
</script>
<script>
require(['vs/code/browser/workbench/workbench'], function() {});

View file

@ -3,7 +3,7 @@
<html>
<head>
<script>
performance.mark('renderer/started')
performance.mark('code/didStartRenderer')
</script>
<meta charset="utf-8" />
@ -54,7 +54,7 @@
</script>
<script src="./static/out/vs/loader.js"></script>
<script>
performance.mark('willLoadWorkbenchMain');
performance.mark('code/willLoadWorkbenchMain');
</script>
<script src="./static/out/vs/workbench/workbench.web.api.nls.js"></script>
<script src="./static/out/vs/workbench/workbench.web.api.js"></script>

View file

@ -12,7 +12,7 @@
const bootstrapWindow = bootstrapWindowLib();
// Add a perf entry right from the top
performance.mark('renderer/started');
performance.mark('code/didStartRenderer');
// Load workbench main JS, CSS and NLS all in parallel. This is an
// optimization to prevent a waterfall of loading to happen, because
@ -26,7 +26,7 @@
async function (workbench, configuration) {
// Mark start of workbench
performance.mark('didLoadWorkbenchMain');
performance.mark('code/didLoadWorkbenchMain');
// @ts-ignore
return require('vs/workbench/electron-browser/desktop.main').main(configuration);
@ -40,7 +40,7 @@
loaderConfig.recordStats = true;
},
beforeRequire: function () {
performance.mark('willLoadWorkbenchMain');
performance.mark('code/willLoadWorkbenchMain');
}
}
);
@ -70,7 +70,7 @@
* }} configuration
*/
function showPartsSplash(configuration) {
performance.mark('willShowPartsSplash');
performance.mark('code/willShowPartsSplash');
let data;
if (typeof configuration.partsSplashPath === 'string') {
@ -160,7 +160,7 @@
document.body.appendChild(splash);
}
performance.mark('didShowPartsSplash');
performance.mark('code/didShowPartsSplash');
}
//#endregion

View file

@ -729,7 +729,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}
// Load URL
perf.mark('main:loadWindow');
perf.mark('code/willOpenNewWindow');
this._win.loadURL(this.getUrl(configuration));
// Make window visible if it did not open in N seconds because this indicates an error

View file

@ -12,7 +12,7 @@
const bootstrapWindow = bootstrapWindowLib();
// Add a perf entry right from the top
performance.mark('renderer/started');
performance.mark('code/didStartRenderer');
// Load workbench main JS, CSS and NLS all in parallel. This is an
// optimization to prevent a waterfall of loading to happen, because
@ -26,7 +26,7 @@
async function (workbench, configuration) {
// Mark start of workbench
performance.mark('didLoadWorkbenchMain');
performance.mark('code/didLoadWorkbenchMain');
// @ts-ignore
return require('vs/workbench/electron-sandbox/desktop.main').main(configuration);
@ -40,7 +40,7 @@
loaderConfig.recordStats = true;
},
beforeRequire: function () {
performance.mark('willLoadWorkbenchMain');
performance.mark('code/willLoadWorkbenchMain');
}
}
);

View file

@ -83,7 +83,7 @@ export class NativeStorageService extends AbstractStorageService {
const useInMemoryStorage = !!this.environmentService.extensionTestsLocationURI; // no storage during extension tests!
// Create workspace storage and initialize
mark('willInitWorkspaceStorage');
mark('code/willInitWorkspaceStorage');
try {
const workspaceStorage = this.createWorkspaceStorage(
useInMemoryStorage ? SQLiteStorageDatabase.IN_MEMORY_PATH : join(result.path, NativeStorageService.WORKSPACE_STORAGE_NAME),
@ -99,7 +99,7 @@ export class NativeStorageService extends AbstractStorageService {
workspaceStorage.set(IS_NEW_KEY, false);
}
} finally {
mark('didInitWorkspaceStorage');
mark('code/didInitWorkspaceStorage');
}
} catch (error) {
this.logService.error(`[storage] initializeWorkspaceStorage(): Unable to init workspace storage due to ${error}`);

View file

@ -652,7 +652,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
// Restore editors
restorePromises.push((async () => {
mark('willRestoreEditors');
mark('code/willRestoreEditors');
// first ensure the editor part is restored
await this.editorGroupService.whenRestored;
@ -669,13 +669,13 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
await this.editorService.openEditors(editors);
}
mark('didRestoreEditors');
mark('code/didRestoreEditors');
})());
// Restore default views
const restoreDefaultViewsPromise = (async () => {
if (this.state.views.defaults?.length) {
mark('willOpenDefaultViews');
mark('code/willOpenDefaultViews');
let locationsRestored: { id: string; order: number }[] = [];
@ -733,7 +733,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.state.panel.panelToRestore = locationsRestored[ViewContainerLocation.Panel].id;
}
mark('didOpenDefaultViews');
mark('code/didOpenDefaultViews');
}
})();
restorePromises.push(restoreDefaultViewsPromise);
@ -748,14 +748,14 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return;
}
mark('willRestoreViewlet');
mark('code/willRestoreViewlet');
const viewlet = await this.viewletService.openViewlet(this.state.sideBar.viewletToRestore);
if (!viewlet) {
await this.viewletService.openViewlet(this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id); // fallback to default viewlet as needed
}
mark('didRestoreViewlet');
mark('code/didRestoreViewlet');
})());
// Restore Panel
@ -768,14 +768,14 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return;
}
mark('willRestorePanel');
mark('code/willRestorePanel');
const panel = await this.panelService.openPanel(this.state.panel.panelToRestore!);
if (!panel) {
await this.panelService.openPanel(Registry.as<PanelRegistry>(PanelExtensions.Panels).getDefaultPanelId()); // fallback to default panel as needed
}
mark('didRestorePanel');
mark('code/didRestorePanel');
})());
// Restore Zen Mode

View file

@ -84,7 +84,7 @@ class BrowserMain extends Disposable {
const services = await this.initServices();
await domContentLoaded();
mark('willStartWorkbench');
mark('code/willStartWorkbench');
// Create Workbench
const workbench = new Workbench(
@ -242,7 +242,7 @@ class BrowserMain extends Disposable {
serviceCollection.set(IUserDataInitializationService, userDataInitializationService);
if (await userDataInitializationService.requiresInitialization()) {
mark('willInitRequiredUserData');
mark('code/willInitRequiredUserData');
// Initialize required resources - settings & global state
await userDataInitializationService.initializeRequiredResources();
@ -251,7 +251,7 @@ class BrowserMain extends Disposable {
// Reloading complete configuraiton blocks workbench until remote configuration is loaded.
await configurationService.reloadLocalUserConfiguration();
mark('didInitRequiredUserData');
mark('code/didInitRequiredUserData');
}
return { serviceCollection, configurationService, logService, storageService };

View file

@ -412,10 +412,10 @@ export class Workbench extends Layout {
}, 2500);
// Telemetry: startup metrics
mark('didStartWorkbench');
mark('code/didStartWorkbench');
// Perf reporting (devtools)
performance.measure('perf: workbench create & restore', 'didLoadWorkbenchMain', 'didStartWorkbench');
performance.measure('perf: workbench create & restore', 'code/didLoadWorkbenchMain', 'code/didStartWorkbench');
}
}
}

View file

@ -635,7 +635,7 @@ export class ExplorerView extends ViewPane {
const initialInputSetup = !this.tree.getInput();
if (initialInputSetup) {
perf.mark('willResolveExplorer');
perf.mark('code/willResolveExplorer');
}
const roots = this.explorerService.roots;
let input: ExplorerItem | ExplorerItem[] = roots[0];
@ -675,7 +675,7 @@ export class ExplorerView extends ViewPane {
}
}
if (initialInputSetup) {
perf.mark('didResolveExplorer');
perf.mark('code/didResolveExplorer');
}
});

View file

@ -49,7 +49,7 @@ class PartsSplash {
) {
lifecycleService.when(LifecyclePhase.Restored).then(_ => {
this._removePartsSplash();
perf.mark('didRemovePartsSplash');
perf.mark('code/didRemovePartsSplash');
});
Event.debounce(Event.any<any>(
onDidChangeFullscreen,

View file

@ -112,7 +112,7 @@ class DesktopMain extends Disposable {
const services = await this.initServices();
await domContentLoaded();
mark('willStartWorkbench');
mark('code/willStartWorkbench');
// Create Workbench
const workbench = new Workbench(document.body, services.serviceCollection, services.logService);

View file

@ -89,7 +89,7 @@ class DesktopMain extends Disposable {
const services = await this.initServices();
await domContentLoaded();
mark('willStartWorkbench');
mark('code/willStartWorkbench');
// Create Workbench
const workbench = new Workbench(document.body, services.serviceCollection, services.logService);

View file

@ -349,13 +349,13 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
}
async initialize(arg: IWorkspaceInitializationPayload): Promise<void> {
mark('willInitWorkspaceService');
mark('code/willInitWorkspaceService');
const workspace = await this.createWorkspace(arg);
await this.updateWorkspaceAndInitializeConfiguration(workspace);
this.checkAndMarkWorkspaceComplete();
mark('didInitWorkspaceService');
mark('code/didInitWorkspaceService');
}
acquireInstantiationService(instantiationService: IInstantiationService): void {

View file

@ -407,15 +407,15 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
//#endregion
protected async _initialize(): Promise<void> {
perf.mark('willLoadExtensions');
perf.mark('code/willLoadExtensions');
this._startExtensionHosts(true, []);
this.whenInstalledExtensionsRegistered().then(() => perf.mark('didLoadExtensions'));
this.whenInstalledExtensionsRegistered().then(() => perf.mark('code/didLoadExtensions'));
await this._scanAndHandleExtensions();
this._releaseBarrier();
}
private _releaseBarrier(): void {
perf.mark('extensionHostReady');
perf.mark('code/extensionHostReady');
this._installedExtensionsReady.open();
this._onDidRegisterExtensions.fire(undefined);
this._onDidChangeExtensionsStatus.fire(this._registry.getAllExtensionDescriptions().map(e => e.identifier));
@ -644,11 +644,13 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
const messageHandler = (msg: IMessage) => this._handleExtensionPointMessage(msg);
const availableExtensions = this._registry.getAllExtensionDescriptions();
const extensionPoints = ExtensionsRegistry.getExtensionPoints();
perf.mark('code/willHandleExtensionPoints');
for (const extensionPoint of extensionPoints) {
if (affectedExtensionPoints[extensionPoint.name]) {
AbstractExtensionService._handleExtensionPoint(extensionPoint, availableExtensions, messageHandler);
}
}
perf.mark('code/didHandleExtensionPoints');
}
private _handleExtensionPointMessage(msg: IMessage) {
@ -699,9 +701,7 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
});
}
}
perf.mark(`willHandleExtensionPoint/${extensionPoint.name}`);
extensionPoint.acceptUsers(users);
perf.mark(`didHandleExtensionPoint/${extensionPoint.name}`);
}
private _showMessageToUser(severity: Severity, msg: string): void {

View file

@ -49,7 +49,7 @@ export abstract class AbstractLifecycleService extends Disposable implements ILi
this.logService.trace(`lifecycle: phase changed (value: ${value})`);
this._phase = value;
mark(`LifecyclePhase/${LifecyclePhaseToString(value)}`);
mark(`code/LifecyclePhase/${LifecyclePhaseToString(value)}`);
const barrier = this.phaseWhen.get(this._phase);
if (barrier) {

View file

@ -177,7 +177,7 @@ export interface IStartupMetrics {
* The time it took to tell electron to open/restore a renderer (browser window).
*
* * Happens in the main-process
* * Measured with the `main:appReady` and `main:loadWindow` performance marks.
* * Measured with the `main:appReady` and `code/willOpenNewWindow` performance marks.
* * This can be compared between insider and stable builds.
* * It is our code running here and we should monitor this carefully for regressions.
*/
@ -188,7 +188,7 @@ export interface IStartupMetrics {
* of load the main-bundle (`workbench.desktop.main.js`).
*
* * Happens in the main-process *and* the renderer-process
* * Measured with the `main:loadWindow` and `willLoadWorkbenchMain` performance marks.
* * Measured with the `code/willOpenNewWindow` and `willLoadWorkbenchMain` performance marks.
* * This can be compared between insider and stable builds.
* * It is mostly not our code running here and we can only observe what's happening.
*
@ -209,7 +209,7 @@ export interface IStartupMetrics {
* and load the initial set of values.
*
* * Happens in the renderer-process
* * Measured with the `willInitWorkspaceStorage` and `didInitWorkspaceStorage` performance marks.
* * Measured with the `code/willInitWorkspaceStorage` and `code/didInitWorkspaceStorage` performance marks.
*/
readonly ellapsedWorkspaceStorageInit: number;
@ -461,13 +461,13 @@ export abstract class AbstractTimerService implements ITimerService {
private async _computeStartupMetrics(): Promise<IStartupMetrics> {
const initialStartup = this._isInitialStartup();
const startMark = initialStartup ? 'main:started' : 'main:loadWindow';
const startMark = initialStartup ? 'code/didStartMain' : 'code/willOpenNewWindow';
const activeViewlet = this._viewletService.getActiveViewlet();
const activePanel = this._panelService.getActivePanel();
const info: Writeable<IStartupMetrics> = {
version: 2,
ellapsed: this._marks.getDuration(startMark, 'didStartWorkbench'),
ellapsed: this._marks.getDuration(startMark, 'code/didStartWorkbench'),
// reflections
isLatestVersion: Boolean(await this._updateService.isLatestVersion()),
@ -480,24 +480,24 @@ export abstract class AbstractTimerService implements ITimerService {
// timers
timers: {
ellapsedAppReady: initialStartup ? this._marks.getDuration('main:started', 'main:appReady') : undefined,
ellapsedNlsGeneration: initialStartup ? this._marks.getDuration('nlsGeneration:start', 'nlsGeneration:end') : undefined,
ellapsedLoadMainBundle: initialStartup ? this._marks.getDuration('willLoadMainBundle', 'didLoadMainBundle') : undefined,
ellapsedWindowLoad: initialStartup ? this._marks.getDuration('main:appReady', 'main:loadWindow') : undefined,
ellapsedWindowLoadToRequire: this._marks.getDuration('main:loadWindow', 'willLoadWorkbenchMain'),
ellapsedRequire: this._marks.getDuration('willLoadWorkbenchMain', 'didLoadWorkbenchMain'),
ellapsedWaitForShellEnv: this._marks.getDuration('willWaitForShellEnv', 'didWaitForShellEnv'),
ellapsedWorkspaceStorageInit: this._marks.getDuration('willInitWorkspaceStorage', 'didInitWorkspaceStorage'),
ellapsedWorkspaceServiceInit: this._marks.getDuration('willInitWorkspaceService', 'didInitWorkspaceService'),
ellapsedRequiredUserDataInit: this._marks.getDuration('willInitRequiredUserData', 'didInitRequiredUserData'),
ellapsedOtherUserDataInit: this._marks.getDuration('willInitOtherUserData', 'didInitOtherUserData'),
ellapsedExtensions: this._marks.getDuration('willLoadExtensions', 'didLoadExtensions'),
ellapsedEditorRestore: this._marks.getDuration('willRestoreEditors', 'didRestoreEditors'),
ellapsedViewletRestore: this._marks.getDuration('willRestoreViewlet', 'didRestoreViewlet'),
ellapsedPanelRestore: this._marks.getDuration('willRestorePanel', 'didRestorePanel'),
ellapsedWorkbench: this._marks.getDuration('willStartWorkbench', 'didStartWorkbench'),
ellapsedExtensionsReady: this._marks.getDuration(startMark, 'didLoadExtensions'),
ellapsedRenderer: this._marks.getDuration('renderer/started', 'didStartWorkbench')
ellapsedAppReady: initialStartup ? this._marks.getDuration('code/didStartMain', 'code/mainAppReady') : undefined,
ellapsedNlsGeneration: initialStartup ? this._marks.getDuration('code/willGenerateNls', 'code/didGenerateNls') : undefined,
ellapsedLoadMainBundle: initialStartup ? this._marks.getDuration('code/willLoadMainBundle', 'code/didLoadMainBundle') : undefined,
ellapsedWindowLoad: initialStartup ? this._marks.getDuration('code/mainAppReady', 'code/willOpenNewWindow') : undefined,
ellapsedWindowLoadToRequire: this._marks.getDuration('code/willOpenNewWindow', 'code/willLoadWorkbenchMain'),
ellapsedRequire: this._marks.getDuration('code/willLoadWorkbenchMain', 'code/didLoadWorkbenchMain'),
ellapsedWaitForShellEnv: this._marks.getDuration('code/willWaitForShellEnv', 'code/didWaitForShellEnv'),
ellapsedWorkspaceStorageInit: this._marks.getDuration('code/willInitWorkspaceStorage', 'code/didInitWorkspaceStorage'),
ellapsedWorkspaceServiceInit: this._marks.getDuration('code/willInitWorkspaceService', 'code/didInitWorkspaceService'),
ellapsedRequiredUserDataInit: this._marks.getDuration('code/willInitRequiredUserData', 'code/didInitRequiredUserData'),
ellapsedOtherUserDataInit: this._marks.getDuration('code/willInitOtherUserData', 'code/didInitOtherUserData'),
ellapsedExtensions: this._marks.getDuration('code/willLoadExtensions', 'code/didLoadExtensions'),
ellapsedEditorRestore: this._marks.getDuration('code/willRestoreEditors', 'code/didRestoreEditors'),
ellapsedViewletRestore: this._marks.getDuration('code/willRestoreViewlet', 'code/didRestoreViewlet'),
ellapsedPanelRestore: this._marks.getDuration('code/willRestorePanel', 'code/didRestorePanel'),
ellapsedWorkbench: this._marks.getDuration('code/willStartWorkbench', 'code/didStartWorkbench'),
ellapsedExtensionsReady: this._marks.getDuration(startMark, 'code/didLoadExtensions'),
ellapsedRenderer: this._marks.getDuration('code/didStartRenderer', 'code/didStartWorkbench')
},
// system info

View file

@ -234,9 +234,9 @@ class InitializeOtherResourcesContribution implements IWorkbenchContribution {
private async initializeOtherResource(userDataInitializeService: IUserDataInitializationService, instantiationService: IInstantiationService): Promise<void> {
if (await userDataInitializeService.requiresInitialization()) {
mark('willInitOtherUserData');
mark('code/willInitOtherUserData');
await userDataInitializeService.initializeOtherResources(instantiationService);
mark('didInitOtherUserData');
mark('code/didInitOtherUserData');
}
}
}

View file

@ -461,7 +461,7 @@ const workbenchPromise = new Promise<IWorkbench>(resolve => workbenchPromiseReso
function create(domElement: HTMLElement, options: IWorkbenchConstructionOptions): IDisposable {
// Mark start of workbench
mark('didLoadWorkbenchMain');
mark('code/didLoadWorkbenchMain');
// Assert that the workbench is not created more than once. We currently
// do not support this and require a full context switch to clean-up.