@@ -51,6 +51,7 @@ import { XtermTerminal } from 'vs/workbench/contrib/terminal/browser/xterm/xterm
51
51
import { TerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminalInstance' ;
52
52
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
53
53
import { TerminalCapabilityStore } from 'vs/platform/terminal/common/capabilities/terminalCapabilityStore' ;
54
+ import { mark } from 'vs/base/common/performance' ;
54
55
55
56
export class TerminalService implements ITerminalService {
56
57
declare _serviceBrand : undefined ;
@@ -263,16 +264,10 @@ export class TerminalService implements ITerminalService {
263
264
return undefined ;
264
265
}
265
266
266
- private readonly _perfMarks : PerformanceMark [ ] = [ ] ;
267
- get perfMarks ( ) : readonly PerformanceMark [ ] { return this . _perfMarks ; }
268
- private _mark ( name : string ) {
269
- this . _perfMarks . push ( new PerformanceMark ( name ) ) ;
270
- }
271
-
272
267
async initializePrimaryBackend ( ) {
273
- this . _mark ( 'code/terminal/willGetTerminalBackend' ) ;
268
+ mark ( 'code/terminal/willGetTerminalBackend' ) ;
274
269
this . _primaryBackend = await this . _terminalInstanceService . getBackend ( this . _environmentService . remoteAuthority ) ;
275
- this . _mark ( 'code/terminal/didGetTerminalBackend' ) ;
270
+ mark ( 'code/terminal/didGetTerminalBackend' ) ;
276
271
const enableTerminalReconnection = this . configHelper . config . enablePersistentSessions ;
277
272
278
273
// Connect to the extension host if it's there, set the connection state to connected when
@@ -281,7 +276,7 @@ export class TerminalService implements ITerminalService {
281
276
282
277
const isPersistentRemote = ! ! this . _environmentService . remoteAuthority && enableTerminalReconnection ;
283
278
284
- this . _mark ( 'code/terminal/willReconnect' ) ;
279
+ mark ( 'code/terminal/willReconnect' ) ;
285
280
let reconnectedPromise : Promise < any > ;
286
281
if ( isPersistentRemote ) {
287
282
reconnectedPromise = this . _reconnectToRemoteTerminals ( ) ;
@@ -292,7 +287,7 @@ export class TerminalService implements ITerminalService {
292
287
}
293
288
reconnectedPromise . then ( ( ) => {
294
289
this . _setConnected ( ) ;
295
- this . _mark ( 'code/terminal/didReconnect' ) ;
290
+ mark ( 'code/terminal/didReconnect' ) ;
296
291
for ( const backend of this . _terminalInstanceService . getRegisteredBackends ( ) ) {
297
292
backend . setConnected ( ) ;
298
293
}
@@ -426,13 +421,13 @@ export class TerminalService implements ITerminalService {
426
421
if ( ! backend ) {
427
422
return ;
428
423
}
429
- this . _mark ( 'code/terminal/willGetTerminalLayoutInfo' ) ;
424
+ mark ( 'code/terminal/willGetTerminalLayoutInfo' ) ;
430
425
const layoutInfo = await backend . getTerminalLayoutInfo ( ) ;
431
- this . _mark ( 'code/terminal/didGetTerminalLayoutInfo' ) ;
426
+ mark ( 'code/terminal/didGetTerminalLayoutInfo' ) ;
432
427
backend . reduceConnectionGraceTime ( ) ;
433
- this . _mark ( 'code/terminal/willRecreateTerminalGroups' ) ;
428
+ mark ( 'code/terminal/willRecreateTerminalGroups' ) ;
434
429
await this . _recreateTerminalGroups ( layoutInfo ) ;
435
- this . _mark ( 'code/terminal/didRecreateTerminalGroups' ) ;
430
+ mark ( 'code/terminal/didRecreateTerminalGroups' ) ;
436
431
// now that terminals have been restored,
437
432
// attach listeners to update remote when terminals are changed
438
433
this . _attachProcessLayoutListeners ( ) ;
@@ -443,13 +438,13 @@ export class TerminalService implements ITerminalService {
443
438
if ( ! localBackend ) {
444
439
return ;
445
440
}
446
- this . _mark ( 'code/terminal/willGetTerminalLayoutInfo' ) ;
441
+ mark ( 'code/terminal/willGetTerminalLayoutInfo' ) ;
447
442
const layoutInfo = await localBackend . getTerminalLayoutInfo ( ) ;
448
- this . _mark ( 'code/terminal/didGetTerminalLayoutInfo' ) ;
443
+ mark ( 'code/terminal/didGetTerminalLayoutInfo' ) ;
449
444
if ( layoutInfo && layoutInfo . tabs . length > 0 ) {
450
- this . _mark ( 'code/terminal/willRecreateTerminalGroups' ) ;
445
+ mark ( 'code/terminal/willRecreateTerminalGroups' ) ;
451
446
await this . _recreateTerminalGroups ( layoutInfo ) ;
452
- this . _mark ( 'code/terminal/didRecreateTerminalGroups' ) ;
447
+ mark ( 'code/terminal/didRecreateTerminalGroups' ) ;
453
448
}
454
449
// now that terminals have been restored,
455
450
// attach listeners to update local state when terminals are changed
@@ -471,7 +466,7 @@ export class TerminalService implements ITerminalService {
471
466
if ( this . _lifecycleService . startupKind !== StartupKind . ReloadedWindow && attachPersistentProcess . type === 'Task' ) {
472
467
continue ;
473
468
}
474
- this . _mark ( ` terminal/willRecreateTerminal/${ attachPersistentProcess . id } -${ attachPersistentProcess . pid } `) ;
469
+ mark ( `code/ terminal/willRecreateTerminal/${ attachPersistentProcess . id } -${ attachPersistentProcess . pid } `) ;
475
470
if ( ! terminalInstance ) {
476
471
// create group and terminal
477
472
terminalInstance = await this . createTerminal ( {
@@ -489,7 +484,7 @@ export class TerminalService implements ITerminalService {
489
484
location : { parentTerminal : terminalInstance }
490
485
} ) ;
491
486
}
492
- this . _mark ( ` terminal/didRecreateTerminal/${ attachPersistentProcess . id } -${ attachPersistentProcess . pid } `) ;
487
+ mark ( `code/ terminal/didRecreateTerminal/${ attachPersistentProcess . id } -${ attachPersistentProcess . pid } `) ;
493
488
}
494
489
const activeInstance = this . instances . find ( t => {
495
490
return t . shellLaunchConfig . attachPersistentProcess ?. id === groupLayout . activePersistentProcessId ;
@@ -929,11 +924,11 @@ export class TerminalService implements ITerminalService {
929
924
const isLocalInRemoteTerminal = this . _remoteAgentService . getConnection ( ) && URI . isUri ( options ?. cwd ) && options ?. cwd . scheme === Schemas . vscodeFileResource ;
930
925
if ( ! isPtyTerminal && ! isLocalInRemoteTerminal ) {
931
926
if ( this . _connectionState === TerminalConnectionState . Connecting ) {
932
- this . _mark ( ` terminal/willGetProfiles`) ;
927
+ mark ( `code/ terminal/willGetProfiles`) ;
933
928
}
934
929
await this . _terminalProfileService . profilesReady ;
935
930
if ( this . _connectionState === TerminalConnectionState . Connecting ) {
936
- this . _mark ( ` terminal/didGetProfiles`) ;
931
+ mark ( `code/ terminal/didGetProfiles`) ;
937
932
}
938
933
}
939
934
}
0 commit comments