mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-29 16:20:29 -04:00
Merge from vscode 79a1f5a5ca0c6c53db617aa1fa5a2396d2caebe2
This commit is contained in:
@@ -18,7 +18,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||
import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
|
||||
export class StartupProfiler implements IWorkbenchContribution {
|
||||
@@ -115,8 +115,11 @@ export class StartupProfiler implements IWorkbenchContribution {
|
||||
}
|
||||
|
||||
const ref = await this._textModelResolverService.createModelReference(PerfviewInput.Uri);
|
||||
await this._clipboardService.writeText(ref.object.textEditorModel.getValue());
|
||||
ref.dispose();
|
||||
try {
|
||||
await this._clipboardService.writeText(ref.object.textEditorModel.getValue());
|
||||
} finally {
|
||||
ref.dispose();
|
||||
}
|
||||
|
||||
const body = `
|
||||
1. :warning: We have copied additional data to your clipboard. Make sure to **paste** here. :warning:
|
||||
|
||||
@@ -10,11 +10,11 @@ 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';
|
||||
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||
import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import * as files from 'vs/workbench/contrib/files/common/files';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user