Skip to content

Commit d02b649

Browse files
committed
Use perf.PerformanceMark and code/ prefix
1 parent 3dc84a7 commit d02b649

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

src/vs/workbench/contrib/performance/browser/perfviewEditor.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
2626
import { isWeb } from 'vs/base/common/platform';
2727
import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
2828
import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
29+
import * as perf from 'vs/base/common/performance';
2930

3031
export class PerfviewContrib {
3132

@@ -224,18 +225,18 @@ class PerfModelContentProvider implements ITextModelContentProvider {
224225
}
225226
}
226227

227-
private _addPerfMarksTable(name: string, md: MarkdownBuilder, marks: readonly PerformanceMark[]): void {
228+
private _addPerfMarksTable(name: string, md: MarkdownBuilder, marks: readonly perf.PerformanceMark[]): void {
228229
const table: Array<Array<string | number | undefined>> = [];
229230
let lastStartTime = -1;
230231
let total = 0;
231-
for (const { name, startTime, detail } of marks) {
232+
for (const { name, startTime } of marks) {
232233
const delta = lastStartTime !== -1 ? startTime - lastStartTime : 0;
233234
total += delta;
234-
table.push([name, Math.round(startTime), Math.round(delta), Math.round(total), detail ?? '']);
235+
table.push([name, Math.round(startTime), Math.round(delta), Math.round(total)]);
235236
lastStartTime = startTime;
236237
}
237238
md.heading(2, name);
238-
md.table(['Name', 'Timestamp', 'Delta', 'Total', 'Detail'], table);
239+
md.table(['Name', 'Timestamp', 'Delta', 'Total'], table);
239240
}
240241

241242
private _addRawPerfMarks(md: MarkdownBuilder): void {

src/vs/workbench/contrib/terminal/browser/terminal.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
5+
6+
import * as perf from 'vs/base/common/performance';
57
import { IDimension } from 'vs/base/browser/dom';
68
import { Orientation } from 'vs/base/browser/ui/splitview/splitview';
79
import { Color } from 'vs/base/common/color';
@@ -159,7 +161,7 @@ export interface ITerminalService extends ITerminalInstanceHost {
159161
readonly connectionState: TerminalConnectionState;
160162
readonly whenConnected: Promise<void>;
161163
readonly defaultLocation: TerminalLocation;
162-
readonly perfMarks: readonly PerformanceMark[];
164+
readonly perfMarks: readonly perf.PerformanceMark[];
163165

164166
onDidChangeActiveGroup: Event<ITerminalGroup | undefined>;
165167
onDidDisposeGroup: Event<ITerminalGroup>;

src/vs/workbench/contrib/terminal/browser/terminalService.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,14 @@ export class TerminalService implements ITerminalService {
265265

266266
private readonly _perfMarks: PerformanceMark[] = [];
267267
get perfMarks(): readonly PerformanceMark[] { return this._perfMarks; }
268-
private _mark(name: string, detail?: string) {
269-
this._perfMarks.push(new PerformanceMark(name, { detail }));
268+
private _mark(name: string) {
269+
this._perfMarks.push(new PerformanceMark(name));
270270
}
271271

272272
async initializePrimaryBackend() {
273-
this._mark('terminal/willGetTerminalBackend');
273+
this._mark('code/terminal/willGetTerminalBackend');
274274
this._primaryBackend = await this._terminalInstanceService.getBackend(this._environmentService.remoteAuthority);
275-
this._mark('terminal/didGetTerminalBackend');
275+
this._mark('code/terminal/didGetTerminalBackend');
276276
const enableTerminalReconnection = this.configHelper.config.enablePersistentSessions;
277277

278278
// Connect to the extension host if it's there, set the connection state to connected when
@@ -281,7 +281,7 @@ export class TerminalService implements ITerminalService {
281281

282282
const isPersistentRemote = !!this._environmentService.remoteAuthority && enableTerminalReconnection;
283283

284-
this._mark('terminal/willReconnect');
284+
this._mark('code/terminal/willReconnect');
285285
let reconnectedPromise: Promise<any>;
286286
if (isPersistentRemote) {
287287
reconnectedPromise = this._reconnectToRemoteTerminals();
@@ -292,7 +292,7 @@ export class TerminalService implements ITerminalService {
292292
}
293293
reconnectedPromise.then(() => {
294294
this._setConnected();
295-
this._mark('terminal/didReconnect');
295+
this._mark('code/terminal/didReconnect');
296296
this._whenConnected.complete();
297297
});
298298

@@ -423,13 +423,13 @@ export class TerminalService implements ITerminalService {
423423
if (!backend) {
424424
return;
425425
}
426-
this._mark('terminal/willGetTerminalLayoutInfo');
426+
this._mark('code/terminal/willGetTerminalLayoutInfo');
427427
const layoutInfo = await backend.getTerminalLayoutInfo();
428-
this._mark('terminal/didGetTerminalLayoutInfo');
428+
this._mark('code/terminal/didGetTerminalLayoutInfo');
429429
backend.reduceConnectionGraceTime();
430-
this._mark('terminal/willRecreateTerminalGroups');
430+
this._mark('code/terminal/willRecreateTerminalGroups');
431431
await this._recreateTerminalGroups(layoutInfo);
432-
this._mark('terminal/didRecreateTerminalGroups');
432+
this._mark('code/terminal/didRecreateTerminalGroups');
433433
// now that terminals have been restored,
434434
// attach listeners to update remote when terminals are changed
435435
this._attachProcessLayoutListeners();
@@ -440,13 +440,13 @@ export class TerminalService implements ITerminalService {
440440
if (!localBackend) {
441441
return;
442442
}
443-
this._mark('terminal/willGetTerminalLayoutInfo');
443+
this._mark('code/terminal/willGetTerminalLayoutInfo');
444444
const layoutInfo = await localBackend.getTerminalLayoutInfo();
445-
this._mark('terminal/didGetTerminalLayoutInfo');
445+
this._mark('code/terminal/didGetTerminalLayoutInfo');
446446
if (layoutInfo && layoutInfo.tabs.length > 0) {
447-
this._mark('terminal/willRecreateTerminalGroups');
447+
this._mark('code/terminal/willRecreateTerminalGroups');
448448
await this._recreateTerminalGroups(layoutInfo);
449-
this._mark('terminal/didRecreateTerminalGroups');
449+
this._mark('code/terminal/didRecreateTerminalGroups');
450450
}
451451
// now that terminals have been restored,
452452
// attach listeners to update local state when terminals are changed
@@ -468,7 +468,7 @@ export class TerminalService implements ITerminalService {
468468
if (this._lifecycleService.startupKind !== StartupKind.ReloadedWindow && attachPersistentProcess.type === 'Task') {
469469
continue;
470470
}
471-
this._mark(`terminal/willRecreateTerminal/${attachPersistentProcess.id}`, `pid: ${attachPersistentProcess.pid}`);
471+
this._mark(`terminal/willRecreateTerminal/${attachPersistentProcess.id}-${attachPersistentProcess.pid}`);
472472
if (!terminalInstance) {
473473
// create group and terminal
474474
terminalInstance = await this.createTerminal({
@@ -486,7 +486,7 @@ export class TerminalService implements ITerminalService {
486486
location: { parentTerminal: terminalInstance }
487487
});
488488
}
489-
this._mark(`terminal/didRecreateTerminal/${attachPersistentProcess.id}`, `pid: ${attachPersistentProcess.pid}`);
489+
this._mark(`terminal/didRecreateTerminal/${attachPersistentProcess.id}-${attachPersistentProcess.pid}`);
490490
}
491491
const activeInstance = this.instances.find(t => {
492492
return t.shellLaunchConfig.attachPersistentProcess?.id === groupLayout.activePersistentProcessId;
@@ -930,7 +930,7 @@ export class TerminalService implements ITerminalService {
930930
}
931931
await this._terminalProfileService.profilesReady;
932932
if (this._connectionState === TerminalConnectionState.Connecting) {
933-
this._mark(`terminal/didGetProfiles`, `count: ${this._terminalProfileService.availableProfiles.length}`);
933+
this._mark(`terminal/didGetProfiles`);
934934
}
935935
}
936936
}

0 commit comments

Comments
 (0)