mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 22:01:42 +08:00
fix: more rollbacks
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable prefer-rest-params */
|
||||||
declare let __startCPUProfiler: any;
|
declare let __startCPUProfiler: any;
|
||||||
declare let __stopCPUProfiler: any;
|
declare let __stopCPUProfiler: any;
|
||||||
|
|
||||||
@ -98,10 +99,10 @@ export function isRunning(name: string): boolean {
|
|||||||
function countersProfileFunctionFactory<F extends Function>(fn: F, name: string, type: MemberType = MemberType.Instance): F {
|
function countersProfileFunctionFactory<F extends Function>(fn: F, name: string, type: MemberType = MemberType.Instance): F {
|
||||||
profileNames.push(name);
|
profileNames.push(name);
|
||||||
|
|
||||||
return <any>function (...args) {
|
return <any>function () {
|
||||||
start(name);
|
start(name);
|
||||||
try {
|
try {
|
||||||
return fn(...args);
|
return fn.apply(this, arguments);
|
||||||
} finally {
|
} finally {
|
||||||
stop(name);
|
stop(name);
|
||||||
}
|
}
|
||||||
@ -110,19 +111,19 @@ function countersProfileFunctionFactory<F extends Function>(fn: F, name: string,
|
|||||||
|
|
||||||
function timelineProfileFunctionFactory<F extends Function>(fn: F, name: string, type: MemberType = MemberType.Instance): F {
|
function timelineProfileFunctionFactory<F extends Function>(fn: F, name: string, type: MemberType = MemberType.Instance): F {
|
||||||
return type === MemberType.Instance
|
return type === MemberType.Instance
|
||||||
? <any>function (...args) {
|
? <any>function () {
|
||||||
const start = time();
|
const start = time();
|
||||||
try {
|
try {
|
||||||
return fn(...args);
|
return fn.apply(this, arguments);
|
||||||
} finally {
|
} finally {
|
||||||
const end = time();
|
const end = time();
|
||||||
console.log(`Timeline: Modules: ${name} ${this} (${start}ms. - ${end}ms.)`);
|
console.log(`Timeline: Modules: ${name} ${this} (${start}ms. - ${end}ms.)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
: function (...args) {
|
: function () {
|
||||||
const start = time();
|
const start = time();
|
||||||
try {
|
try {
|
||||||
return fn(...args);
|
return fn.apply(this, arguments);
|
||||||
} finally {
|
} finally {
|
||||||
const end = time();
|
const end = time();
|
||||||
console.log(`Timeline: Modules: ${name} (${start}ms. - ${end}ms.)`);
|
console.log(`Timeline: Modules: ${name} (${start}ms. - ${end}ms.)`);
|
||||||
|
Reference in New Issue
Block a user