mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Profiling tests stability (#4379)
This commit is contained in:

committed by
GitHub

parent
1d20845b7c
commit
ab5da0a4a9
@ -51,7 +51,7 @@ function retry(count: number, action: () => void) {
|
|||||||
try {
|
try {
|
||||||
action();
|
action();
|
||||||
return;
|
return;
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
if (i === count) {
|
if (i === count) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@ -101,21 +101,18 @@ export function test_isRunning_withReentrancy() {
|
|||||||
|
|
||||||
export function test_start_stop() {
|
export function test_start_stop() {
|
||||||
resetProfiles();
|
resetProfiles();
|
||||||
retry(5, () => {
|
const name = "test_start_stop";
|
||||||
const name = "test_start_stop";
|
|
||||||
|
|
||||||
start(name);
|
start(name);
|
||||||
stop(name);
|
stop(name);
|
||||||
const res = timer(name);
|
const res = timer(name);
|
||||||
|
|
||||||
assertEqual(res.count, 1);
|
assertEqual(res.count, 1);
|
||||||
assert(res.totalTime <= 1);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function test_start_pause_count() {
|
export function test_start_stop_count() {
|
||||||
resetProfiles();
|
resetProfiles();
|
||||||
const name = "test_start_pause_count";
|
const name = "test_start_stop_count";
|
||||||
|
|
||||||
for (var i = 0; i < 10; i++) {
|
for (var i = 0; i < 10; i++) {
|
||||||
start(name);
|
start(name);
|
||||||
@ -152,11 +149,11 @@ export function test_profile_decorator_handles_exceptions() {
|
|||||||
assertEqual(timer("__func_decorator_error__").count, 1, "Timer should be called once");
|
assertEqual(timer("__func_decorator_error__").count, 1, "Timer should be called once");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_start_pause_performance() {
|
export function test_start_stop_performance() {
|
||||||
resetProfiles();
|
resetProfiles();
|
||||||
retry(5, () => {
|
retry(5, () => {
|
||||||
const count = 10000;
|
const count = 10000;
|
||||||
const name = "test_start_pause_performance";
|
const name = "test_start_stop_performance";
|
||||||
|
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
start(name);
|
start(name);
|
||||||
|
Reference in New Issue
Block a user