Skip to content

Commit 071d80c

Browse files
author
Benjamin Pasero
committed
storage - also log time it takes to init global storage in renderer
1 parent 4584935 commit 071d80c

4 files changed

Lines changed: 32 additions & 9 deletions

File tree

src/vs/platform/storage/node/storageService.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,15 @@ export class StorageService extends Disposable implements IStorageService {
8585
}
8686

8787
private initializeGlobalStorage(): Thenable<void> {
88-
return this.globalStorage.init();
88+
mark('willInitGlobalStorage');
89+
90+
return this.globalStorage.init().then(() => {
91+
mark('didInitGlobalStorage');
92+
}, error => {
93+
mark('didInitGlobalStorage');
94+
95+
return Promise.reject(error);
96+
});
8997
}
9098

9199
private initializeWorkspaceStorage(payload: IWorkspaceInitializationPayload): Thenable<void> {

src/vs/workbench/electron-browser/shell.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ export class WorkbenchShell extends Disposable {
277277
const workbenchReadyDuration = perf.getDuration(initialStartup ? 'main:started' : 'main:loadWindow', 'didStartWorkbench');
278278
const workspaceStorageRequireDuration = perf.getDuration('willRequireSQLite', 'didRequireSQLite');
279279
const workspaceStorageSchemaDuration = perf.getDuration('willSetupSQLiteSchema', 'didSetupSQLiteSchema');
280-
const globalStorageInitDuration = perf.getDuration('main:willInitGlobalStorage', 'main:didInitGlobalStorage');
280+
const globalStorageInitDurationMain = perf.getDuration('main:willInitGlobalStorage', 'main:didInitGlobalStorage');
281+
const globalStorageInitDuratioRenderer = perf.getDuration('willInitGlobalStorage', 'didInitGlobalStorage');
281282
const workspaceStorageInitDuration = perf.getDuration('willInitWorkspaceStorage', 'didInitWorkspaceStorage');
282283
const workspaceStorageFileExistsDuration = perf.getDuration('willCheckWorkspaceStorageExists', 'didCheckWorkspaceStorageExists');
283284
const workspaceStorageMigrationDuration = perf.getDuration('willMigrateWorkspaceStorageKeys', 'didMigrateWorkspaceStorageKeys');
@@ -300,7 +301,8 @@ export class WorkbenchShell extends Disposable {
300301
"workspaceMigrationTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
301302
"workspaceRequireTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
302303
"workspaceSchemaTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
303-
"globalReadTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
304+
"globalReadTimeMain" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
305+
"globalReadTimeRenderer" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
304306
"workspaceReadTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
305307
"localStorageTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
306308
"workbenchRequireTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
@@ -316,7 +318,8 @@ export class WorkbenchShell extends Disposable {
316318
'workspaceMigrationTime': workspaceStorageMigrationDuration,
317319
'workspaceRequireTime': workspaceStorageRequireDuration,
318320
'workspaceSchemaTime': workspaceStorageSchemaDuration,
319-
'globalReadTime': globalStorageInitDuration,
321+
'globalReadTimeMain': globalStorageInitDurationMain,
322+
'globalReadTimeRenderer': globalStorageInitDuratioRenderer,
320323
'workspaceReadTime': workspaceStorageInitDuration,
321324
'localStorageTime': localStorageDuration,
322325
'workbenchRequireTime': workbenchLoadDuration,
@@ -344,7 +347,8 @@ export class WorkbenchShell extends Disposable {
344347
"workspaceMigrationTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
345348
"workspaceRequireTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
346349
"workspaceSchemaTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
347-
"globalReadTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
350+
"globalReadTimeMain" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
351+
"globalReadTimeRenderer" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
348352
"workspaceReadTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
349353
"localStorageTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
350354
"workbenchRequireTime" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
@@ -359,7 +363,8 @@ export class WorkbenchShell extends Disposable {
359363
'workspaceMigrationTime': workspaceStorageMigrationDuration,
360364
'workspaceRequireTime': workspaceStorageRequireDuration,
361365
'workspaceSchemaTime': workspaceStorageSchemaDuration,
362-
'globalReadTime': globalStorageInitDuration,
366+
'globalReadTimeMain': globalStorageInitDurationMain,
367+
'globalReadTimeRenderer': globalStorageInitDuratioRenderer,
363368
'workspaceReadTime': workspaceStorageInitDuration,
364369
'localStorageTime': localStorageDuration,
365370
'workbenchRequireTime': workbenchLoadDuration,

src/vs/workbench/parts/performance/electron-browser/actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ class Info {
3030
table['nls:start => nls:end'] = new Info(metrics.timers.ellapsedNlsGeneration, '[main]', `initial startup: ${metrics.initialStartup}`);
3131
table['app.isReady => window.loadUrl()'] = new Info(metrics.timers.ellapsedWindowLoad, '[main]', `initial startup: ${metrics.initialStartup}`);
3232

33-
table['init global storage'] = new Info(metrics.timers.ellapsedGlobalStorageInit, '[main]', `initial startup: ${metrics.initialStartup}`);
33+
table['require & init global storage'] = new Info(metrics.timers.ellapsedGlobalStorageInitMain, '[main]', `initial startup: ${metrics.initialStartup}`);
3434

3535
table['window.loadUrl() => begin to require(workbench.main.js)'] = new Info(metrics.timers.ellapsedWindowLoadToRequire, '[main->renderer]', StartupKindToString(metrics.windowKind));
3636
table['require(workbench.main.js)'] = new Info(metrics.timers.ellapsedRequire, '[renderer]', `cached data: ${(metrics.didUseCachedData ? 'YES' : 'NO')}${nodeModuleLoadTime ? `, node_modules took ${nodeModuleLoadTime}ms` : ''}`);
3737

38+
table['init global storage'] = new Info(metrics.timers.ellapsedGlobalStorageInitRenderer, '[renderer]');
3839
table['require workspace storage'] = new Info(metrics.timers.ellapsedWorkspaceStorageRequire, '[renderer]');
3940
table['require & init workspace storage'] = new Info(metrics.timers.ellapsedWorkspaceStorageInit, '[renderer]');
4041

src/vs/workbench/services/timer/electron-browser/timerService.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,15 @@ export interface IStartupMetrics {
202202
* * Happens in the main-process
203203
* * Measured with the `main:willInitGlobalStorage` and `main:didInitGlobalStorage` performance marks.
204204
*/
205-
ellapsedGlobalStorageInit: number;
205+
ellapsedGlobalStorageInitMain: number;
206+
207+
/**
208+
* The time it took to load the initial set of values from the global storage.
209+
*
210+
* * Happens in the renderer-process
211+
* * Measured with the `willInitGlobalStorage` and `didInitGlobalStorage` performance marks.
212+
*/
213+
ellapsedGlobalStorageInitRenderer: number;
206214

207215
/**
208216
* The time it took to require the workspace storage DB.
@@ -398,7 +406,8 @@ class TimerService implements ITimerService {
398406
ellapsedWindowLoad: initialStartup ? perf.getDuration('main:appReady', 'main:loadWindow') : undefined,
399407
ellapsedWindowLoadToRequire: perf.getDuration('main:loadWindow', 'willLoadWorkbenchMain'),
400408
ellapsedRequire: perf.getDuration('willLoadWorkbenchMain', 'didLoadWorkbenchMain'),
401-
ellapsedGlobalStorageInit: perf.getDuration('main:willInitGlobalStorage', 'main:didInitGlobalStorage'),
409+
ellapsedGlobalStorageInitMain: perf.getDuration('main:willInitGlobalStorage', 'main:didInitGlobalStorage'),
410+
ellapsedGlobalStorageInitRenderer: perf.getDuration('willInitGlobalStorage', 'didInitGlobalStorage'),
402411
ellapsedWorkspaceStorageRequire: perf.getDuration('willRequireSQLite', 'didRequireSQLite'),
403412
ellapsedWorkspaceStorageInit: perf.getDuration('willInitWorkspaceStorage', 'didInitWorkspaceStorage'),
404413
ellapsedExtensions: perf.getDuration('willLoadExtensions', 'didLoadExtensions'),

0 commit comments

Comments
 (0)