chore: add verbose logging for errors in startup perf script (#97651)
This commit is contained in:
parent
16460ceb51
commit
93cd65f1ca
1 changed files with 22 additions and 17 deletions
|
@ -10,7 +10,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
|
|||
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
|
||||
import { ILifecycleService, StartupKind } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { ILifecycleService, StartupKind, StartupKindToString } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IUpdateService } from 'vs/platform/update/common/update';
|
||||
|
@ -41,9 +41,9 @@ export class StartupTimings implements IWorkbenchContribution {
|
|||
}
|
||||
|
||||
private async _report() {
|
||||
const isStandardStartup = await this._isStandardStartup();
|
||||
const standardStartupError = await this._isStandardStartup();
|
||||
this._reportStartupTimes().catch(onUnexpectedError);
|
||||
this._appendStartupTimes(isStandardStartup).catch(onUnexpectedError);
|
||||
this._appendStartupTimes(standardStartupError).catch(onUnexpectedError);
|
||||
this._reportPerfTicks();
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ export class StartupTimings implements IWorkbenchContribution {
|
|||
this._telemetryService.publicLog('startupTimeVaried', metrics);
|
||||
}
|
||||
|
||||
private async _appendStartupTimes(isStandardStartup: boolean) {
|
||||
private async _appendStartupTimes(standardStartupError: string | undefined) {
|
||||
const appendTo = this._envService.args['prof-append-timers'];
|
||||
if (!appendTo) {
|
||||
// nothing to do
|
||||
|
@ -73,7 +73,7 @@ export class StartupTimings implements IWorkbenchContribution {
|
|||
this._timerService.startupMetrics,
|
||||
timeout(15000), // wait: cached data creation, telemetry sending
|
||||
]).then(([startupMetrics]) => {
|
||||
return promisify(appendFile)(appendTo, `${startupMetrics.ellapsed}\t${product.nameShort}\t${(product.commit || '').slice(0, 10) || '0000000000'}\t${sessionId}\t${isStandardStartup ? 'standard_start' : 'NO_standard_start'}\n`);
|
||||
return promisify(appendFile)(appendTo, `${startupMetrics.ellapsed}\t${product.nameShort}\t${(product.commit || '').slice(0, 10) || '0000000000'}\t${sessionId}\t${standardStartupError === undefined ? 'standard_start' : 'NO_standard_start : ' + standardStartupError}\n`);
|
||||
}).then(() => {
|
||||
this._electronService.quit();
|
||||
}).catch(err => {
|
||||
|
@ -82,7 +82,7 @@ export class StartupTimings implements IWorkbenchContribution {
|
|||
});
|
||||
}
|
||||
|
||||
private async _isStandardStartup(): Promise<boolean> {
|
||||
private async _isStandardStartup(): Promise<string | undefined> {
|
||||
// check for standard startup:
|
||||
// * new window (no reload)
|
||||
// * just one window
|
||||
|
@ -90,29 +90,34 @@ export class StartupTimings implements IWorkbenchContribution {
|
|||
// * one text editor (not multiple, not webview, welcome etc...)
|
||||
// * cached data present (not rejected, not created)
|
||||
if (this._lifecycleService.startupKind !== StartupKind.NewWindow) {
|
||||
return false;
|
||||
return StartupKindToString(this._lifecycleService.startupKind);
|
||||
}
|
||||
if (await this._electronService.getWindowCount() !== 1) {
|
||||
return false;
|
||||
const windowCount = await this._electronService.getWindowCount();
|
||||
if (windowCount !== 1) {
|
||||
return 'Expected window count : 1, Actual : ' + windowCount;
|
||||
}
|
||||
const activeViewlet = this._viewletService.getActiveViewlet();
|
||||
if (!activeViewlet || activeViewlet.getId() !== files.VIEWLET_ID) {
|
||||
return false;
|
||||
return 'Explorer viewlet not visible';
|
||||
}
|
||||
const visibleEditorPanes = this._editorService.visibleEditorPanes;
|
||||
if (visibleEditorPanes.length !== 1 || !isCodeEditor(visibleEditorPanes[0].getControl())) {
|
||||
return false;
|
||||
if (visibleEditorPanes.length !== 1) {
|
||||
return 'Expected text editor count : 1, Actual : ' + visibleEditorPanes.length;
|
||||
}
|
||||
if (this._panelService.getActivePanel()) {
|
||||
return false;
|
||||
if (!isCodeEditor(visibleEditorPanes[0].getControl())) {
|
||||
return 'Active editor is not a text editor';
|
||||
}
|
||||
const activePanel = this._panelService.getActivePanel();
|
||||
if (activePanel) {
|
||||
return 'Current active panel : ' + this._panelService.getPanel(activePanel.getId())?.name;
|
||||
}
|
||||
if (!didUseCachedData()) {
|
||||
return false;
|
||||
return 'Either cache data is rejected or not created';
|
||||
}
|
||||
if (!await this._updateService.isLatestVersion()) {
|
||||
return false;
|
||||
return 'Not on latest version, updates available';
|
||||
}
|
||||
return true;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private _reportPerfTicks(): void {
|
||||
|
|
Loading…
Reference in a new issue