コード例 #1
0
        private TcpStats AnalyzeConnections(ConnectionData[] connections, TimeSpan measurePeriod)
        {
            _receivedSinceLastRun     = 0;
            _sentSinceLastRun         = 0;
            _pendingSendOnLastRun     = 0;
            _inSendOnLastRun          = 0;
            _pendingReceivedOnLastRun = 0;
            _anySendBlockedOnLastRun  = false;

            foreach (var connection in connections)
            {
                AnalyzeConnection(connection);
            }

            var stats = new TcpStats(connections.Length,
                                     _sentTotal,
                                     _receivedTotal,
                                     _sentSinceLastRun,
                                     _receivedSinceLastRun,
                                     _pendingSendOnLastRun,
                                     _inSendOnLastRun,
                                     _pendingReceivedOnLastRun,
                                     measurePeriod);


            Log.Debug("# Total connections: {0,3}. Out: {1:8}  In: {2:8}  Pending Send: {3}  " +
                      "In Send: {4}  Pending Received: {5} Measure Time: {6}",
                      stats.Connections,
                      stats.SendingSpeed,
                      stats.ReceivingSpeed,
                      stats.PendingSend,
                      stats.InSend,
                      stats.PendingSend,
                      stats.MeasureTimeFriendly);

            return(stats);
        }
コード例 #2
0
        private TcpStats AnalyzeConnections(ConnectionData[] connections, TimeSpan measurePeriod)
        {
            _receivedSinceLastRun = 0;
            _sentSinceLastRun = 0;
            _pendingSendOnLastRun = 0;
            _inSendOnLastRun = 0;
            _pendingReceivedOnLastRun = 0;
            _anySendBlockedOnLastRun = false;

            foreach (var connection in connections)
            {
                AnalyzeConnection(connection);
            }

            var stats = new TcpStats(connections.Length,
                                     _sentTotal,
                                     _receivedTotal,
                                     _sentSinceLastRun,
                                     _receivedSinceLastRun,
                                     _pendingSendOnLastRun,
                                     _inSendOnLastRun,
                                     _pendingReceivedOnLastRun,
                                     measurePeriod);


            Log.Debug("# Total connections: {0,3}. Out: {1:8}  In: {2:8}  Pending Send: {3}  " +
                      "In Send: {4}  Pending Received: {5} Measure Time: {6}",
                stats.Connections,
                stats.SendingSpeed,
                stats.ReceivingSpeed,
                stats.PendingSend,
                stats.InSend,
                stats.PendingSend,
                stats.MeasureTimeFriendly);

            return stats;
        }