Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8068 in orxonox.OLD for trunk/src/lib/network/connection_monitor.cc


Ignore:
Timestamp:
Jun 1, 2006, 2:28:16 PM (19 years ago)
Author:
patrick
Message:

trunk: merged the network branche back to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/network/connection_monitor.cc

    r7954 r8068  
    6161 * @param stateId packet's state id
    6262 */
    63 void ConnectionMonitor::processUnzippedOutgoingPacket( byte * data, int length, int stateId )
    64 {
    65   int tick = SDL_GetTicks();
    66  
     63void ConnectionMonitor::processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId )
     64{
    6765  nOutgoingPackets++;
    6866 
     
    7775 
    7876  // 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++;
    8482 
    8583  //NETPRINTF(n)( "ZEROBYTES: %d (%f%%)\n", nZeroBytes, ((float)100)*nZeroBytes/length );
     
    9391 * @param ackedState state which was acked by this packet
    9492 */
    95 void ConnectionMonitor::processUnzippedIncomingPacket( byte * data, int length, int stateId, int ackedState )
    96 {
    97   int tick = SDL_GetTicks();
    98  
     93void ConnectionMonitor::processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState )
     94{
    9995  nIncomingPackets++;
    10096 
     
    149145  for ( std::map<int,int>::iterator it = packetHistory.begin(); it != packetHistory.end(); it++ )
    150146  {
    151     res += it->second;
     147    if ( it != packetHistory.begin() )
     148      res += it->second;
    152149  }
    153150 
     
    155152    res = 0.0f;
    156153  else
    157     res /= (float)((tick - packetHistory.begin()->first)*( 1 + 1/((float)(packetHistory.size()-1)) ));
     154    res /= (float)(tick - packetHistory.begin()->first);
    158155 
    159156  res *= 1000.0f;
     
    169166 * @param stateId packet's state id
    170167 */
    171 void ConnectionMonitor::processZippedOutgoingPacket( byte * data, int length, int stateId )
    172 {
    173   int tick = SDL_GetTicks();
    174  
     168void ConnectionMonitor::processZippedOutgoingPacket( int tick, byte * data, int length, int stateId )
     169{
    175170  nZOutgoingPackets++;
    176171 
     
    196191 * @param ackedState state which was acked by this packet
    197192 */
    198 void ConnectionMonitor::processZippedIncomingPacket( byte * data, int length, int stateId, int ackedState )
    199 {
    200   int tick = SDL_GetTicks();
    201  
     193void ConnectionMonitor::processZippedIncomingPacket( int tick, byte * data, int length )
     194{
    202195  nZIncomingPackets++;
    203196 
     
    233226void ConnectionMonitor::printStatis( )
    234227{
    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 );
    237230  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.