diff --git a/eden/common/utils/UnboundedQueueExecutor.cpp b/eden/common/utils/UnboundedQueueExecutor.cpp index 0bba0bf8..66c91478 100644 --- a/eden/common/utils/UnboundedQueueExecutor.cpp +++ b/eden/common/utils/UnboundedQueueExecutor.cpp @@ -27,4 +27,14 @@ UnboundedQueueExecutor::UnboundedQueueExecutor( std::shared_ptr executor) : executor_{std::move(executor)} {} +size_t UnboundedQueueExecutor::getTaskQueueSize() const { + if (auto ex = + std::dynamic_pointer_cast(executor_)) { + return ex->getTaskQueueSize(); + } + // manual executor does not expose a way to count the number of pending + // tasks. + return 0; +} + } // namespace facebook::eden diff --git a/eden/common/utils/UnboundedQueueExecutor.h b/eden/common/utils/UnboundedQueueExecutor.h index c1ac3f6b..d1c1b5db 100644 --- a/eden/common/utils/UnboundedQueueExecutor.h +++ b/eden/common/utils/UnboundedQueueExecutor.h @@ -50,6 +50,8 @@ class UnboundedQueueExecutor : public folly::Executor { executor_->add(std::move(func)); } + size_t getTaskQueueSize() const; + private: std::shared_ptr executor_; };