Skip to content

Commit 9fb452c

Browse files
jriekenlszomoru
andauthored
for disable renderer cpu profiling, keep long task telemetry (microsoft#162307)
fixes microsoft#161767 Co-authored-by: Ladislau Szomoru <[email protected]>
1 parent 20e2a15 commit 9fb452c

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

src/vs/workbench/contrib/performance/electron-sandbox/rendererAutoProfiler.ts

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export class RendererProfiling {
3737
const eventHistory = new RingBuffer<{ command: string; timestamp: number }>(5);
3838
this._disposables.add(commandService.onWillExecuteCommand(e => eventHistory.push({ command: e.commandId, timestamp: Date.now() })));
3939

40-
const sessionDisposables = this._disposables.add(new DisposableStore());
4140

4241
const obs = new PerformanceObserver(list => {
4342

@@ -51,11 +50,7 @@ export class RendererProfiling {
5150
return;
5251
}
5352

54-
// pause observation, we'll take a detailed look
55-
obs.disconnect();
56-
5753
const sessionId = generateUuid();
58-
logService.warn(`[perf] Renderer reported VERY LONG TASK (${maxDuration}ms), starting auto profiling session '${sessionId}'`);
5954

6055
// all visible views
6156
const views = viewsDescriptorService.viewContainers.map(container => {
@@ -74,31 +69,34 @@ export class RendererProfiling {
7469
editors: JSON.stringify(editors),
7570
});
7671

77-
// start heartbeat monitoring
78-
nativeHostService.startHeartbeat(sessionId).then(success => {
79-
if (!success) {
80-
logService.warn('[perf] FAILED to start heartbeat sending');
81-
return;
82-
}
83-
84-
// start sending a repeated heartbeat which is expected to be received by the main side
85-
const handle1 = setInterval(() => nativeHostService.sendHeartbeat(sessionId), 500);
86-
87-
// stop heartbeat after 20s
88-
const handle2 = setTimeout(() => sessionDisposables.clear(), 20 * 1000);
89-
90-
// cleanup
91-
// - stop heartbeat
92-
// - reconnect perf observer
93-
sessionDisposables.add(toDisposable(() => {
94-
clearInterval(handle1);
95-
clearTimeout(handle2);
96-
nativeHostService.stopHeartbeat(sessionId);
97-
logService.warn(`[perf] STOPPING to send heartbeat`);
98-
99-
obs.observe({ entryTypes: ['longtask'] });
100-
}));
101-
});
72+
// // start heartbeat monitoring
73+
// const sessionDisposables = this._disposables.add(new DisposableStore());
74+
// logService.warn(`[perf] Renderer reported VERY LONG TASK (${maxDuration}ms), starting auto profiling session '${sessionId}'`);
75+
// // pause observation, we'll take a detailed look
76+
// obs.disconnect();
77+
// nativeHostService.startHeartbeat(sessionId).then(success => {
78+
// if (!success) {
79+
// logService.warn('[perf] FAILED to start heartbeat sending');
80+
// return;
81+
// }
82+
83+
// // start sending a repeated heartbeat which is expected to be received by the main side
84+
// const handle1 = setInterval(() => nativeHostService.sendHeartbeat(sessionId), 500);
85+
86+
// // stop heartbeat after 20s
87+
// const handle2 = setTimeout(() => sessionDisposables.clear(), 20 * 1000);
88+
89+
// // cleanup
90+
// // - stop heartbeat
91+
// // - reconnect perf observer
92+
// sessionDisposables.add(toDisposable(() => {
93+
// clearInterval(handle1);
94+
// clearTimeout(handle2);
95+
// nativeHostService.stopHeartbeat(sessionId);
96+
// logService.warn(`[perf] STOPPING to send heartbeat`);
97+
// obs.observe({ entryTypes: ['longtask'] });
98+
// }));
99+
// });
102100
});
103101

104102
this._disposables.add(toDisposable(() => obs.disconnect()));

0 commit comments

Comments
 (0)