Improve pty host startup marks/logging

Part of #185393
This commit is contained in:
Daniel Imms
2023-06-23 15:35:37 -07:00
parent d0d97015b0
commit d5f6bc6a83
2 changed files with 8 additions and 3 deletions
@@ -506,7 +506,6 @@ export class PtyService extends Disposable implements IPtyService {
if (layout) {
const expandedTabs = await Promise.all(layout.tabs.map(async tab => this._expandTerminalTab(tab)));
const tabs = expandedTabs.filter(t => t.terminals.length > 0);
this._logService.trace('PtyService.getTerminalLayoutInfo result', tabs);
performance.mark('code/didGetTerminalLayoutInfo');
return { tabs };
}
@@ -94,10 +94,10 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
// The pty host should not get launched until the first window restored phase
await this._lifecycleService.when(LifecyclePhase.Restored);
mark('code/willConnectPtyHost');
mark('code/terminal/willConnectPtyHost');
this._logService.trace('Renderer->PtyHost#connect: before acquirePort');
acquirePort('vscode:createPtyHostMessageChannel', 'vscode:createPtyHostMessageChannelResult').then(port => {
mark('code/didConnectPtyHost');
mark('code/terminal/didConnectPtyHost');
this._logService.trace('Renderer->PtyHost#connect: connection established');
// There are two connections to the pty host; one to the regular shared process
// _localPtyService, and one directly via message port _ptyHostDirectProxy. The former is
@@ -279,18 +279,24 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
// Re-resolve the environments and replace it on the state so local terminals use a fresh
// environment
mark('code/terminal/willGetReviveEnvironments');
for (const state of parsed) {
const freshEnv = await this._resolveEnvironmentForRevive(variableResolver, state.shellLaunchConfig);
state.processLaunchConfig.env = freshEnv;
}
mark('code/terminal/didGetReviveEnvironments');
mark('code/terminal/willReviveTerminalProcesses');
await this._localPtyService.reviveTerminalProcesses(parsed, Intl.DateTimeFormat().resolvedOptions().locale);
mark('code/terminal/didReviveTerminalProcesses');
this._storageService.remove(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE);
// If reviving processes, send the terminal layout info back to the pty host as it
// will not have been persisted on application exit
const layoutInfo = this._storageService.get(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
if (layoutInfo) {
mark('code/terminal/willSetTerminalLayoutInfo');
await this._localPtyService.setTerminalLayoutInfo(JSON.parse(layoutInfo));
mark('code/terminal/didSetTerminalLayoutInfo');
this._storageService.remove(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
}
} catch {