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