private NetConnectionStatistics GetCurrentWindow(double now) { if (m_currentWindow == null) { return(null); } if (now - m_currentWindow.m_startTimestamp >= m_windowSize) { // close this window and open new (actually, flip and reset) NetConnectionStatistics tmp = m_previousWindow; m_previousWindow = m_currentWindow; m_previousWindow.m_totalTimeSpan = (float)(now - m_previousWindow.m_startTimestamp); m_currentWindow = tmp; m_currentWindow.Reset(now); } return(m_currentWindow); }
private void Reset(double now) { m_startTimestamp = now; m_messagesSent = 0; m_messagesReceived = 0; m_packetsSent = 0; m_packetsReceived = 0; m_bytesSent = 0; m_bytesReceived = 0; m_userMessagesSent = 0; m_userMessagesReceived = 0; m_userBytesSent = 0; m_userBytesReceived = 0; m_acksSent = 0; if (m_currentWindow != null) { m_currentWindow.Reset(); } if (m_previousWindow != null) { m_previousWindow.Reset(); } }
private NetConnectionStatistics GetCurrentWindow(double now) { if (m_currentWindow == null) return null; if (now - m_currentWindow.m_startTimestamp >= m_windowSize) { // close this window and open new (actually, flip and reset) NetConnectionStatistics tmp = m_previousWindow; m_previousWindow = m_currentWindow; m_previousWindow.m_totalTimeSpan = (float)(now - m_previousWindow.m_startTimestamp); m_currentWindow = tmp; m_currentWindow.Reset(now); } return m_currentWindow; }