Changeset 8068 in orxonox.OLD for trunk/src/lib/network/connection_monitor.cc
- Timestamp:
- Jun 1, 2006, 2:28:16 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/connection_monitor.cc
r7954 r8068 61 61 * @param stateId packet's state id 62 62 */ 63 void ConnectionMonitor::processUnzippedOutgoingPacket( byte * data, int length, int stateId ) 64 { 65 int tick = SDL_GetTicks(); 66 63 void ConnectionMonitor::processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId ) 64 { 67 65 nOutgoingPackets++; 68 66 … … 77 75 78 76 // count zero bytes 79 int nZeroBytes = 0;80 81 for ( int i = 0; i < length; i++ )82 if ( data[i] == '\0' )83 nZeroBytes++;77 //int nZeroBytes = 0; 78 79 //for ( int i = 0; i < length; i++ ) 80 // if ( data[i] == '\0' ) 81 // nZeroBytes++; 84 82 85 83 //NETPRINTF(n)( "ZEROBYTES: %d (%f%%)\n", nZeroBytes, ((float)100)*nZeroBytes/length ); … … 93 91 * @param ackedState state which was acked by this packet 94 92 */ 95 void ConnectionMonitor::processUnzippedIncomingPacket( byte * data, int length, int stateId, int ackedState ) 96 { 97 int tick = SDL_GetTicks(); 98 93 void ConnectionMonitor::processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState ) 94 { 99 95 nIncomingPackets++; 100 96 … … 149 145 for ( std::map<int,int>::iterator it = packetHistory.begin(); it != packetHistory.end(); it++ ) 150 146 { 151 res += it->second; 147 if ( it != packetHistory.begin() ) 148 res += it->second; 152 149 } 153 150 … … 155 152 res = 0.0f; 156 153 else 157 res /= (float)( (tick - packetHistory.begin()->first)*( 1 + 1/((float)(packetHistory.size()-1)) ));154 res /= (float)(tick - packetHistory.begin()->first); 158 155 159 156 res *= 1000.0f; … … 169 166 * @param stateId packet's state id 170 167 */ 171 void ConnectionMonitor::processZippedOutgoingPacket( byte * data, int length, int stateId ) 172 { 173 int tick = SDL_GetTicks(); 174 168 void ConnectionMonitor::processZippedOutgoingPacket( int tick, byte * data, int length, int stateId ) 169 { 175 170 nZOutgoingPackets++; 176 171 … … 196 191 * @param ackedState state which was acked by this packet 197 192 */ 198 void ConnectionMonitor::processZippedIncomingPacket( byte * data, int length, int stateId, int ackedState ) 199 { 200 int tick = SDL_GetTicks(); 201 193 void ConnectionMonitor::processZippedIncomingPacket( int tick, byte * data, int length ) 194 { 202 195 nZIncomingPackets++; 203 196 … … 233 226 void ConnectionMonitor::printStatis( ) 234 227 { 235 NETPRINT(n)("========= NETWORKSTATS FOR USER %d=========\n", userId);236 NETPRINT(n)("PING = %d\n", ping );228 NETPRINT(n)("============NETWORKSTATS FOR USER %d============\n", userId); 229 NETPRINT(n)("PING = %d\n", ping ); 237 230 NETPRINT(n)("BANDWIDTH: UP: %f (%f) DOWN %f (%f)\n", outgoingZippedBandWidth, outgoingUnzippedBandWidth, incomingZippedBandWidth, incomingUnzippedBandWidth); 238 NETPRINT(n)("=========================================="); 239 } 240 241 231 NETPRINT(n)("PACKETS: RECIEVED %d; SENT %d\n", nIncomingPackets, nOutgoingPackets ); 232 NETPRINT(n)("================================================\n"); 233 } 234 235
Note: See TracChangeset
for help on using the changeset viewer.