提交 16874c18 编写于 作者: J Johannes Rieken

debt - remove before/afterLoadWorkbenchMain, those are already perf-entries

上级 d0fef122
...@@ -11,7 +11,8 @@ export interface PerformanceEntry { ...@@ -11,7 +11,8 @@ export interface PerformanceEntry {
} }
export function mark(name: string): void; export function mark(name: string): void;
export function measure(name: string, from?: string, to?: string): void;
export function measure(name: string, from?: string, to?: string): PerformanceEntry;
/** /**
* Time something, shorthant for `mark` and `measure` * Time something, shorthant for `mark` and `measure`
...@@ -23,6 +24,7 @@ export function time(name: string): { stop(): void }; ...@@ -23,6 +24,7 @@ export function time(name: string): { stop(): void };
*/ */
export function getEntries(type: 'mark' | 'measure'): PerformanceEntry[]; export function getEntries(type: 'mark' | 'measure'): PerformanceEntry[];
export function getEntry(type: 'mark' | 'measure', name: string): PerformanceEntry;
type ExportData = any[]; type ExportData = any[];
export function importEntries(data: ExportData): void; export function importEntries(data: ExportData): void;
......
...@@ -34,11 +34,11 @@ define([], function () { ...@@ -34,11 +34,11 @@ define([], function () {
return global._performanceEntries.splice(0); return global._performanceEntries.splice(0);
} }
function getEntries(type) { function getEntries(type, name) {
const result = []; const result = [];
const entries = global._performanceEntries; const entries = global._performanceEntries;
for (let i = 0; i < entries.length; i += 4) { for (let i = 0; i < entries.length; i += 4) {
if (entries[i] === type) { if (entries[i] === type && (name === void 0 || entries[i + 1] === name)) {
result.push({ result.push({
type: entries[i], type: entries[i],
name: entries[i + 1], name: entries[i + 1],
...@@ -53,6 +53,20 @@ define([], function () { ...@@ -53,6 +53,20 @@ define([], function () {
}); });
} }
function getEntry(type, name) {
const entries = global._performanceEntries;
for (let i = 0; i < entries.length; i += 4) {
if (entries[i] === type && entries[i + 1] === name) {
return {
type: entries[i],
name: entries[i + 1],
startTime: entries[i + 2],
duration: entries[i + 3],
};
}
}
}
function mark(name) { function mark(name) {
global._performanceEntries.push('mark', name, _now(), 0); global._performanceEntries.push('mark', name, _now(), 0);
if (typeof console.timeStamp === 'function') { if (typeof console.timeStamp === 'function') {
...@@ -103,6 +117,7 @@ define([], function () { ...@@ -103,6 +117,7 @@ define([], function () {
measure: measure, measure: measure,
time: time, time: time,
getEntries: getEntries, getEntries: getEntries,
getEntry: getEntry,
importEntries: importEntries, importEntries: importEntries,
exportEntries: exportEntries exportEntries: exportEntries
}; };
......
...@@ -171,13 +171,12 @@ function main() { ...@@ -171,13 +171,12 @@ function main() {
} }
// Perf Counters // Perf Counters
const timers = window.MonacoEnvironment.timers = { window.MonacoEnvironment.timers = {
isInitialStartup: !!configuration.isInitialStartup, isInitialStartup: !!configuration.isInitialStartup,
hasAccessibilitySupport: !!configuration.accessibilitySupport, hasAccessibilitySupport: !!configuration.accessibilitySupport,
start: configuration.perfStartTime, start: configuration.perfStartTime,
appReady: configuration.perfAppReady, appReady: configuration.perfAppReady,
windowLoad: configuration.perfWindowLoadTime, windowLoad: configuration.perfWindowLoadTime
beforeLoadWorkbenchMain: Date.now()
}; };
const workbenchMainClock = perf.time('loadWorkbenchMain'); const workbenchMainClock = perf.time('loadWorkbenchMain');
...@@ -187,7 +186,6 @@ function main() { ...@@ -187,7 +186,6 @@ function main() {
'vs/css!vs/workbench/workbench.main' 'vs/css!vs/workbench/workbench.main'
], function () { ], function () {
workbenchMainClock.stop(); workbenchMainClock.stop();
timers.afterLoadWorkbenchMain = Date.now();
process.lazyEnv.then(function () { process.lazyEnv.then(function () {
perf.mark('main/startup'); perf.mark('main/startup');
......
...@@ -88,9 +88,6 @@ export interface IInitData { ...@@ -88,9 +88,6 @@ export interface IInitData {
windowLoad: number; windowLoad: number;
beforeLoadWorkbenchMain: number;
afterLoadWorkbenchMain: number;
isInitialStartup: boolean; isInitialStartup: boolean;
hasAccessibilitySupport: boolean; hasAccessibilitySupport: boolean;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import { ITimerService, IStartupMetrics, IInitData, IMemoryInfo } from 'vs/workbench/services/timer/common/timerService'; import { ITimerService, IStartupMetrics, IInitData, IMemoryInfo } from 'vs/workbench/services/timer/common/timerService';
import { virtualMachineHint } from 'vs/base/node/id'; import { virtualMachineHint } from 'vs/base/node/id';
import * as perf from 'vs/base/common/performance';
import * as os from 'os'; import * as os from 'os';
export class TimerService implements ITimerService { export class TimerService implements ITimerService {
...@@ -17,9 +17,6 @@ export class TimerService implements ITimerService { ...@@ -17,9 +17,6 @@ export class TimerService implements ITimerService {
public readonly appReady: number; public readonly appReady: number;
public readonly windowLoad: number; public readonly windowLoad: number;
public readonly beforeLoadWorkbenchMain: number;
public readonly afterLoadWorkbenchMain: number;
public readonly isInitialStartup: boolean; public readonly isInitialStartup: boolean;
public readonly hasAccessibilitySupport: boolean; public readonly hasAccessibilitySupport: boolean;
...@@ -43,9 +40,6 @@ export class TimerService implements ITimerService { ...@@ -43,9 +40,6 @@ export class TimerService implements ITimerService {
this.appReady = initData.appReady; this.appReady = initData.appReady;
this.windowLoad = initData.windowLoad; this.windowLoad = initData.windowLoad;
this.beforeLoadWorkbenchMain = initData.beforeLoadWorkbenchMain;
this.afterLoadWorkbenchMain = initData.afterLoadWorkbenchMain;
this.isInitialStartup = initData.isInitialStartup; this.isInitialStartup = initData.isInitialStartup;
this.hasAccessibilitySupport = initData.hasAccessibilitySupport; this.hasAccessibilitySupport = initData.hasAccessibilitySupport;
} }
...@@ -97,11 +91,11 @@ export class TimerService implements ITimerService { ...@@ -97,11 +91,11 @@ export class TimerService implements ITimerService {
timers: { timers: {
ellapsedExtensions: this.afterExtensionLoad - this.beforeExtensionLoad, ellapsedExtensions: this.afterExtensionLoad - this.beforeExtensionLoad,
ellapsedExtensionsReady: this.afterExtensionLoad - start, ellapsedExtensionsReady: this.afterExtensionLoad - start,
ellapsedRequire: this.afterLoadWorkbenchMain - this.beforeLoadWorkbenchMain, ellapsedRequire: perf.getEntry('measure', 'loadWorkbenchMain').duration,
ellapsedViewletRestore: this.restoreViewletDuration, ellapsedViewletRestore: this.restoreViewletDuration,
ellapsedEditorRestore: this.restoreEditorsDuration, ellapsedEditorRestore: this.restoreEditorsDuration,
ellapsedWorkbench: this.workbenchStarted - this.beforeWorkbenchOpen, ellapsedWorkbench: this.workbenchStarted - this.beforeWorkbenchOpen,
ellapsedWindowLoadToRequire: this.beforeLoadWorkbenchMain - this.windowLoad, ellapsedWindowLoadToRequire: perf.getEntry('mark', 'loadWorkbenchMain/start').startTime - this.windowLoad,
ellapsedTimersToTimersComputed: Date.now() - now ellapsedTimersToTimersComputed: Date.now() - now
}, },
platform, platform,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册