github
508 of 561 branches covered (90.55%)
Branch coverage included in aggregate %.
356 of 370 new or added lines in 9 files covered. (96.22%)
2218 of 2317 relevant lines covered (95.73%)
264.25 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,867✔ |
|
} |
3,867✔ |
|
|
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,867✔ |
|
} |
3,867✔ |
|
} |
62✔ |
|
|
29✔ |
|
export default RecordableHistogram |
29✔ |