Commit 2bac0f77 authored by Elvin Sindrilaru's avatar Elvin Sindrilaru

COMMON: Add method to display thread pool info

parent 7796b2ff
Pipeline #467773 passed with stages
in 46 minutes and 2 seconds
......@@ -16,7 +16,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* A *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
************************************************************************/
......
......@@ -24,8 +24,8 @@
#pragma once
#include "common/Namespace.hh"
#include "common/ConcurrentQueue.hh"
#include "common/Logging.hh"
#include <future>
#include <sstream>
#ifdef __APPLE__
#include <cmath>
......@@ -99,9 +99,6 @@ public:
while (true)
{
eos_static_debug("id=%s, queue_size=%llu, thread_pool_size=%llu",
mId.c_str(), mTasks.size(), mThreadPool.size());
if (signalFuture.valid()) {
if (signalFuture.wait_for(std::chrono::seconds(samplingInterval)) ==
std::future_status::ready) {
......@@ -227,6 +224,17 @@ public:
Stop();
}
//----------------------------------------------------------------------------
//! Get thread pool information
//----------------------------------------------------------------------------
std::string GetInfo()
{
std::ostringstream oss;
oss << "id=" << mId << ", queue_size=" << mTasks.size()
<< ",thread_pool_size=" << mThreadPool.size();
return oss.str();
}
// Disable copy/move constructors and assignment operators
ThreadPool(const ThreadPool&) = delete;
ThreadPool(ThreadPool&&) = delete;
......
......@@ -153,6 +153,10 @@ IProcCommand::LaunchJob()
([this]() -> eos::console::ReplyProto {
return ProcessRequest();
});
if (EOS_LOGS_DEBUG) {
eos_debug("%s", ProcInterface::sProcThreads.GetInfo().c_str());
}
} else {
std::promise<eos::console::ReplyProto> promise;
mFuture = promise.get_future();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment