@@ -51,6 +51,7 @@ import { XtermTerminal } from 'vs/workbench/contrib/terminal/browser/xterm/xterm
5151import { TerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminalInstance' ;
5252import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
5353import { TerminalCapabilityStore } from 'vs/platform/terminal/common/capabilities/terminalCapabilityStore' ;
54+ import { mark } from 'vs/base/common/performance' ;
5455
5556export class TerminalService implements ITerminalService {
5657 declare _serviceBrand : undefined ;
@@ -263,16 +264,10 @@ export class TerminalService implements ITerminalService {
263264 return undefined ;
264265 }
265266
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-
272267 async initializePrimaryBackend ( ) {
273- this . _mark ( 'code/terminal/willGetTerminalBackend' ) ;
268+ mark ( 'code/terminal/willGetTerminalBackend' ) ;
274269 this . _primaryBackend = await this . _terminalInstanceService . getBackend ( this . _environmentService . remoteAuthority ) ;
275- this . _mark ( 'code/terminal/didGetTerminalBackend' ) ;
270+ mark ( 'code/terminal/didGetTerminalBackend' ) ;
276271 const enableTerminalReconnection = this . configHelper . config . enablePersistentSessions ;
277272
278273 // 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 {
281276
282277 const isPersistentRemote = ! ! this . _environmentService . remoteAuthority && enableTerminalReconnection ;
283278
284- this . _mark ( 'code/terminal/willReconnect' ) ;
279+ mark ( 'code/terminal/willReconnect' ) ;
285280 let reconnectedPromise : Promise < any > ;
286281 if ( isPersistentRemote ) {
287282 reconnectedPromise = this . _reconnectToRemoteTerminals ( ) ;
@@ -292,7 +287,7 @@ export class TerminalService implements ITerminalService {
292287 }
293288 reconnectedPromise . then ( ( ) => {
294289 this . _setConnected ( ) ;
295- this . _mark ( 'code/terminal/didReconnect' ) ;
290+ mark ( 'code/terminal/didReconnect' ) ;
296291 for ( const backend of this . _terminalInstanceService . getRegisteredBackends ( ) ) {
297292 backend . setConnected ( ) ;
298293 }
@@ -426,13 +421,13 @@ export class TerminalService implements ITerminalService {
426421 if ( ! backend ) {
427422 return ;
428423 }
429- this . _mark ( 'code/terminal/willGetTerminalLayoutInfo' ) ;
424+ mark ( 'code/terminal/willGetTerminalLayoutInfo' ) ;
430425 const layoutInfo = await backend . getTerminalLayoutInfo ( ) ;
431- this . _mark ( 'code/terminal/didGetTerminalLayoutInfo' ) ;
426+ mark ( 'code/terminal/didGetTerminalLayoutInfo' ) ;
432427 backend . reduceConnectionGraceTime ( ) ;
433- this . _mark ( 'code/terminal/willRecreateTerminalGroups' ) ;
428+ mark ( 'code/terminal/willRecreateTerminalGroups' ) ;
434429 await this . _recreateTerminalGroups ( layoutInfo ) ;
435- this . _mark ( 'code/terminal/didRecreateTerminalGroups' ) ;
430+ mark ( 'code/terminal/didRecreateTerminalGroups' ) ;
436431 // now that terminals have been restored,
437432 // attach listeners to update remote when terminals are changed
438433 this . _attachProcessLayoutListeners ( ) ;
@@ -443,13 +438,13 @@ export class TerminalService implements ITerminalService {
443438 if ( ! localBackend ) {
444439 return ;
445440 }
446- this . _mark ( 'code/terminal/willGetTerminalLayoutInfo' ) ;
441+ mark ( 'code/terminal/willGetTerminalLayoutInfo' ) ;
447442 const layoutInfo = await localBackend . getTerminalLayoutInfo ( ) ;
448- this . _mark ( 'code/terminal/didGetTerminalLayoutInfo' ) ;
443+ mark ( 'code/terminal/didGetTerminalLayoutInfo' ) ;
449444 if ( layoutInfo && layoutInfo . tabs . length > 0 ) {
450- this . _mark ( 'code/terminal/willRecreateTerminalGroups' ) ;
445+ mark ( 'code/terminal/willRecreateTerminalGroups' ) ;
451446 await this . _recreateTerminalGroups ( layoutInfo ) ;
452- this . _mark ( 'code/terminal/didRecreateTerminalGroups' ) ;
447+ mark ( 'code/terminal/didRecreateTerminalGroups' ) ;
453448 }
454449 // now that terminals have been restored,
455450 // attach listeners to update local state when terminals are changed
@@ -471,7 +466,7 @@ export class TerminalService implements ITerminalService {
471466 if ( this . _lifecycleService . startupKind !== StartupKind . ReloadedWindow && attachPersistentProcess . type === 'Task' ) {
472467 continue ;
473468 }
474- this . _mark ( ` terminal/willRecreateTerminal/${ attachPersistentProcess . id } -${ attachPersistentProcess . pid } `) ;
469+ mark ( `code/ terminal/willRecreateTerminal/${ attachPersistentProcess . id } -${ attachPersistentProcess . pid } `) ;
475470 if ( ! terminalInstance ) {
476471 // create group and terminal
477472 terminalInstance = await this . createTerminal ( {
@@ -489,7 +484,7 @@ export class TerminalService implements ITerminalService {
489484 location : { parentTerminal : terminalInstance }
490485 } ) ;
491486 }
492- this . _mark ( ` terminal/didRecreateTerminal/${ attachPersistentProcess . id } -${ attachPersistentProcess . pid } `) ;
487+ mark ( `code/ terminal/didRecreateTerminal/${ attachPersistentProcess . id } -${ attachPersistentProcess . pid } `) ;
493488 }
494489 const activeInstance = this . instances . find ( t => {
495490 return t . shellLaunchConfig . attachPersistentProcess ?. id === groupLayout . activePersistentProcessId ;
@@ -929,11 +924,11 @@ export class TerminalService implements ITerminalService {
929924 const isLocalInRemoteTerminal = this . _remoteAgentService . getConnection ( ) && URI . isUri ( options ?. cwd ) && options ?. cwd . scheme === Schemas . vscodeFileResource ;
930925 if ( ! isPtyTerminal && ! isLocalInRemoteTerminal ) {
931926 if ( this . _connectionState === TerminalConnectionState . Connecting ) {
932- this . _mark ( ` terminal/willGetProfiles`) ;
927+ mark ( `code/ terminal/willGetProfiles`) ;
933928 }
934929 await this . _terminalProfileService . profilesReady ;
935930 if ( this . _connectionState === TerminalConnectionState . Connecting ) {
936- this . _mark ( ` terminal/didGetProfiles`) ;
931+ mark ( `code/ terminal/didGetProfiles`) ;
937932 }
938933 }
939934 }
0 commit comments