mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 16:14:09 +02:00
parent
a8209c1a1a
commit
ff57b0ccd6
@ -574,6 +574,7 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes)
|
|||||||
unsigned long restored = 0;
|
unsigned long restored = 0;
|
||||||
|
|
||||||
WorkQueue upq(25000, Application::GetConcurrency());
|
WorkQueue upq(25000, Application::GetConcurrency());
|
||||||
|
upq.SetName("ConfigObject::RestoreObjects");
|
||||||
|
|
||||||
String message;
|
String message;
|
||||||
StreamReadContext src;
|
StreamReadContext src;
|
||||||
|
@ -49,6 +49,16 @@ WorkQueue::~WorkQueue(void)
|
|||||||
Join(true);
|
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
|
* 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
|
* they were enqueued in except if there is more than one worker thread or when
|
||||||
@ -177,8 +187,14 @@ void WorkQueue::StatusTimerHandler(void)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
Log(LogNotice, "WorkQueue")
|
Log log(LogNotice, "WorkQueue");
|
||||||
<< "#" << m_ID << " tasks: " << m_Tasks.size();
|
|
||||||
|
log << "#" << m_ID;
|
||||||
|
|
||||||
|
if (!m_Name.IsEmpty())
|
||||||
|
log << " (" << m_Name << ")";
|
||||||
|
|
||||||
|
log << " tasks: " << m_Tasks.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkQueue::WorkerThreadProc(void)
|
void WorkQueue::WorkerThreadProc(void)
|
||||||
|
@ -83,6 +83,9 @@ public:
|
|||||||
WorkQueue(size_t maxItems = 0, int threadCount = 1);
|
WorkQueue(size_t maxItems = 0, int threadCount = 1);
|
||||||
~WorkQueue(void);
|
~WorkQueue(void);
|
||||||
|
|
||||||
|
void SetName(const String& name);
|
||||||
|
String GetName(void) const;
|
||||||
|
|
||||||
void Enqueue(const boost::function<void (void)>& function, WorkQueuePriority priority = PriorityNormal,
|
void Enqueue(const boost::function<void (void)>& function, WorkQueuePriority priority = PriorityNormal,
|
||||||
bool allowInterleaved = false);
|
bool allowInterleaved = false);
|
||||||
void Join(bool stop = false);
|
void Join(bool stop = false);
|
||||||
@ -99,6 +102,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int m_ID;
|
int m_ID;
|
||||||
|
String m_Name;
|
||||||
static int m_NextID;
|
static int m_NextID;
|
||||||
int m_ThreadCount;
|
int m_ThreadCount;
|
||||||
bool m_Spawned;
|
bool m_Spawned;
|
||||||
|
@ -625,6 +625,8 @@ bool ConfigItem::RunWithActivationContext(const Function::Ptr& function)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WorkQueue upq(25000, Application::GetConcurrency());
|
WorkQueue upq(25000, Application::GetConcurrency());
|
||||||
|
upq.SetName("ConfigItem::RunWithActivationContext");
|
||||||
|
|
||||||
std::vector<ConfigItem::Ptr> newItems;
|
std::vector<ConfigItem::Ptr> newItems;
|
||||||
|
|
||||||
if (!CommitItems(scope.GetContext(), upq, newItems))
|
if (!CommitItems(scope.GetContext(), upq, newItems))
|
||||||
|
@ -42,6 +42,11 @@ IdoMysqlConnection::IdoMysqlConnection(void)
|
|||||||
: m_QueryQueue(1000000)
|
: m_QueryQueue(1000000)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
void IdoMysqlConnection::OnConfigLoaded(void)
|
||||||
|
{
|
||||||
|
m_QueryQueue.SetName("IdoMysqlConnection, " + GetName());
|
||||||
|
}
|
||||||
|
|
||||||
void IdoMysqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
void IdoMysqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
@ -57,6 +57,7 @@ public:
|
|||||||
virtual int GetPendingQueryCount(void) const override;
|
virtual int GetPendingQueryCount(void) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void OnConfigLoaded(void) override;
|
||||||
virtual void Resume(void) override;
|
virtual void Resume(void) override;
|
||||||
virtual void Pause(void) override;
|
virtual void Pause(void) override;
|
||||||
|
|
||||||
|
@ -42,7 +42,14 @@ REGISTER_STATSFUNCTION(IdoPgsqlConnection, &IdoPgsqlConnection::StatsFunc);
|
|||||||
|
|
||||||
IdoPgsqlConnection::IdoPgsqlConnection(void)
|
IdoPgsqlConnection::IdoPgsqlConnection(void)
|
||||||
: m_QueryQueue(1000000)
|
: 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)
|
void IdoPgsqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
virtual int GetPendingQueryCount(void) const override;
|
virtual int GetPendingQueryCount(void) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void OnConfigLoaded(void) override;
|
||||||
virtual void Resume(void) override;
|
virtual void Resume(void) override;
|
||||||
virtual void Pause(void) override;
|
virtual void Pause(void) override;
|
||||||
|
|
||||||
|
@ -49,7 +49,10 @@ REGISTER_APIFUNCTION(Hello, icinga, &ApiListener::HelloAPIHandler);
|
|||||||
|
|
||||||
ApiListener::ApiListener(void)
|
ApiListener::ApiListener(void)
|
||||||
: m_SyncQueue(0, 4), m_LogMessageCount(0)
|
: m_SyncQueue(0, 4), m_LogMessageCount(0)
|
||||||
{ }
|
{
|
||||||
|
m_RelayQueue.SetName("ApiListener, RelayQueue");
|
||||||
|
m_SyncQueue.SetName("ApiListener, SyncQueue");
|
||||||
|
}
|
||||||
|
|
||||||
void ApiListener::OnConfigLoaded(void)
|
void ApiListener::OnConfigLoaded(void)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,8 @@ HttpServerConnection::HttpServerConnection(const String& identity, bool authenti
|
|||||||
{
|
{
|
||||||
boost::call_once(l_HttpServerConnectionOnceFlag, &HttpServerConnection::StaticInitialize);
|
boost::call_once(l_HttpServerConnectionOnceFlag, &HttpServerConnection::StaticInitialize);
|
||||||
|
|
||||||
|
m_RequestQueue.SetName("HttpServerConnection");
|
||||||
|
|
||||||
if (authenticated)
|
if (authenticated)
|
||||||
m_ApiUser = ApiUser::GetByClientCN(identity);
|
m_ApiUser = ApiUser::GetByClientCN(identity);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
|
#include "base/convert.hpp"
|
||||||
#include <boost/thread/once.hpp>
|
#include <boost/thread/once.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -62,6 +63,10 @@ void JsonRpcConnection::StaticInitialize(void)
|
|||||||
|
|
||||||
l_JsonRpcConnectionWorkQueueCount = Application::GetConcurrency();
|
l_JsonRpcConnectionWorkQueueCount = Application::GetConcurrency();
|
||||||
l_JsonRpcConnectionWorkQueues = new WorkQueue[l_JsonRpcConnectionWorkQueueCount];
|
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)
|
void JsonRpcConnection::Start(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user