Skip to content

Commit

Permalink
prefix our performance marks with code/, e.g `code/didStartRenderer…
Browse files Browse the repository at this point in the history
…` etc
  • Loading branch information
jrieken committed Dec 14, 2020
1 parent 7381f53 commit c87c95a
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 77 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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()]);
Expand Down
8 changes: 4 additions & 4 deletions src/vs/base/node/languagePacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/vs/code/browser/workbench/workbench-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<script>
performance.mark('renderer/started')
performance.mark('code/didStartRenderer')
</script>
<meta charset="utf-8" />

Expand Down Expand Up @@ -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() {});
Expand Down
4 changes: 2 additions & 2 deletions src/vs/code/browser/workbench/workbench.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<script>
performance.mark('renderer/started')
performance.mark('code/didStartRenderer')
</script>
<meta charset="utf-8" />

Expand Down Expand Up @@ -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>
Expand Down
10 changes: 5 additions & 5 deletions src/vs/code/electron-browser/workbench/workbench.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -40,7 +40,7 @@
loaderConfig.recordStats = true;
},
beforeRequire: function () {
performance.mark('willLoadWorkbenchMain');
performance.mark('code/willLoadWorkbenchMain');
}
}
);
Expand Down Expand Up @@ -70,7 +70,7 @@
* }} configuration
*/
function showPartsSplash(configuration) {
performance.mark('willShowPartsSplash');
performance.mark('code/willShowPartsSplash');

let data;
if (typeof configuration.partsSplashPath === 'string') {
Expand Down Expand Up @@ -160,7 +160,7 @@
document.body.appendChild(splash);
}

performance.mark('didShowPartsSplash');
performance.mark('code/didShowPartsSplash');
}

//#endregion
Expand Down
2 changes: 1 addition & 1 deletion src/vs/code/electron-main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/vs/code/electron-sandbox/workbench/workbench.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -40,7 +40,7 @@
loaderConfig.recordStats = true;
},
beforeRequire: function () {
performance.mark('willLoadWorkbenchMain');
performance.mark('code/willLoadWorkbenchMain');
}
}
);
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/storage/node/storageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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}`);
Expand Down
16 changes: 8 additions & 8 deletions src/vs/workbench/browser/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 }[] = [];

Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/browser/web.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();
Expand All @@ -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 };
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/files/browser/views/explorerView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -675,7 +675,7 @@ export class ExplorerView extends ViewPane {
}
}
if (initialInputSetup) {
perf.mark('didResolveExplorer');
perf.mark('code/didResolveExplorer');
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/electron-browser/desktop.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/electron-sandbox/desktop.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit c87c95a

Please sign in to comment.