unsigned long restored = 0;
WorkQueue upq(25000, Application::GetConcurrency());
+ upq.SetName("ConfigObject::RestoreObjects");
String message;
StreamReadContext src;
Join(true);
}
+void WorkQueue::SetName(const String& name)
+{
+ m_Name = name;
+}
+
+String WorkQueue::GetName(void) const
+{
+ return m_Name;
+}
+
/**
* Enqueues a task. Tasks are guaranteed to be executed in the order
* they were enqueued in except if there is more than one worker thread or when
{
boost::mutex::scoped_lock lock(m_Mutex);
- Log(LogNotice, "WorkQueue")
- << "#" << m_ID << " tasks: " << m_Tasks.size();
+ Log log(LogNotice, "WorkQueue");
+
+ log << "#" << m_ID;
+
+ if (!m_Name.IsEmpty())
+ log << " (" << m_Name << ")";
+
+ log << " tasks: " << m_Tasks.size();
}
void WorkQueue::WorkerThreadProc(void)
WorkQueue(size_t maxItems = 0, int threadCount = 1);
~WorkQueue(void);
+ void SetName(const String& name);
+ String GetName(void) const;
+
void Enqueue(const boost::function<void (void)>& function, WorkQueuePriority priority = PriorityNormal,
bool allowInterleaved = false);
void Join(bool stop = false);
private:
int m_ID;
+ String m_Name;
static int m_NextID;
int m_ThreadCount;
bool m_Spawned;
}
WorkQueue upq(25000, Application::GetConcurrency());
+ upq.SetName("ConfigItem::RunWithActivationContext");
+
std::vector<ConfigItem::Ptr> newItems;
if (!CommitItems(scope.GetContext(), upq, newItems))
: m_QueryQueue(1000000)
{ }
+void IdoMysqlConnection::OnConfigLoaded(void)
+{
+ m_QueryQueue.SetName("IdoMysqlConnection, " + GetName());
+}
+
void IdoMysqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
{
Dictionary::Ptr nodes = new Dictionary();
virtual int GetPendingQueryCount(void) const override;
protected:
+ virtual void OnConfigLoaded(void) override;
virtual void Resume(void) override;
virtual void Pause(void) override;
IdoPgsqlConnection::IdoPgsqlConnection(void)
: m_QueryQueue(1000000)
-{ }
+{
+ m_QueryQueue.SetName("IdoPgsqlConnection, " + GetName());
+}
+
+void IdoPgsqlConnection::OnConfigLoaded(void)
+{
+ m_QueryQueue.SetName("IdoPgsqlConnection, " + GetName());
+}
void IdoPgsqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
{
virtual int GetPendingQueryCount(void) const override;
protected:
+ virtual void OnConfigLoaded(void) override;
virtual void Resume(void) override;
virtual void Pause(void) override;
ApiListener::ApiListener(void)
: m_SyncQueue(0, 4), m_LogMessageCount(0)
-{ }
+{
+ m_RelayQueue.SetName("ApiListener, RelayQueue");
+ m_SyncQueue.SetName("ApiListener, SyncQueue");
+}
void ApiListener::OnConfigLoaded(void)
{
{
boost::call_once(l_HttpServerConnectionOnceFlag, &HttpServerConnection::StaticInitialize);
+ m_RequestQueue.SetName("HttpServerConnection");
+
if (authenticated)
m_ApiUser = ApiUser::GetByClientCN(identity);
}
#include "base/utility.hpp"
#include "base/logger.hpp"
#include "base/exception.hpp"
+#include "base/convert.hpp"
#include <boost/thread/once.hpp>
using namespace icinga;
l_JsonRpcConnectionWorkQueueCount = Application::GetConcurrency();
l_JsonRpcConnectionWorkQueues = new WorkQueue[l_JsonRpcConnectionWorkQueueCount];
+
+ for (int i = 0; i < l_JsonRpcConnectionWorkQueueCount; i++) {
+ l_JsonRpcConnectionWorkQueues[i].SetName("JsonRpcConnection, #" + Convert::ToString(i));
+ }
}
void JsonRpcConnection::Start(void)