From 63e1ede1628df2ae0267db24fe558315a5fba8f7 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 9 Aug 2021 11:51:25 -0400 Subject: [PATCH] Also report work queue threads in rpcinfo --- src/httpserver.cpp | 11 +++++++++++ src/httpserver.h | 1 + src/rpc/misc.cpp | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 59b8eeb1d..58cc9ca45 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -162,6 +162,11 @@ public: boost::unique_lock lock(cs); return maxDepth; } + int NumThreads() + { + boost::unique_lock lock(cs); + return numThreads; + } }; struct HTTPPathHandler @@ -196,11 +201,17 @@ int getWorkQueueDepth() { return workQueue->Depth(); } + int getWorkQueueMaxDepth() { return workQueue->MaxDepth(); } +int getWorkQueueNumThreads() +{ + return workQueue->NumThreads(); +} + /** Check if a network address is allowed to access the HTTP server */ static bool ClientAllowed(const CNetAddr& netaddr) { diff --git a/src/httpserver.h b/src/httpserver.h index 7000bd45f..348ccda2b 100644 --- a/src/httpserver.h +++ b/src/httpserver.h @@ -26,6 +26,7 @@ class HTTPRequest; int getWorkQueueDepth(); int getWorkQueueMaxDepth(); +int getWorkQueueNumThreads(); /** Initialize HTTP server. * Call this before RegisterHTTPHandler or EventBase(). diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 37c27831a..02ba41fbc 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -180,6 +180,7 @@ UniValue geterablockheights(const UniValue& params, bool fHelp, const CPubKey& m extern int getWorkQueueDepth(); extern int getWorkQueueMaxDepth(); +extern int getWorkQueueNumThreads(); UniValue rpcinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) { @@ -195,6 +196,7 @@ UniValue rpcinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) result.push_back(Pair("work_queue_depth", depth)); result.push_back(Pair("work_queue_max_depth", getWorkQueueMaxDepth() )); + result.push_back(Pair("work_queue_num_threads", getWorkQueueNumThreads() )); return result; }