Skip to content

Commit

Permalink
Account for ntp time adjustment in wdt stats
Browse files Browse the repository at this point in the history
Summary:
The wdt progress reporting path checks that time spent is non-negative for a given step but the stats collection part doesn't account for it.

The source of the problem might be some other path or issue but checking for time underflow is safe to add in any case.

Differential Revision: D15602928

fbshipit-source-id: 85f283fbd7d197713f14ec955d2b6501ef8c8af7
  • Loading branch information
Nitin Garg authored and facebook-github-bot committed Jun 4, 2019
1 parent 8cb7576 commit 63d1571
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion util/CommonImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ class PerfStatCollector {
~PerfStatCollector() {
if (threadCtx_.getOptions().enable_perf_stat_collection) {
int64_t duration = durationMicros(Clock::now() - startTime_);
threadCtx_.getPerfReport().addPerfStat(statType_, duration);
if (duration >= 0) {
// If time goes back due to clock adjustment, ignore the sample.
threadCtx_.getPerfReport().addPerfStat(statType_, duration);
}
}
}

Expand Down

0 comments on commit 63d1571

Please sign in to comment.