github
509 of 563 branches covered (90.41%)
Branch coverage included in aggregate %.
362 of 376 new or added lines in 9 files covered. (96.28%)
2224 of 2323 relevant lines covered (95.74%)
267.45 hits per line
|
import { createHistogram } from 'node:perf_hooks' |
|
|
|
29✔ |
|
class RecordableHistogram {
|
|
|
#histogram = createHistogram()
|
62✔ |
|
|
62✔ |
|
constructor() { |
|
|
Object.keys(this.#histogram.toJSON()) |
62✔ |
|
.filter(prop => typeof prop !== 'object') |
|
|
.forEach(prop => Object.defineProperty(this, prop, {
|
|
|
enumerable: true, |
434✔ |
|
get() { return this.#histogram[prop] } |
|
|
})) |
62✔ |
|
} |
62✔ |
|
|
62✔ |
|
record(value) { |
|
|
return this.#histogram.record(value) |
3,919✔ |
|
} |
3,919✔ |
|
|
62✔ |
|
recordDelta() { |
62✔ |
NEW
|
return this.#histogram.recordDelta() |
× |
NEW
|
} |
× |
|
|
62✔ |
|
reset() { |
62✔ |
NEW
|
return this.#histogram.reset() |
× |
NEW
|
} |
× |
|
|
62✔ |
|
toJSON() { |
|
|
return this.#histogram.toJSON() |
3,919✔ |
|
} |
3,919✔ |
|
} |
62✔ |
|
|
29✔ |
|
export default RecordableHistogram |
29✔ |