Added Check of Time for main Core Cycle.

* WARNING is printed out & LOGGED if it takes more than 0.2 Seconds to complete.
	-> This happens occasionally, need to watch it. 
	-> This is one of the things that kills connections.
	-> Ideally want to get the cycle down to 0.05 seconds.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4544 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-08-07 22:00:56 +00:00
parent b082362c58
commit c5c088096f

View File

@ -39,11 +39,18 @@
#include "pqi/p3linkmgr.h"
#include "pqi/p3netmgr.h"
int rsserverzone = 101;
#include "util/rsdebug.h"
/****
#define DEBUG_TICK 1
****/
#define WARN_BIG_CYCLE_TIME (0.2)
RsServer::RsServer(RsIface &i, NotifyBase &callback)
:RsControl(i, callback), coreMutex("RsServer")
{
@ -245,6 +252,18 @@ void RsServer::run()
} // end of slow tick.
} // end of only once a second.
double endCycleTs = getCurrentTS();
double cycleTime = endCycleTs - ts;
if (cycleTime > WARN_BIG_CYCLE_TIME)
{
std::ostringstream out;
out << "RsServer::run() WARNING Excessively Long Cycle Time: " << cycleTime;
out << " secs => Please DEBUG";
std::cerr << out.str() << std::endl;
rslog(RSL_ALERT, rsserverzone, out.str());
}
}
return;
}