Skip to content

Commit 1e29d60

Browse files
authored
* Fixes microsoft#181009 * Use isMeasurement: true for boolean
1 parent 5ba4af0 commit 1e29d60

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/vs/editor/browser/widget/workerBasedDocumentDiffProvider.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
import { Emitter, Event } from 'vs/base/common/event';
77
import { IDisposable } from 'vs/base/common/lifecycle';
8+
import { StopWatch } from 'vs/base/common/stopwatch';
89
import { IDocumentDiff, IDocumentDiffProvider, IDocumentDiffProviderOptions } from 'vs/editor/common/diff/documentDiffProvider';
910
import { ITextModel } from 'vs/editor/common/model';
1011
import { DiffAlgorithmName, IEditorWorkerService } from 'vs/editor/common/services/editorWorker';
12+
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
1113

1214
export class WorkerBasedDocumentDiffProvider implements IDocumentDiffProvider, IDisposable {
1315
private onDidChangeEventEmitter = new Emitter<void>();
@@ -19,6 +21,7 @@ export class WorkerBasedDocumentDiffProvider implements IDocumentDiffProvider, I
1921
constructor(
2022
options: IWorkerBasedDocumentDiffProviderOptions,
2123
@IEditorWorkerService private readonly editorWorkerService: IEditorWorkerService,
24+
@ITelemetryService private readonly telemetryService: ITelemetryService,
2225
) {
2326
this.setOptions(options);
2427
}
@@ -32,7 +35,25 @@ export class WorkerBasedDocumentDiffProvider implements IDocumentDiffProvider, I
3235
return this.diffAlgorithm.computeDiff(original, modified, options);
3336
}
3437

38+
const sw = StopWatch.create(true);
3539
const result = await this.editorWorkerService.computeDiff(original.uri, modified.uri, options, this.diffAlgorithm);
40+
const timeMs = sw.elapsed();
41+
42+
this.telemetryService.publicLog2<{
43+
timeMs: number;
44+
timedOut: boolean;
45+
}, {
46+
owner: 'hediet';
47+
48+
timeMs: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'To understand if the new diff algorithm is slower/faster than the old one' };
49+
timedOut: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'To understand how often the new diff algorithm times out' };
50+
51+
comment: 'This event gives insight about the performance of the new diff algorithm.';
52+
}>('diffEditor.computeDiff', {
53+
timeMs,
54+
timedOut: result?.quitEarly ?? true,
55+
});
56+
3657
if (!result) {
3758
throw new Error('no diff result available');
3859
}

0 commit comments

Comments
 (0)