mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +00:00
notebook output performance (#209282)
* record perf data for notebook outputs * debounce event per cell * send size info, emit directly from perf message listener * fix classification details * better names
This commit is contained in:
parent
2c3efed801
commit
8f218ce2a5
|
@ -909,6 +909,9 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
|
|||
}
|
||||
case 'notebookPerformanceMessage': {
|
||||
this.notebookEditor.updatePerformanceMetadata(data.cellId, data.executionId, data.duration, data.rendererId);
|
||||
if (data.mimeType && data.outputSize && data.rendererId === 'vscode.builtin-renderer') {
|
||||
this._sendPerformanceData(data.mimeType, data.outputSize, data.duration);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'outputInputFocus': {
|
||||
|
@ -927,6 +930,30 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
|
|||
return initializePromise.p;
|
||||
}
|
||||
|
||||
private _sendPerformanceData(mimeType: string, outputSize: number, renderTime: number) {
|
||||
type NotebookOutputRenderClassification = {
|
||||
owner: 'amunger';
|
||||
comment: 'Track performance data for output rendering';
|
||||
mimeType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Presentation type of the output.' };
|
||||
outputSize: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Size of the output data buffer.'; isMeasurement: true };
|
||||
renderTime: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Time spent rendering output.'; isMeasurement: true };
|
||||
};
|
||||
|
||||
type NotebookOutputRenderEvent = {
|
||||
mimeType: string;
|
||||
outputSize: number;
|
||||
renderTime: number;
|
||||
};
|
||||
|
||||
const telemetryData = {
|
||||
mimeType,
|
||||
outputSize,
|
||||
renderTime
|
||||
};
|
||||
|
||||
this.telemetryService.publicLog2<NotebookOutputRenderEvent, NotebookOutputRenderClassification>('NotebookCellOutputRender', telemetryData);
|
||||
}
|
||||
|
||||
private _handleNotebookCellResource(uri: URI) {
|
||||
const notebookResource = uri.path.length > 0 ? uri : this.documentUri;
|
||||
|
||||
|
|
|
@ -485,6 +485,8 @@ export interface IPerformanceMessage extends BaseToWebviewMessage {
|
|||
readonly cellId: string;
|
||||
readonly duration: number;
|
||||
readonly rendererId: string;
|
||||
readonly outputSize?: number;
|
||||
readonly mimeType?: string;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2711,7 +2711,21 @@ async function webviewPreloads(ctx: PreloadContext) {
|
|||
outputElement/** outputNode */.element.style.visibility = data.initiallyHidden ? 'hidden' : '';
|
||||
|
||||
if (!!data.executionId && !!data.rendererId) {
|
||||
postNotebookMessage<webviewMessages.IPerformanceMessage>('notebookPerformanceMessage', { cellId: data.cellId, executionId: data.executionId, duration: Date.now() - startTime, rendererId: data.rendererId });
|
||||
let outputSize: number | undefined = undefined;
|
||||
let mimeType: string | undefined = undefined;
|
||||
if (data.content.type === 1 /* extension */) {
|
||||
outputSize = data.content.output.valueBytes.length;
|
||||
mimeType = data.content.output.mime;
|
||||
}
|
||||
|
||||
postNotebookMessage<webviewMessages.IPerformanceMessage>('notebookPerformanceMessage', {
|
||||
cellId: data.cellId,
|
||||
executionId: data.executionId,
|
||||
duration: Date.now() - startTime,
|
||||
rendererId: data.rendererId,
|
||||
outputSize,
|
||||
mimeType
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue