Changeset 5720 in orxonox.OLD for branches/network/src/lib
- Timestamp:
- Nov 23, 2005, 1:19:49 PM (19 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/connection_monitor.cc
r5618 r5720 32 32 /*Data of the lifetime of the ConnectionMonitor Object*/ 33 33 packetToAverage = 5; 34 protocollType = "default"; 34 35 35 36 startTime= SDL_GetTicks(); … … 71 72 currentDelay = currentPacketTick - lastPacketTick; 72 73 73 /* Only for Udp74 if(currentPacketID - lastPacketID > 1)75 {76 totalLostPackets += currentPacketID - lastPacketID;77 }78 79 totalPacketloss = (totalLostPackets/totalReceivedPackets)*100 ;80 */81 82 74 /*Do whats needed for Averaging*/ 83 75 84 76 if(packetCounter = packetToAverage) 85 77 { 86 compute AverageStatistic();78 computeCurrentDatarate(); 87 79 displayStatistic(); 88 80 packetCounter = 0; 81 sizeOfLastFewPackets = 0; 89 82 } 90 83 … … 92 85 lastFewPackets[packetCounter] = currentPacket; 93 86 sizeOfLastFewPackets += packetLength; 87 88 /* Do protocol related stuff 89 90 Only for Udp: 91 "currentPacketID = getID from package"; 92 93 if(currentPacketID - lastPacketID > 1) 94 { 95 totalLostPackets += currentPacketID - lastPacketID; 96 } 97 98 totalPacketloss = (totalLostPackets/totalReceivedPackets)*100 ; 99 */ 94 100 95 101 … … 105 111 106 112 /* Compute the value of current Datarate*/ 107 void ConnectionMonitor::compute AverageStatistic()113 void ConnectionMonitor::computeCurrentDatarate() 108 114 { 109 115 int timeForLastFewPackets; 110 for(int i=0;i < = packetToAverage-1;i++)116 for(int i=0;i < packetToAverage;i++) 111 117 timeForLastFewPackets += lastFewDelays[i]; 112 118 113 currentDatarate = packetToAverage/timeForLastFewPackets; 119 currentDatarate = sizeOfLastFewPackets/timeForLastFewPackets; 120 } 121 122 void doUDPRelatedStuff() 123 { 124 114 125 } 115 126 116 127 128 129 /* Display connectoin statistic*/ 117 130 void ConnectionMonitor::displayStatistic() 118 131 { … … 125 138 126 139 PRINT(0)("Current datarate :\n",currentDatarate); 127 PRINT(0)("Delays of the last few packets :\n" ,currentDelay);140 PRINT(0)("Delays of the last few packets :\n"); 128 141 for(int i=1 ;i <= packetToAverage-1;i++) 129 142 PRINT(0)("%i ",lastFewDelays[i]); -
branches/network/src/lib/network/connection_monitor.h
r5618 r5720 23 23 24 24 void displayStatistic(); 25 void computeAverageStatistic(); 25 void computeCurrentDatarate(); 26 void doUDPRelatedStuff(); 26 27 27 28 /*Data of the lifetime of the ConnectionMonitor Object*/ 28 29 unsigned int packetToAverage; 30 char* protocollType; 29 31 30 32 unsigned int totalReceivedPackets;
Note: See TracChangeset
for help on using the changeset viewer.