|
|
@@ -2,7 +2,7 @@
|
|
|
#include "publicFunExport.h"
|
|
|
#include <EventCode.h>
|
|
|
#include "GUIConsole_msg_g.h"
|
|
|
-
|
|
|
+#include <chrono>
|
|
|
|
|
|
bool isPad = false;
|
|
|
|
|
|
@@ -246,8 +246,19 @@ std::pair<DWORD, std::string> CGUIConsoleEntity::openPerformanceSender(SpReqAnsC
|
|
|
dst.cmdlineArr[i] = "";
|
|
|
dst.handleNumArr[i] = curStatus.processList[i].ThreadCount;
|
|
|
}
|
|
|
+ SpSendBroadcast(GetFunction(), eMsg_PerformanceList, eMsgSig_PerformanceList, dst);
|
|
|
+ std::this_thread::sleep_for(std::chrono::seconds(m_performanceSenderFrequence));
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ if (thread_performanceSend != NULL)
|
|
|
+ {
|
|
|
+ LogWarn(SeverityLevelEnum::Severity_Middle, ErrorCodeEnum::Error_AlreadyExist, WARN_GUICONSOLE_PERFORMANCE_EXISTED,
|
|
|
+ "openPerformanceSender, thread_performanceSend already existed");
|
|
|
+ return std::pair<DWORD, std::string>(WARN_GUICONSOLE_PERFORMANCE_EXISTED, "");
|
|
|
+ }
|
|
|
+
|
|
|
+ thread_performanceSend = new std::thread(performanceSender);
|
|
|
|
|
|
return std::pair<DWORD, std::string>(Error_Succeed, "");
|
|
|
}
|
|
|
@@ -255,6 +266,17 @@ std::pair<DWORD, std::string> CGUIConsoleEntity::openPerformanceSender(SpReqAnsC
|
|
|
std::pair<DWORD, std::string> CGUIConsoleEntity::closePerformanceSender()
|
|
|
{
|
|
|
m_isOpenPerformanceSender = false;
|
|
|
+ if(thread_performanceSend == NULL)
|
|
|
+ {
|
|
|
+ LogWarn(SeverityLevelEnum::Severity_Middle, ErrorCodeEnum::Error_NotExist, WARN_GUICONSOLE_PERFORMANCE_NOTEXISTED,
|
|
|
+ "closePerformanceSender, thread_performanceSend not exist");
|
|
|
+ return std::pair<DWORD, std::string>(WARN_GUICONSOLE_PERFORMANCE_NOTEXISTED, "");
|
|
|
+ }
|
|
|
+
|
|
|
+ thread_performanceSend->join();
|
|
|
+ delete thread_performanceSend;
|
|
|
+ thread_performanceSend = NULL;
|
|
|
+
|
|
|
return std::pair<DWORD, std::string>(Error_Succeed, "");
|
|
|
}
|
|
|
|
|
|
@@ -317,12 +339,23 @@ std::pair<DWORD, std::string> CGUIConsoleEntity::VTM_controlEntity(SpReqAnsConte
|
|
|
|
|
|
CGUIConsoleEntity::CGUIConsoleEntity()
|
|
|
:m_isOpenLogSender(false), m_isOpenEntityMonitor(false), m_isOpenPerformanceSender(false),
|
|
|
- m_sendLogType(LogTypeEnum::Log_Warning)
|
|
|
+ m_sendLogType(LogTypeEnum::Log_Warning), thread_performanceSend(NULL)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
CGUIConsoleEntity::~CGUIConsoleEntity()
|
|
|
-{}
|
|
|
+{
|
|
|
+ m_isOpenPerformanceSender = false;
|
|
|
+ m_isOpenEntityMonitor = false;
|
|
|
+ m_isOpenLogSender = false;
|
|
|
+ if (thread_performanceSend)
|
|
|
+ {
|
|
|
+ thread_performanceSend->detach();
|
|
|
+ delete thread_performanceSend;
|
|
|
+ thread_performanceSend = NULL;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
|
|
|
void CGUIConsoleSession::Handle_OpenLogSender(SpReqAnsContext<GUIConsoleService_OpenLogSender_Req, GUIConsoleService_OpenLogSender_Ans>::Pointer ctx)
|
|
|
@@ -587,14 +620,14 @@ std::pair<DWORD, std::string> CGUIConsoleEntity::GetAllEntity(CAutoArray<EntityE
|
|
|
|
|
|
void CGUIConsoleEntity::OnAnswer(CSmartPointer<IAsynWaitSp> pAsynWaitSp)
|
|
|
{
|
|
|
- CSmartPointer<ICallbackListener> spCallback;
|
|
|
- CSmartPointer<IReleasable> pData;
|
|
|
- pAsynWaitSp->GetCallback(spCallback, pData);
|
|
|
- LOG_ASSERT(pData.GetRawPointer() != NULL);
|
|
|
- callback_entry* entry = static_cast<callback_entry*>((IReleasable*)pData.GetRawPointer());
|
|
|
- entry->ErrorResult = pAsynWaitSp->AsyncGetAnswer();
|
|
|
- if(m_isOpenEntityMonitor)
|
|
|
- PostEntityVary(entry->EntityName);//if registered, while entity status changed, send to web
|
|
|
+ CSmartPointer<ICallbackListener> spCallback;
|
|
|
+ CSmartPointer<IReleasable> pData;
|
|
|
+ pAsynWaitSp->GetCallback(spCallback, pData);
|
|
|
+ LOG_ASSERT(pData.GetRawPointer() != NULL);
|
|
|
+ callback_entry* entry = static_cast<callback_entry*>((IReleasable*)pData.GetRawPointer());
|
|
|
+ entry->ErrorResult = pAsynWaitSp->AsyncGetAnswer();
|
|
|
+ if(m_isOpenEntityMonitor)
|
|
|
+ PostEntityVary(entry->EntityName);//if registered, while entity status changed, send to web
|
|
|
}
|
|
|
|
|
|
|