add a debug log message reporting how long PeriodicTasks took

Summary:
Add a debug log message at the end of each PeriodicTask iteration, reporting
how long the task took.

Reviewed By: wez

Differential Revision: D15798504

fbshipit-source-id: 3f33877cb4a9ddb8d966877b005e6d4c60d7dbe0
This commit is contained in:
Adam Simpkins 2019-06-14 18:10:35 -07:00 committed by Facebook Github Bot
parent aa45fa2cb7
commit 69dc2be426

View File

@ -43,6 +43,11 @@ void PeriodicTask::timeoutExpired() noexcept {
// Since these run on the main EventBase thread we want to ensure that they
// don't block this thread for long periods of time.
auto duration = timer.elapsed();
XLOG(DBG6) << "ran periodic task " << name_ << " in "
<< (std::chrono::duration_cast<std::chrono::microseconds>(duration)
.count() /
1000.0)
<< "ms";
if (duration > kSlowTaskLimit) {
// Just in case some task starts frequently running slowly for some reason,
// put some rate limiting on this log message.