Skip to content

Commit

Permalink
perf_hooks: reset prev_ before starting ELD timer
Browse files Browse the repository at this point in the history
reset `ELDHistogram.prev_` before staring timer to ensure that start
timer doesn't leak across `disable()` `enable()` calls.

PR-URL: #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>
  • Loading branch information
Flarna authored and ZYSzys committed Mar 20, 2019
1 parent 78162ad commit 614a747
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/node_perf.cc
Expand Up @@ -539,6 +539,7 @@ bool ELDHistogram::RecordDelta() {
bool ELDHistogram::Enable() { bool ELDHistogram::Enable() {
if (enabled_) return false; if (enabled_) return false;
enabled_ = true; enabled_ = true;
prev_ = 0;
uv_timer_start(timer_, uv_timer_start(timer_,
ELDHistogramDelayInterval, ELDHistogramDelayInterval,
resolution_, resolution_,
Expand Down

0 comments on commit 614a747

Please sign in to comment.