@@ -266,14 +266,15 @@ export class TerminalService implements ITerminalService {
266266 }
267267
268268 private readonly _perfMarks : PerformanceMark [ ] = [ ] ;
269- private _mark ( name : string ) {
270- this . _perfMarks . push ( new PerformanceMark ( name ) ) ;
269+ get perfMarks ( ) : readonly PerformanceMark [ ] { return this . _perfMarks ; }
270+ private _mark ( name : string , detail ?: string ) {
271+ this . _perfMarks . push ( new PerformanceMark ( name , { detail } ) ) ;
271272 }
272273
273274 async initializePrimaryBackend ( ) {
274- this . _mark ( 'code/ terminal/willGetTerminalBackend' ) ;
275+ this . _mark ( 'terminal/willGetTerminalBackend' ) ;
275276 this . _primaryBackend = await this . _terminalInstanceService . getBackend ( this . _environmentService . remoteAuthority ) ;
276- this . _mark ( 'code/ terminal/didGetTerminalBackend' ) ;
277+ this . _mark ( 'terminal/didGetTerminalBackend' ) ;
277278 const enableTerminalReconnection = this . configHelper . config . enablePersistentSessions ;
278279
279280 // Connect to the extension host if it's there, set the connection state to connected when
@@ -282,7 +283,7 @@ export class TerminalService implements ITerminalService {
282283
283284 const isPersistentRemote = ! ! this . _environmentService . remoteAuthority && enableTerminalReconnection ;
284285
285- this . _mark ( 'code/ terminal/willReconnect' ) ;
286+ this . _mark ( 'terminal/willReconnect' ) ;
286287 let reconnectedPromise : Promise < any > ;
287288 if ( isPersistentRemote ) {
288289 reconnectedPromise = this . _reconnectToRemoteTerminals ( ) ;
@@ -293,7 +294,7 @@ export class TerminalService implements ITerminalService {
293294 }
294295 reconnectedPromise . then ( ( ) => {
295296 this . _setConnected ( ) ;
296- this . _mark ( 'code/ terminal/didReconnect' ) ;
297+ this . _mark ( 'terminal/didReconnect' ) ;
297298 this . _timerService . setPerformanceMarks ( 'terminal' , this . _perfMarks ) ;
298299 this . _whenConnected . complete ( ) ;
299300 } ) ;
@@ -425,13 +426,13 @@ export class TerminalService implements ITerminalService {
425426 if ( ! backend ) {
426427 return ;
427428 }
428- this . _mark ( 'code/ terminal/willGetTerminalLayoutInfo' ) ;
429+ this . _mark ( 'terminal/willGetTerminalLayoutInfo' ) ;
429430 const layoutInfo = await backend . getTerminalLayoutInfo ( ) ;
430- this . _mark ( 'code/ terminal/didGetTerminalLayoutInfo' ) ;
431+ this . _mark ( 'terminal/didGetTerminalLayoutInfo' ) ;
431432 backend . reduceConnectionGraceTime ( ) ;
432- this . _mark ( 'code/ terminal/willRecreateTerminalGroups' ) ;
433+ this . _mark ( 'terminal/willRecreateTerminalGroups' ) ;
433434 await this . _recreateTerminalGroups ( layoutInfo ) ;
434- this . _mark ( 'code/ terminal/didRecreateTerminalGroups' ) ;
435+ this . _mark ( 'terminal/didRecreateTerminalGroups' ) ;
435436 // now that terminals have been restored,
436437 // attach listeners to update remote when terminals are changed
437438 this . _attachProcessLayoutListeners ( ) ;
@@ -442,13 +443,13 @@ export class TerminalService implements ITerminalService {
442443 if ( ! localBackend ) {
443444 return ;
444445 }
445- this . _mark ( 'code/ terminal/willGetTerminalLayoutInfo' ) ;
446+ this . _mark ( 'terminal/willGetTerminalLayoutInfo' ) ;
446447 const layoutInfo = await localBackend . getTerminalLayoutInfo ( ) ;
447- this . _mark ( 'code/ terminal/didGetTerminalLayoutInfo' ) ;
448+ this . _mark ( 'terminal/didGetTerminalLayoutInfo' ) ;
448449 if ( layoutInfo && layoutInfo . tabs . length > 0 ) {
449- this . _mark ( 'code/ terminal/willRecreateTerminalGroups' ) ;
450+ this . _mark ( 'terminal/willRecreateTerminalGroups' ) ;
450451 await this . _recreateTerminalGroups ( layoutInfo ) ;
451- this . _mark ( 'code/ terminal/didRecreateTerminalGroups' ) ;
452+ this . _mark ( 'terminal/didRecreateTerminalGroups' ) ;
452453 }
453454 // now that terminals have been restored,
454455 // attach listeners to update local state when terminals are changed
@@ -466,14 +467,15 @@ export class TerminalService implements ITerminalService {
466467 let terminalInstance : ITerminalInstance | undefined ;
467468 let group : ITerminalGroup | undefined ;
468469 for ( const terminalLayout of terminalLayouts ) {
469- this . _mark ( `code/terminal/willRecreateTerminal/ ${ terminalLayout . terminal ?. id } ` ) ;
470- if ( this . _lifecycleService . startupKind !== StartupKind . ReloadedWindow && terminalLayout . terminal ? .type === 'Task' ) {
470+ const attachPersistentProcess = terminalLayout . terminal ! ;
471+ if ( this . _lifecycleService . startupKind !== StartupKind . ReloadedWindow && attachPersistentProcess . type === 'Task' ) {
471472 continue ;
472473 }
474+ this . _mark ( `terminal/willRecreateTerminal/${ attachPersistentProcess . id } ` , `pid: ${ attachPersistentProcess . pid } ` ) ;
473475 if ( ! terminalInstance ) {
474476 // create group and terminal
475477 terminalInstance = await this . createTerminal ( {
476- config : { attachPersistentProcess : terminalLayout . terminal ! } ,
478+ config : { attachPersistentProcess } ,
477479 location : TerminalLocation . Panel
478480 } ) ;
479481 group = this . _terminalGroupService . getGroupForInstance ( terminalInstance ) ;
@@ -483,11 +485,11 @@ export class TerminalService implements ITerminalService {
483485 } else {
484486 // add split terminals to this group
485487 terminalInstance = await this . createTerminal ( {
486- config : { attachPersistentProcess : terminalLayout . terminal ! } ,
488+ config : { attachPersistentProcess } ,
487489 location : { parentTerminal : terminalInstance }
488490 } ) ;
489491 }
490- this . _mark ( `code/ terminal/didRecreateTerminal/${ terminalLayout . terminal ?. id } ` ) ;
492+ this . _mark ( `terminal/didRecreateTerminal/${ attachPersistentProcess . id } ` , `pid: ${ attachPersistentProcess . pid } `) ;
491493 }
492494 const activeInstance = this . instances . find ( t => {
493495 return t . shellLaunchConfig . attachPersistentProcess ?. id === groupLayout . activePersistentProcessId ;
@@ -926,7 +928,13 @@ export class TerminalService implements ITerminalService {
926928 const isPtyTerminal = options ?. config && 'customPtyImplementation' in options . config ;
927929 const isLocalInRemoteTerminal = this . _remoteAgentService . getConnection ( ) && URI . isUri ( options ?. cwd ) && options ?. cwd . scheme === Schemas . vscodeFileResource ;
928930 if ( ! isPtyTerminal && ! isLocalInRemoteTerminal ) {
931+ if ( this . _connectionState === TerminalConnectionState . Connecting ) {
932+ this . _mark ( `terminal/willGetProfiles` ) ;
933+ }
929934 await this . _terminalProfileService . profilesReady ;
935+ if ( this . _connectionState === TerminalConnectionState . Connecting ) {
936+ this . _mark ( `terminal/didGetProfiles` , `count: ${ this . _terminalProfileService . availableProfiles . length } ` ) ;
937+ }
930938 }
931939 }
932940
0 commit comments