diff --git a/eden/common/utils/UnboundedQueueExecutor.cpp b/eden/common/utils/UnboundedQueueExecutor.cpp index 66c9147..454280e 100644 --- a/eden/common/utils/UnboundedQueueExecutor.cpp +++ b/eden/common/utils/UnboundedQueueExecutor.cpp @@ -12,16 +12,37 @@ #include #include +#include "eden/common/eden-config.h" + +#ifdef EDEN_COMMON_HAVE_SERVER_OBSERVER +#include "common/fb303/cpp/ThreadPoolExecutorCounters.h" // @manual +#endif + namespace facebook::eden { -UnboundedQueueExecutor::UnboundedQueueExecutor( +namespace { + +std::unique_ptr makeExecutor( size_t threadCount, - folly::StringPiece threadNamePrefix) - : executor_{std::make_unique( + folly::StringPiece threadNamePrefix) { + std::unique_ptr executor = + std::make_unique( threadCount, std::make_unique>(), - std::make_unique(threadNamePrefix))} {} + std::make_unique(threadNamePrefix)); +#ifdef EDEN_COMMON_HAVE_SERVER_OBSERVER + facebook::fb303::installThreadPoolExecutorCounters("", *executor); +#endif + return executor; +} + +} // namespace + +UnboundedQueueExecutor::UnboundedQueueExecutor( + size_t threadCount, + folly::StringPiece threadNamePrefix) + : executor_{makeExecutor(threadCount, threadNamePrefix)} {} UnboundedQueueExecutor::UnboundedQueueExecutor( std::shared_ptr executor)