github
509 of 563 branches covered (90.41%)
Branch coverage included in aggregate %.
356 of 370 new or added lines in 9 files covered. (96.22%)
2225 of 2324 relevant lines covered (95.74%)
272.24 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) |
4,004✔ |
|
} |
4,004✔ |
|
|
62✔ |
|
recordDelta() { |
62✔ |
NEW
|
return this.#histogram.recordDelta() |
× |
NEW
|
} |
× |
|
|
62✔ |
|
reset() { |
62✔ |
NEW
|
return this.#histogram.reset() |
× |
NEW
|
} |
× |
|
|
62✔ |
|
toJSON() { |
|
|
return this.#histogram.toJSON() |
4,004✔ |
|
} |
4,004✔ |
|
} |
62✔ |
|
|
29✔ |
|
export default RecordableHistogram |
29✔ |