MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / measure

Function measure

src/measure-performance.ts:30–38  ·  view source on GitHub ↗

* Adds a performance measurement with the specified name. * * @param measureName The name of the performance measurement. * @param startMarkName The name of the starting mark * @param endMarkName The name of the ending mark

(measureName: string, startMarkName: string, endMarkName: string)

Source from the content-addressed store, hash-verified

28 * @param endMarkName The name of the ending mark
29 */
30function measure(measureName: string, startMarkName: string, endMarkName: string) {
31 if (enabled) {
32 const end = marks.get(endMarkName) ?? timestamp();
33 const start = marks.get(startMarkName) ?? performance.timeOrigin;
34 const previousDuration = durations.get(measureName) ?? 0;
35 durations.set(measureName, previousDuration + (end - start));
36 performance.measure(measureName, startMarkName, endMarkName);
37 }
38}
39
40/**
41 * Starts a performance measurement section.

Callers 1

endSectionFunction · 0.85

Calls 3

timestampFunction · 0.85
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected