Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/vs/workbench/contrib/notebook/common/notebookPerformance.ts')
-rw-r--r--src/vs/workbench/contrib/notebook/common/notebookPerformance.ts36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/vs/workbench/contrib/notebook/common/notebookPerformance.ts b/src/vs/workbench/contrib/notebook/common/notebookPerformance.ts
index bd59c7bfbf1..c47b6eeeb2c 100644
--- a/src/vs/workbench/contrib/notebook/common/notebookPerformance.ts
+++ b/src/vs/workbench/contrib/notebook/common/notebookPerformance.ts
@@ -3,39 +3,23 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-import { URI } from 'vs/base/common/uri';
-
export type PerfName = 'startTime' | 'extensionActivated' | 'inputLoaded' | 'webviewCommLoaded' | 'customMarkdownLoaded' | 'editorLoaded';
type PerformanceMark = { [key in PerfName]?: number };
-const perfMarks = new Map<string, PerformanceMark>();
+export class NotebookPerfMarks {
+ private _marks: PerformanceMark = {};
+
+ get value(): PerformanceMark {
+ return { ...this._marks };
+ }
-export function mark(resource: URI, name: PerfName): void {
- const key = resource.toString();
- if (!perfMarks.has(key)) {
- const perfMark: PerformanceMark = {};
- perfMark[name] = Date.now();
- perfMarks.set(key, perfMark);
- } else {
- if (perfMarks.get(key)![name]) {
+ mark(name: PerfName): void {
+ if (this._marks[name]) {
console.error(`Skipping overwrite of notebook perf value: ${name}`);
return;
}
- perfMarks.get(key)![name] = Date.now();
- }
-}
-export function clearMarks(resource: URI): void {
- const key = resource.toString();
-
- perfMarks.delete(key);
-}
-
-export function getAndClearMarks(resource: URI): PerformanceMark | null {
- const key = resource.toString();
-
- const perfMark = perfMarks.get(key) || null;
- perfMarks.delete(key);
- return perfMark;
+ this._marks[name] = Date.now();
+ }
}