fix(profiling): resetProfiles doesn't reset all profiles (#5425)

This commit is contained in:
Martin Yankov
2018-02-19 13:18:50 +02:00
committed by GitHub
parent 714af6bb02
commit 68d86fb6c6
2 changed files with 20 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import { assert, assertEqual, assertFalse, assertTrue, assertThrows } from "../TKUnit"; import { assert, assertEqual, assertFalse, assertNull, assertTrue, assertThrows } from "../TKUnit";
import { enable, disable, profile, time, start, stop, timer, isRunning, resetProfiles } from "tns-core-modules/profiling"; import { enable, disable, profile, time, start, stop, timer, isRunning, resetProfiles } from "tns-core-modules/profiling";
enable(); enable();
@ -99,6 +99,19 @@ export function test_isRunning_withReentrancy() {
assertFalse(isRunning(name), "isRunning should be false after second stop"); assertFalse(isRunning(name), "isRunning should be false after second stop");
} }
export function test_reset_profiles() {
resetProfiles();
const name = "test_reset_profiles";
start(name);
stop(name);
resetProfiles();
const res = timer(name);
assertNull(res);
}
export function test_start_stop() { export function test_start_stop() {
resetProfiles(); resetProfiles();
const name = "test_start_stop"; const name = "test_start_stop";

View File

@ -46,6 +46,7 @@ export function start(name: string): void {
runCount: 1 runCount: 1
}; };
timers[name] = info; timers[name] = info;
profileNames.push(name);
} }
} }