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

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

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