@@ -266,14 +266,15 @@ export class TerminalService implements ITerminalService {
266
266
}
267
267
268
268
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 } ) ) ;
271
272
}
272
273
273
274
async initializePrimaryBackend ( ) {
274
- this . _mark ( 'code/ terminal/willGetTerminalBackend' ) ;
275
+ this . _mark ( 'terminal/willGetTerminalBackend' ) ;
275
276
this . _primaryBackend = await this . _terminalInstanceService . getBackend ( this . _environmentService . remoteAuthority ) ;
276
- this . _mark ( 'code/ terminal/didGetTerminalBackend' ) ;
277
+ this . _mark ( 'terminal/didGetTerminalBackend' ) ;
277
278
const enableTerminalReconnection = this . configHelper . config . enablePersistentSessions ;
278
279
279
280
// 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 {
282
283
283
284
const isPersistentRemote = ! ! this . _environmentService . remoteAuthority && enableTerminalReconnection ;
284
285
285
- this . _mark ( 'code/ terminal/willReconnect' ) ;
286
+ this . _mark ( 'terminal/willReconnect' ) ;
286
287
let reconnectedPromise : Promise < any > ;
287
288
if ( isPersistentRemote ) {
288
289
reconnectedPromise = this . _reconnectToRemoteTerminals ( ) ;
@@ -293,7 +294,7 @@ export class TerminalService implements ITerminalService {
293
294
}
294
295
reconnectedPromise . then ( ( ) => {
295
296
this . _setConnected ( ) ;
296
- this . _mark ( 'code/ terminal/didReconnect' ) ;
297
+ this . _mark ( 'terminal/didReconnect' ) ;
297
298
this . _timerService . setPerformanceMarks ( 'terminal' , this . _perfMarks ) ;
298
299
this . _whenConnected . complete ( ) ;
299
300
} ) ;
@@ -425,13 +426,13 @@ export class TerminalService implements ITerminalService {
425
426
if ( ! backend ) {
426
427
return ;
427
428
}
428
- this . _mark ( 'code/ terminal/willGetTerminalLayoutInfo' ) ;
429
+ this . _mark ( 'terminal/willGetTerminalLayoutInfo' ) ;
429
430
const layoutInfo = await backend . getTerminalLayoutInfo ( ) ;
430
- this . _mark ( 'code/ terminal/didGetTerminalLayoutInfo' ) ;
431
+ this . _mark ( 'terminal/didGetTerminalLayoutInfo' ) ;
431
432
backend . reduceConnectionGraceTime ( ) ;
432
- this . _mark ( 'code/ terminal/willRecreateTerminalGroups' ) ;
433
+ this . _mark ( 'terminal/willRecreateTerminalGroups' ) ;
433
434
await this . _recreateTerminalGroups ( layoutInfo ) ;
434
- this . _mark ( 'code/ terminal/didRecreateTerminalGroups' ) ;
435
+ this . _mark ( 'terminal/didRecreateTerminalGroups' ) ;
435
436
// now that terminals have been restored,
436
437
// attach listeners to update remote when terminals are changed
437
438
this . _attachProcessLayoutListeners ( ) ;
@@ -442,13 +443,13 @@ export class TerminalService implements ITerminalService {
442
443
if ( ! localBackend ) {
443
444
return ;
444
445
}
445
- this . _mark ( 'code/ terminal/willGetTerminalLayoutInfo' ) ;
446
+ this . _mark ( 'terminal/willGetTerminalLayoutInfo' ) ;
446
447
const layoutInfo = await localBackend . getTerminalLayoutInfo ( ) ;
447
- this . _mark ( 'code/ terminal/didGetTerminalLayoutInfo' ) ;
448
+ this . _mark ( 'terminal/didGetTerminalLayoutInfo' ) ;
448
449
if ( layoutInfo && layoutInfo . tabs . length > 0 ) {
449
- this . _mark ( 'code/ terminal/willRecreateTerminalGroups' ) ;
450
+ this . _mark ( 'terminal/willRecreateTerminalGroups' ) ;
450
451
await this . _recreateTerminalGroups ( layoutInfo ) ;
451
- this . _mark ( 'code/ terminal/didRecreateTerminalGroups' ) ;
452
+ this . _mark ( 'terminal/didRecreateTerminalGroups' ) ;
452
453
}
453
454
// now that terminals have been restored,
454
455
// attach listeners to update local state when terminals are changed
@@ -466,14 +467,15 @@ export class TerminalService implements ITerminalService {
466
467
let terminalInstance : ITerminalInstance | undefined ;
467
468
let group : ITerminalGroup | undefined ;
468
469
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' ) {
471
472
continue ;
472
473
}
474
+ this . _mark ( `terminal/willRecreateTerminal/${ attachPersistentProcess . id } ` , `pid: ${ attachPersistentProcess . pid } ` ) ;
473
475
if ( ! terminalInstance ) {
474
476
// create group and terminal
475
477
terminalInstance = await this . createTerminal ( {
476
- config : { attachPersistentProcess : terminalLayout . terminal ! } ,
478
+ config : { attachPersistentProcess } ,
477
479
location : TerminalLocation . Panel
478
480
} ) ;
479
481
group = this . _terminalGroupService . getGroupForInstance ( terminalInstance ) ;
@@ -483,11 +485,11 @@ export class TerminalService implements ITerminalService {
483
485
} else {
484
486
// add split terminals to this group
485
487
terminalInstance = await this . createTerminal ( {
486
- config : { attachPersistentProcess : terminalLayout . terminal ! } ,
488
+ config : { attachPersistentProcess } ,
487
489
location : { parentTerminal : terminalInstance }
488
490
} ) ;
489
491
}
490
- this . _mark ( `code/ terminal/didRecreateTerminal/${ terminalLayout . terminal ?. id } ` ) ;
492
+ this . _mark ( `terminal/didRecreateTerminal/${ attachPersistentProcess . id } ` , `pid: ${ attachPersistentProcess . pid } `) ;
491
493
}
492
494
const activeInstance = this . instances . find ( t => {
493
495
return t . shellLaunchConfig . attachPersistentProcess ?. id === groupLayout . activePersistentProcessId ;
@@ -926,7 +928,13 @@ export class TerminalService implements ITerminalService {
926
928
const isPtyTerminal = options ?. config && 'customPtyImplementation' in options . config ;
927
929
const isLocalInRemoteTerminal = this . _remoteAgentService . getConnection ( ) && URI . isUri ( options ?. cwd ) && options ?. cwd . scheme === Schemas . vscodeFileResource ;
928
930
if ( ! isPtyTerminal && ! isLocalInRemoteTerminal ) {
931
+ if ( this . _connectionState === TerminalConnectionState . Connecting ) {
932
+ this . _mark ( `terminal/willGetProfiles` ) ;
933
+ }
929
934
await this . _terminalProfileService . profilesReady ;
935
+ if ( this . _connectionState === TerminalConnectionState . Connecting ) {
936
+ this . _mark ( `terminal/didGetProfiles` , `count: ${ this . _terminalProfileService . availableProfiles . length } ` ) ;
937
+ }
930
938
}
931
939
}
932
940
0 commit comments