StatReport.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. /**
  2. * Tencent is pleased to support the open source community by making Tars available.
  3. *
  4. * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
  5. *
  6. * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
  7. * in compliance with the License. You may obtain a copy of the License at
  8. *
  9. * https://opensource.org/licenses/BSD-3-Clause
  10. *
  11. * Unless required by applicable law or agreed to in writing, software distributed
  12. * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  13. * CONDITIONS OF ANY KIND, either express or implied. See the License for the
  14. * specific language governing permissions and limitations under the License.
  15. */
  16. #include "servant/StatReport.h"
  17. #include "util/tc_common.h"
  18. #include "util/tc_timeprovider.h"
  19. #include "servant/RemoteLogger.h"
  20. #include <iostream>
  21. #if TARGET_PLATFORM_LINUX || TARGET_PLATFORM_IOS
  22. #include <arpa/inet.h>
  23. #endif
  24. #include "servant/Application.h"
  25. #include "servant/Communicator.h"
  26. #include "servant/CommunicatorEpoll.h"
  27. namespace tars
  28. {
  29. //////////////////////////////////////////////////////////////////
  30. //
  31. StatReport::StatReport(Communicator* communicator)
  32. : _communicator(communicator)
  33. , _time(0)
  34. , _reportInterval(60000)
  35. , _reportTimeout(5000)
  36. , _maxReportSize(MAX_REPORT_SIZE)
  37. , _terminate(false)
  38. , _sampleRate(1)
  39. , _maxSampleCount(500)
  40. , _retValueNumLimit(10)
  41. {
  42. srand(time(NULL));
  43. }
  44. StatReport::~StatReport()
  45. {
  46. if (isAlive())
  47. {
  48. terminate();
  49. getThreadControl().join();
  50. }
  51. }
  52. void StatReport::terminate()
  53. {
  54. Lock lock(*this);
  55. _terminate = true;
  56. notifyAll();
  57. }
  58. void StatReport::setReportInfo(const StatFPrx& statPrx,
  59. const PropertyFPrx& propertyPrx,
  60. const string& strModuleName,
  61. const string& strModuleIp,
  62. const string& strSetDivision,
  63. int iReportInterval,
  64. int iSampleRate,
  65. unsigned int iMaxSampleCount,
  66. int iMaxReportSize,
  67. int iReportTimeout)
  68. {
  69. Lock lock(*this);
  70. _statPrx = statPrx;
  71. _propertyPrx = propertyPrx;
  72. //包头信息,trim&substr 防止超长导致udp包发送失败
  73. _moduleName = trimAndLimitStr(strModuleName, MAX_MASTER_NAME_LEN);
  74. _ip = trimAndLimitStr(strModuleIp, MAX_MASTER_IP_LEN);
  75. _time = TNOW;
  76. _reportInterval = iReportInterval < 10000 ? 10000 : iReportInterval;
  77. _reportTimeout = iReportTimeout < 5000 ? 5000 : iReportTimeout;
  78. _sampleRate = (iSampleRate < 1)?1: iSampleRate;
  79. _maxSampleCount = iMaxSampleCount>500?500:iMaxSampleCount;
  80. if ( iMaxReportSize < MIN_REPORT_SIZE || iMaxReportSize > MAX_REPORT_SIZE )
  81. {
  82. _maxReportSize = MAX_REPORT_SIZE;
  83. }
  84. else
  85. {
  86. _maxReportSize = iMaxReportSize;
  87. }
  88. vector<string> vtSetInfo = TC_Common::sepstr<string>(strSetDivision,".");
  89. if (vtSetInfo.size()!=3 ||(vtSetInfo[0]=="*"||vtSetInfo[1]=="*"))
  90. {
  91. _setArea= "";
  92. _setID = "";
  93. }
  94. else
  95. {
  96. _setName = vtSetInfo[0];
  97. _setArea = vtSetInfo[1];
  98. _setID = vtSetInfo[2];
  99. }
  100. //TLOGDEBUG("setReportInfo Division:" << strSetDivision << " " << _setName << " " << _setArea << " " << _setID << endl);
  101. resetStatInterv();
  102. if (!isAlive())
  103. {
  104. start();
  105. }
  106. }
  107. void StatReport::addStatInterv(int iInterv)
  108. {
  109. Lock lock(*this);
  110. _timePoint.push_back(iInterv);
  111. sort(_timePoint.begin(),_timePoint.end());
  112. auto it = unique(_timePoint.begin(),_timePoint.end());
  113. _timePoint.resize(std::distance(_timePoint.begin(),it));
  114. }
  115. void StatReport::getIntervCount(int time, StatMicMsgBody& body)
  116. {
  117. int iTimePoint = 0;
  118. bool bNeedInit = false;
  119. bool bGetIntev = false;
  120. if (body.intervalCount.size() == 0) //第一次需要将所有描点值初始化为0
  121. {
  122. bNeedInit = true;
  123. }
  124. for(int i =0;i<(int)_timePoint.size();i++)
  125. {
  126. iTimePoint = _timePoint[i];
  127. if(bGetIntev == false && time < iTimePoint)
  128. {
  129. bGetIntev = true;
  130. body.intervalCount[iTimePoint]++;
  131. if(bNeedInit == false)
  132. break;
  133. else
  134. continue;
  135. }
  136. if(bNeedInit == true)
  137. {
  138. body.intervalCount[iTimePoint] = 0;
  139. }
  140. }
  141. return;
  142. }
  143. void StatReport::resetStatInterv()
  144. {
  145. _timePoint.clear();
  146. _timePoint.push_back(5);
  147. _timePoint.push_back(10);
  148. _timePoint.push_back(50);
  149. _timePoint.push_back(100);
  150. _timePoint.push_back(200);
  151. _timePoint.push_back(500);
  152. _timePoint.push_back(1000);
  153. _timePoint.push_back(2000);
  154. _timePoint.push_back(3000);
  155. sort(_timePoint.begin(),_timePoint.end());
  156. unique(_timePoint.begin(),_timePoint.end());
  157. }
  158. string StatReport::trimAndLimitStr(const string& str, uint32_t limitlen)
  159. {
  160. static const string strTime = "\r\t";
  161. string ret = TC_Common::trim(str, strTime);
  162. if (ret.length() > limitlen)
  163. {
  164. ret.resize(limitlen);
  165. }
  166. return ret;
  167. }
  168. bool StatReport::divison2SetInfo(const string& str, vector<string>& vtSetInfo)
  169. {
  170. vtSetInfo = TC_Common::sepstr<string>(str,".");
  171. if (vtSetInfo.size() != 3 ||(vtSetInfo[0]=="*"||vtSetInfo[1]=="*"))
  172. {
  173. TLOGERROR(__FUNCTION__ << ":" << __LINE__ << "|bad set name [" << str << endl);
  174. return false;
  175. }
  176. return true;
  177. }
  178. /*
  179. tars.tarsstat to tarsstat
  180. */
  181. string StatReport::getServerName(string sModuleName)
  182. {
  183. string::size_type pos = sModuleName.find(".");
  184. if (pos != string::npos)
  185. {
  186. return sModuleName.substr(pos + 1); //+1:过滤.
  187. }
  188. return sModuleName;
  189. }
  190. void StatReport::report(const string& strModuleName,
  191. const string& setdivision,
  192. const string& strInterfaceName,
  193. const string& strModuleIp,
  194. uint16_t iPort,
  195. StatResult eResult,
  196. int iSptime,
  197. int iReturnValue,
  198. bool bFromClient)
  199. {
  200. //包头信息,trim&substr 防止超长导致udp包发送失败
  201. //masterIp为空服务端自己获取。
  202. StatMicMsgHead head;
  203. StatMicMsgBody body;
  204. string sMaterServerName = "";
  205. string sSlaveServerName = "";
  206. string appName = ""; // 由setdivision生成
  207. if (bFromClient)
  208. {
  209. if (!_setName.empty())
  210. {
  211. head.masterName = _moduleName + "." + _setName + _setArea + _setID + "@" + ClientConfig::TarsVersion;
  212. }
  213. else
  214. {
  215. head.masterName = _moduleName + "@" + ClientConfig::TarsVersion;
  216. }
  217. if (!setdivision.empty()) //被调没有启用set分组,slavename保持原样
  218. {
  219. vector <string> vtSetInfo;
  220. if(divison2SetInfo(setdivision, vtSetInfo))
  221. {
  222. head.slaveSetName = vtSetInfo[0];
  223. head.slaveSetArea = vtSetInfo[1];
  224. head.slaveSetID = vtSetInfo[2];
  225. }
  226. head.slaveName = trimAndLimitStr(strModuleName, MAX_MASTER_NAME_LEN) + "." + head.slaveSetName + head.slaveSetArea + head.slaveSetID;
  227. }
  228. else
  229. {
  230. head.slaveName = trimAndLimitStr(strModuleName, MAX_MASTER_NAME_LEN);
  231. }
  232. head.masterIp = "";
  233. head.slaveIp = trimAndLimitStr(strModuleIp, MAX_MASTER_IP_LEN);
  234. }
  235. else
  236. {
  237. //被调上报,masterName没有set信息
  238. head.masterName = trimAndLimitStr(strModuleName, MAX_MASTER_NAME_LEN);
  239. head.masterIp = trimAndLimitStr(strModuleIp, MAX_MASTER_IP_LEN);
  240. if(_setName.empty()) //被调上报,slave的set信息为空
  241. {
  242. head.slaveName = _moduleName;//服务端version不需要上报
  243. }
  244. else
  245. {
  246. head.slaveName = _moduleName + "." + _setName + _setArea + _setID;
  247. }
  248. head.slaveIp = "";
  249. head.slaveSetName = _setName;
  250. head.slaveSetArea = _setArea;
  251. head.slaveSetID = _setID;
  252. }
  253. head.interfaceName = trimAndLimitStr(strInterfaceName, MAX_MASTER_NAME_LEN);
  254. head.slavePort = iPort;
  255. head.returnValue = iReturnValue;
  256. //包体信息.
  257. if (eResult == STAT_SUCC)
  258. {
  259. body.count = 1;
  260. body.totalRspTime = body.minRspTime = body.maxRspTime = iSptime;
  261. }
  262. else if (eResult == STAT_TIMEOUT)
  263. {
  264. body.timeoutCount = 1;
  265. }
  266. else
  267. {
  268. body.execCount = 1;
  269. }
  270. submit(head, body, bFromClient);
  271. }
  272. void StatReport::report(const string& strMasterName,
  273. const string& strMasterIp,
  274. const string& strSlaveName,
  275. const string& strSlaveIp,
  276. uint16_t iSlavePort,
  277. const string& strInterfaceName,
  278. StatResult eResult,
  279. int iSptime,
  280. int iReturnValue)
  281. {
  282. //包头信息,trim&substr 防止超长导致udp包发送失败
  283. //masterIp为空服务端自己获取。
  284. StatMicMsgHead head;
  285. StatMicMsgBody body;
  286. head.masterName = trimAndLimitStr(strMasterName + "@" + ClientConfig::TarsVersion, MAX_MASTER_NAME_LEN);
  287. head.masterIp = trimAndLimitStr(strMasterIp, MAX_MASTER_IP_LEN);
  288. head.slaveName = trimAndLimitStr(strSlaveName, MAX_MASTER_NAME_LEN);
  289. head.slaveIp = trimAndLimitStr(strSlaveIp, MAX_MASTER_IP_LEN);
  290. head.interfaceName = trimAndLimitStr(strInterfaceName, MAX_MASTER_NAME_LEN);
  291. head.slavePort = iSlavePort;
  292. head.returnValue = iReturnValue;
  293. //包体信息.
  294. if (eResult == STAT_SUCC)
  295. {
  296. body.count = 1;
  297. body.totalRspTime = body.minRspTime = body.maxRspTime = iSptime;
  298. }
  299. else if (eResult == STAT_TIMEOUT)
  300. {
  301. body.timeoutCount = 1;
  302. }
  303. else
  304. {
  305. body.execCount = 1;
  306. }
  307. submit(head, body, true);
  308. }
  309. void StatReport::submit(StatMicMsgHead& head, StatMicMsgBody& body, bool bFromClient)
  310. {
  311. Lock lock(*this);
  312. MapStatMicMsg& msg = (bFromClient == true)?_statMicMsgClient:_statMicMsgServer;
  313. auto it = msg.find( head );
  314. if ( it != msg.end() )
  315. {
  316. StatMicMsgBody& stBody = it->second;
  317. stBody.count += body.count;
  318. stBody.timeoutCount += body.timeoutCount;
  319. stBody.execCount += body.execCount;
  320. stBody.totalRspTime += body.totalRspTime;
  321. if (stBody.maxRspTime < body.maxRspTime)
  322. {
  323. stBody.maxRspTime = body.maxRspTime;
  324. }
  325. //非0最小值
  326. if (stBody.minRspTime == 0 || (stBody.minRspTime > body.minRspTime && body.minRspTime != 0))
  327. {
  328. stBody.minRspTime = body.minRspTime;
  329. }
  330. getIntervCount(body.maxRspTime, stBody);
  331. }
  332. else
  333. {
  334. getIntervCount(body.maxRspTime, body);
  335. msg[head] = body;
  336. }
  337. }
  338. int StatReport::reportMicMsg(MapStatMicMsg& msg, bool bFromClient)
  339. {
  340. if (msg.empty()) return 0;
  341. try
  342. {
  343. int iLen = 0;
  344. MapStatMicMsg mTemp;
  345. MapStatMicMsg mStatMsg;
  346. mStatMsg.clear();
  347. mTemp.clear();
  348. {
  349. Lock lock(*this);
  350. msg.swap(mStatMsg);
  351. }
  352. TLOGTARS("[StatReport::reportMicMsg get size:" << mStatMsg.size()<<"]"<< endl);
  353. for(MapStatMicMsg::iterator it = mStatMsg.begin(); it != mStatMsg.end(); it++)
  354. {
  355. const StatMicMsgHead &head = it->first;
  356. int iTemLen = STAT_PROTOCOL_LEN +head.masterName.length() + head.slaveName.length() + head.interfaceName.length()
  357. + head.slaveSetName.length() + head.slaveSetArea.length() + head.slaveSetID.length();
  358. iLen = iLen + iTemLen;
  359. if(iLen > _maxReportSize) //不能超过udp 1472
  360. {
  361. if(_statPrx)
  362. {
  363. TLOGTARS("[StatReport::reportMicMsg send size:" << mTemp.size()<<"]"<< endl);
  364. _statPrx->tars_set_timeout(_reportTimeout)->async_reportMicMsg(NULL,mTemp,bFromClient, ServerConfig::Context);
  365. }
  366. iLen = iTemLen;
  367. mTemp.clear();
  368. }
  369. mTemp[head] = it->second;
  370. if(LOG->isNeedLog(LocalRollLogger::INFO_LOG))
  371. {
  372. ostringstream os;
  373. os.str("");
  374. head.displaySimple(os);
  375. os << " ";
  376. mTemp[head].displaySimple(os);
  377. TLOGTARS("[StatReport::reportMicMsg display:" << os.str() << "]" << endl);
  378. }
  379. }
  380. if(0 != (int)mTemp.size())
  381. {
  382. if(_statPrx)
  383. {
  384. TLOGTARS("[StatReport::reportMicMsg send size:" << mTemp.size()<<"]"<< endl);
  385. _statPrx->tars_set_timeout(_reportTimeout)->async_reportMicMsg(NULL,mTemp,bFromClient, ServerConfig::Context);
  386. }
  387. }
  388. return 0;
  389. }
  390. catch (exception& e)
  391. {
  392. TLOGERROR("StatReport::report catch exception:" << e.what() << endl);
  393. }
  394. catch ( ... )
  395. {
  396. TLOGERROR("StatReport::report catch unkown exception" << endl);
  397. }
  398. return -1;
  399. }
  400. int StatReport::reportPropMsg()
  401. {
  402. try
  403. {
  404. MapStatPropMsg mStatMsg;
  405. {
  406. Lock lock(*this);
  407. for(map<string, PropertyReportPtr>::iterator it = _statPropMsg.begin(); it != _statPropMsg.end(); ++it)
  408. {
  409. StatPropMsgHead head;
  410. StatPropMsgBody body;
  411. if (!it->second->getMasterName().empty())
  412. {
  413. if (!_setName.empty())
  414. {
  415. head.moduleName = it->second->getMasterName() + "." + _setName + _setArea + _setID;
  416. }
  417. else
  418. {
  419. head.moduleName = it->second->getMasterName();
  420. }
  421. }
  422. else
  423. {
  424. if (!_setName.empty())
  425. {
  426. head.moduleName = _moduleName + "." + _setName + _setArea + _setID;
  427. }
  428. else
  429. {
  430. head.moduleName = _moduleName;
  431. }
  432. }
  433. head.ip = "";
  434. head.propertyName = it->first;
  435. head.setName = _setName;
  436. head.setArea = _setArea;
  437. head.setID = _setID;
  438. head.iPropertyVer = 2;
  439. vector<pair<string, string> > v = it->second->get();
  440. for(size_t i = 0; i < v.size(); i++)
  441. {
  442. // bool bFlag = false;
  443. // if(v[i].first == "Sum")
  444. // {
  445. // if(v[i].second != "0")
  446. // bFlag = true;
  447. // }
  448. // else if(v[i].first == "Avg")
  449. // {
  450. // if(v[i].second != "0")
  451. // bFlag = true;
  452. // }
  453. // else if(v[i].first == "Distr")
  454. // {
  455. // if(v[i].second != "")
  456. // bFlag = true;
  457. // }
  458. // else if(v[i].first == "Max")
  459. // {
  460. // if(v[i].second != "-9999999")
  461. // bFlag = true;
  462. // }
  463. // else if(v[i].first == "Min")
  464. // {
  465. // if(v[i].second != "0")
  466. // bFlag = true;
  467. // }
  468. // else if(v[i].first == "Count")
  469. // {
  470. // if(v[i].second != "0")
  471. // bFlag = true;
  472. // }
  473. // else
  474. // {
  475. // bFlag = true;
  476. // }
  477. // if(bFlag)
  478. {
  479. StatPropInfo sp;
  480. sp.policy = v[i].first;
  481. sp.value = v[i].second;
  482. body.vInfo.push_back(sp);
  483. }
  484. }
  485. mStatMsg[head] = body;
  486. if(LOG->isNeedLog(LocalRollLogger::INFO_LOG))
  487. {
  488. ostringstream os;
  489. os.str("");
  490. head.displaySimple(os);
  491. os << " ";
  492. mStatMsg[head].displaySimple(os);
  493. TLOGTARS("[StatReport::reportPropMsg display:" << os.str() << "]" << endl);
  494. }
  495. }
  496. }
  497. TLOGTARS("[StatReport::reportPropMsg get size:" << mStatMsg.size() << "]" << endl);
  498. int iLen = 0;
  499. MapStatPropMsg mTemp;
  500. for (MapStatPropMsg::iterator it = mStatMsg.begin(); it != mStatMsg.end(); it++)
  501. {
  502. const StatPropMsgHead& head = it->first;
  503. const StatPropMsgBody& body = it->second;
  504. int iTemLen = head.moduleName.length() + head.ip.length() + head.propertyName.length() + head.setName.length() + head.setArea.length() + head.setID.length();
  505. for (size_t i = 0; i < body.vInfo.size(); i++)
  506. {
  507. iTemLen += body.vInfo[i].policy.length();
  508. iTemLen += body.vInfo[i].value.length();
  509. }
  510. iTemLen = PROPERTY_PROTOCOL_LEN + body.vInfo.size(); //
  511. iLen = iLen + iTemLen;
  512. if (iLen > _maxReportSize) //不能超过udp 1472
  513. {
  514. if (_propertyPrx)
  515. {
  516. TLOGTARS("[StatReport::reportPropMsg send size:" << mTemp.size() << "]" << endl);
  517. _propertyPrx->tars_set_timeout(_reportTimeout)->async_reportPropMsg(NULL, mTemp, ServerConfig::Context);
  518. }
  519. iLen = iTemLen;
  520. mTemp.clear();
  521. }
  522. mTemp[it->first] = it->second;
  523. }
  524. if (0 != (int)mTemp.size())
  525. {
  526. if (_propertyPrx)
  527. {
  528. TLOGTARS("[StatReport::reportPropMsg send size:" << mTemp.size() << "]" << endl);
  529. _propertyPrx->tars_set_timeout(_reportTimeout)->async_reportPropMsg(NULL, mTemp, ServerConfig::Context);
  530. }
  531. }
  532. return 0;
  533. }
  534. catch ( exception& e )
  535. {
  536. TLOGERROR("StatReport::reportPropMsg catch exception:" << e.what() << endl);
  537. }
  538. catch ( ... )
  539. {
  540. TLOGERROR("StatReport::reportPropMsg catch unkown exception" << endl);
  541. }
  542. return -1;
  543. }
  544. void StatReport::addMicMsg(MapStatMicMsg& old, MapStatMicMsg& add)
  545. {
  546. auto iter = add.begin();
  547. for (; iter != add.end(); ++iter)
  548. {
  549. auto iterOld = old.find(iter->first);
  550. if (iterOld == old.end())
  551. {
  552. //直接insert
  553. old.insert(make_pair(iter->first, iter->second));
  554. }
  555. else
  556. {
  557. //合并
  558. iterOld->second.count += iter->second.count;
  559. iterOld->second.timeoutCount += iter->second.timeoutCount;
  560. iterOld->second.execCount += iter->second.execCount;
  561. map<int, int>::iterator iterOldInt, iterInt;
  562. map<int, int>& mCount = iter->second.intervalCount;
  563. map<int, int>& mCountOld = iterOld->second.intervalCount;
  564. iterInt = mCount.begin();
  565. for (; iterInt != mCount.end(); ++iterInt)
  566. {
  567. iterOldInt = mCountOld.find(iterInt->first);
  568. if (iterOldInt == mCountOld.end())
  569. {
  570. mCountOld.insert(make_pair(iterInt->first, iterInt->second));
  571. }
  572. else
  573. {
  574. iterOldInt->second += iterInt->second;
  575. }
  576. }
  577. iterOld->second.totalRspTime += iter->second.totalRspTime;
  578. if(iterOld->second.maxRspTime < iter->second.maxRspTime)
  579. iterOld->second.maxRspTime = iter->second.maxRspTime;
  580. if(iterOld->second.minRspTime > iter->second.minRspTime)
  581. iterOld->second.minRspTime = iter->second.minRspTime;
  582. }
  583. }
  584. }
  585. void StatReport::run()
  586. {
  587. while(!_terminate)
  588. {
  589. {
  590. Lock lock(*this);
  591. timedWait(1000);
  592. }
  593. try
  594. {
  595. time_t tNow = TNOW;
  596. if(tNow - _time >= _reportInterval/1000)
  597. {
  598. reportMicMsg(_statMicMsgClient, true);
  599. reportMicMsg(_statMicMsgServer, false);
  600. MapStatMicMsg mStatMsg;
  601. auto communicatorEpolls = _communicator->getAllCommunicatorEpoll();
  602. for(auto ce : communicatorEpolls)
  603. {
  604. MapStatMicMsg * pStatMsg;
  605. while(ce->popStatMsg(pStatMsg))
  606. {
  607. addMicMsg(mStatMsg,*pStatMsg);
  608. delete pStatMsg;
  609. }
  610. }
  611. reportMicMsg(mStatMsg, true);
  612. reportPropMsg();
  613. // reportSampleMsg();
  614. _time = tNow;
  615. }
  616. }
  617. catch ( exception& e )
  618. {
  619. TLOGERROR("StatReport::run catch exception:" << e.what() << endl);
  620. }
  621. catch ( ... )
  622. {
  623. TLOGERROR("StatReport::run catch unkown exception" << endl);
  624. }
  625. }
  626. ServantProxyThreadData::g_sp.reset();
  627. }
  628. ////////////////////////////////////////////////////////////////
  629. }