perf_hooks: reset prev_ before starting ELD timer

reset `ELDHistogram.prev_` before staring timer to ensure that start
timer doesn't leak across `disable()` `enable()` calls.

PR-URL: https://github.com/nodejs/node/pull/26693
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
Gerhard Stoebich 2019-03-15 21:03:18 +01:00 committed by ZYSzys
parent 78162ad570
commit 614a7474ab

View File

@ -539,6 +539,7 @@ bool ELDHistogram::RecordDelta() {
bool ELDHistogram::Enable() {
if (enabled_) return false;
enabled_ = true;
prev_ = 0;
uv_timer_start(timer_,
ELDHistogramDelayInterval,
resolution_,