MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / stop

Function stop

packages/core/profiling/index.ts:56–78  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

54}
55
56export function stop(name: string): TimerInfo {
57 const info = timers[name];
58
59 if (!info) {
60 throw new Error(`No timer started: ${name}`);
61 }
62
63 if (info.runCount) {
64 info.runCount--;
65 if (info.runCount) {
66 info.count++;
67 } else {
68 info.lastTime = time() - info.currentStart;
69 info.totalTime += info.lastTime;
70 info.count++;
71 info.currentStart = 0;
72 }
73 } else {
74 throw new Error(`Timer ${name} paused more times than started.`);
75 }
76
77 return info;
78}
79
80export function timer(name: string): TimerInfo {
81 return timers[name];

Callers 7

test_isRunningFunction · 0.90
test_reset_profilesFunction · 0.90
test_start_stopFunction · 0.90
test_start_stop_countFunction · 0.90

Calls 1

timeFunction · 0.50

Tested by

no test coverage detected