use high precision timer for server statistics, too
This commit is contained in:
parent
7c13e621ce
commit
4e94893aa0
3 changed files with 7 additions and 6 deletions
|
@ -73,7 +73,7 @@
|
|||
#define DEF_NET_BLOCK_SIZE_FACTOR 3
|
||||
|
||||
// maximum network buffer size (which can be chosen by slider)
|
||||
#define MAX_NET_BUF_SIZE_NUM_BL 10 // number of blocks
|
||||
#define MAX_NET_BUF_SIZE_NUM_BL 12 // number of blocks
|
||||
|
||||
// default network buffer size
|
||||
#define DEF_NET_BUF_SIZE_NUM_BL 6 // number of blocks
|
||||
|
|
|
@ -106,7 +106,7 @@ void CServer::Start()
|
|||
Timer.start ( MIN_BLOCK_DURATION_MS );
|
||||
|
||||
// init time for response time evaluation
|
||||
TimeLastBlock = QTime::currentTime();
|
||||
TimeLastBlock = PreciseTime.elapsed();
|
||||
RespTimeMoAvBuf.Reset();
|
||||
}
|
||||
}
|
||||
|
@ -173,12 +173,12 @@ void CServer::OnTimer()
|
|||
|
||||
// update response time measurement ----------------------------------------
|
||||
// add time difference
|
||||
const QTime CurTime = QTime::currentTime();
|
||||
const int CurTime = PreciseTime.elapsed();
|
||||
|
||||
// we want to calculate the standard deviation (we assume that the mean
|
||||
// is correct at the block period time)
|
||||
const double dCurAddVal = ( (double) TimeLastBlock.msecsTo ( CurTime ) -
|
||||
MIN_BLOCK_DURATION_MS );
|
||||
const double dCurAddVal =
|
||||
( (double) ( CurTime - TimeLastBlock ) - MIN_BLOCK_DURATION_MS );
|
||||
|
||||
RespTimeMoAvBuf.Add ( dCurAddVal * dCurAddVal ); // add squared value
|
||||
|
||||
|
|
|
@ -79,8 +79,9 @@ protected:
|
|||
CSocket Socket;
|
||||
|
||||
// debugging, evaluating
|
||||
CPreciseTime PreciseTime;
|
||||
CMovingAv<double> RespTimeMoAvBuf;
|
||||
QTime TimeLastBlock;
|
||||
int TimeLastBlock;
|
||||
|
||||
// logging
|
||||
CLogging Logging;
|
||||
|
|
Loading…
Reference in a new issue