public string GetStatisticsString(NetConnection connection) { double now = NetTime.Now; string retval = "--- Application wide statistics ---" + Environment.NewLine + "Heartbeats: " + this.HeartbeatAverageFrequency + "/sec" + Environment.NewLine + "Packets sent: " + m_statistics.PacketsSent + " (" + m_statistics.GetPacketsSentPerSecond(now).ToString("N1") + "/sec)" + Environment.NewLine + "Bytes sent: " + m_statistics.BytesSent + " (" + m_statistics.GetBytesSentPerSecond(now).ToString("N1") + "/sec)" + Environment.NewLine + "Packets received: " + m_statistics.PacketsReceived + " (" + m_statistics.GetPacketsReceivedPerSecond(now).ToString("N1") + "/sec)" + Environment.NewLine + "Bytes received: " + m_statistics.BytesReceived + " (" + m_statistics.GetBytesReceivedPerSecond(now).ToString("N1") + "/sec)" + Environment.NewLine; if (m_simulatedLoss > 0.0f) { retval = retval + "Simulated dropped packets: " + m_statistics.SimulatedDroppedPackets + Environment.NewLine + "Simulated delayed packets: " + m_delayedPackets.Count + Environment.NewLine ; } if (connection != null) { NetConnectionStatistics connStats = connection.Statistics; retval += Environment.NewLine + "--- Connection wide statistics ---" + Environment.NewLine + "Status: " + connection.Status + Environment.NewLine + "Received -----" + Environment.NewLine + "Messages: " + connStats.GetMessagesReceived(true) + " (" + connStats.GetMessagesReceivedPerSecond(now).ToString("N1") + "/sec)" + Environment.NewLine + " User/type: " + connStats.GetUserUnreliableReceived() + "/" + connStats.GetUserSequencedReceived() + "/" + connStats.GetUserReliableUnorderedReceived() + "/" + connStats.GetUserOrderedReceived() + Environment.NewLine + "Packets: " + connStats.PacketsReceived + Environment.NewLine + "Bytes: " + connStats.GetBytesReceived(true) + " (" + connStats.GetBytesReceivedPerSecond(now).ToString("N1") + "/sec)" + Environment.NewLine + "Acks: " + connStats.AcknowledgesReceived + Environment.NewLine + Environment.NewLine + "Sent ------" + Environment.NewLine + "Messages: " + connStats.GetMessagesSent(true) + " (excl. resends " + (connStats.GetMessagesSent(true) - connStats.MessagesResent) + ")" + Environment.NewLine + " User/type: " + connStats.GetUserUnreliableSent() + "/" + connStats.GetUserSequencedSent() + "/" + connStats.GetUserReliableUnorderedSent() + "/" + connStats.GetUserOrderedSent() + Environment.NewLine + "Packets: " + connStats.PacketsSent + Environment.NewLine + "Bytes: " + connStats.GetBytesSent(true) + " (" + connStats.GetBytesSentPerSecond(now).ToString("N1") + "/sec)" + Environment.NewLine + "Acks: " + connStats.AcknowledgesSent + Environment.NewLine + Environment.NewLine + "Resent: " + connStats.MessagesResent + Environment.NewLine + "Duplicates: " + connStats.DuplicateMessagesRejected + Environment.NewLine + "Dropped sequenced: " + connStats.SequencedMessagesRejected + Environment.NewLine + Environment.NewLine + "Unsent messages: " + connection.m_unsentMessages.Count + Environment.NewLine + "Stored messages: " + connStats.CurrentlyStoredMessagesCount + Environment.NewLine + "Withheld messages: " + connStats.CurrentlyWithheldMessagesCount + Environment.NewLine + "Average roundtrip: " + (int)(connection.AverageRoundtripTime * 1000) + " ms" + Environment.NewLine //"Window: " + connection.GetEstimatedPacketsOnWire() + " of " + connection.m_congestionWindowSize ; } return(retval); }