Merge pull request #330 from adamdunkels/push/faster-collect-lossy

Faster collect-lossy travis test
This commit is contained in:
Nicolas Tsiftes 2013-08-11 07:14:28 -07:00
commit fe0a0423cb

View file

@ -398,6 +398,7 @@ booted = new Array();
received = new Array(); received = new Array();
hops = new Array(); hops = new Array();
nrNodes = 20; nrNodes = 20;
toReceive = 8;
total_received = 0; total_received = 0;
total_lost = 0; total_lost = 0;
total_hops = 0; total_hops = 0;
@ -411,7 +412,10 @@ total_latency = 0;
nodes_starting = true; nodes_starting = true;
for(i = 1; i <= nrNodes; i++) { for(i = 1; i <= nrNodes; i++) {
booted[i] = false; booted[i] = false;
received[i] = "__________"; received[i] = '';
for(var j = 0; j < toReceive; j++) {
received[i] += '_';
}
hops[i] = received[i]; hops[i] = received[i];
} }
@ -495,20 +499,20 @@ while(true) {
dups++; dups++;
} }
received[source] = received[source].substr(0, seqno) + dups + received[source] = received[source].substr(0, seqno) + dups +
received[source].substr(seqno + 1, 10 - seqno); received[source].substr(seqno + 1, toReceive - seqno);
if(hop > 9) { if(hop > 9) {
hop = "+"; hop = "+";
} }
hops[source] = hops[source].substr(0, seqno) + hop + hops[source] = hops[source].substr(0, seqno) + hop +
hops[source].substr(seqno + 1, 10 - seqno); hops[source].substr(seqno + 1, toReceive - seqno);
total_received++; total_received++;
total_hops += hop; total_hops += hop;
print_stats(); print_stats();
} }
/* Signal OK if all nodes have reported 10 messages. */ /* Signal OK if all nodes have reported toReceive messages. */
num_reported = 0; num_reported = 0;
for(i = 1; i <= nrNodes; i++) { for(i = 1; i <= nrNodes; i++) {
if(i != sink) { if(i != sink) {