Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.

Commit e3de82e

Browse files
authored
Make clearMarks optional in release branch
2 parents 4559557 + a864577 commit e3de82e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/util/common/performance.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
interface IMonacoPerformanceMarks {
77
mark(name: string, markOptions?: { startTime?: number }): void;
88
getMarks(): { name: string; startTime: number }[];
9-
clearMarks(prefix: string): void;
9+
clearMarks?(prefix: string): void;
1010
}
1111

1212
function _getNativePolyfill(): IMonacoPerformanceMarks {
@@ -28,6 +28,7 @@ function _getNativePolyfill(): IMonacoPerformanceMarks {
2828
}
2929

3030
const perf: IMonacoPerformanceMarks = (globalThis as { MonacoPerformanceMarks?: IMonacoPerformanceMarks }).MonacoPerformanceMarks ?? _getNativePolyfill();
31+
const skipPerf = !perf.clearMarks;
3132

3233
const chatExtPrefix = 'code/chat/ext/';
3334

@@ -86,6 +87,9 @@ export type ChatExtPerfMarkName = typeof ChatExtPerfMark[keyof typeof ChatExtPer
8687
* via {@link clearChatExtMarks}.
8788
*/
8889
export function markChatExt(sessionId: string | undefined, name: ChatExtPerfMarkName): void {
90+
if (skipPerf) {
91+
return;
92+
}
8993
if (sessionId) {
9094
perf.mark(`${chatExtPrefix}${sessionId}/${name}`);
9195
}
@@ -95,7 +99,7 @@ export function markChatExt(sessionId: string | undefined, name: ChatExtPerfMark
9599
* Clears all performance marks for the given chat session.
96100
*/
97101
export function clearChatExtMarks(sessionId: string): void {
98-
perf.clearMarks(`${chatExtPrefix}${sessionId}/`);
102+
perf.clearMarks?.(`${chatExtPrefix}${sessionId}/`);
99103
}
100104

101105
export const ChatExtGlobalPerfMark = {
@@ -118,6 +122,9 @@ export type ChatExtGlobalPerfMarkName = typeof ChatExtGlobalPerfMark[keyof typeo
118122
* Used for one-time activation marks like `willActivate` / `didActivate`.
119123
*/
120124
export function markChatExtGlobal(name: ChatExtGlobalPerfMarkName): void {
125+
if (skipPerf) {
126+
return;
127+
}
121128
perf.mark(`${chatExtPrefix}${name}`);
122129
}
123130

0 commit comments

Comments
 (0)