MCPcopy Create free account
hub / github.com/DavidWells/analytics / Timer

Class Timer

packages/analytics-util-queue/tests/main.test.js:182–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182class Timer {
183 constructor(name = 'Benchmark') {
184 this.NS_PER_SEC = 1e9
185 this.MS_PER_NS = 1e-6
186 this.name = name
187 this.startTime = process.hrtime()
188 }
189 runtimeMs() {
190 const diff = process.hrtime(this.startTime)
191 return (diff[0] * this.NS_PER_SEC + diff[1]) * this.MS_PER_NS
192 }
193}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected