github
505 of 559 branches covered (90.34%)
Branch coverage included in aggregate %.
27 of 28 new or added lines in 7 files covered. (96.43%)
2 existing lines in 1 file now uncovered.2212 of 2312 relevant lines covered (95.67%)
398.12 hits per line
1 |
import { createHistogram } from 'node:perf_hooks' |
|
2 |
|
31✔ |
3 |
class RecordableHistogram {
|
|
4 |
#histogram = createHistogram()
|
86✔ |
5 |
|
86✔ |
6 |
constructor() { |
|
7 |
Object.keys(this.#histogram.toJSON()) |
86✔ |
8 |
.filter(prop => typeof prop !== 'object') |
|
9 |
.forEach(prop => Object.defineProperty(this, prop, {
|
|
10 |
enumerable: true, |
602✔ |
11 |
get() { return this.#histogram[prop] } |
|
12 |
})) |
86✔ |
13 |
} |
86✔ |
14 |
|
86✔ |
15 |
record(value) { |
|
16 |
return this.#histogram.record(value) |
5,893✔ |
17 |
} |
5,893✔ |
18 |
|
86✔ |
19 |
recordDelta() { |
86✔ |
20 |
return this.#histogram.recordDelta() |
× |
21 |
} |
× |
22 |
|
86✔ |
23 |
reset() { |
86✔ |
24 |
return this.#histogram.reset() |
× |
25 |
} |
× |
26 |
|
86✔ |
27 |
toJSON() { |
|
28 |
return this.#histogram.toJSON() |
5,893✔ |
29 |
} |
5,893✔ |
30 |
} |
86✔ |
31 |
|
31✔ |
32 |
export default RecordableHistogram |
31✔ |