Commit 8f349249 authored by Mike Hibler's avatar Mike Hibler

Once again remove the hacky/hokey LOSSRATE code,

hopefully never to return again!
parent ff4f97d3
...@@ -33,9 +33,6 @@ SERVEROBJS = server.o $(SHAREDOBJS) ...@@ -33,9 +33,6 @@ SERVEROBJS = server.o $(SHAREDOBJS)
CFLAGS = -O2 -g -Wall -static $(PTHREADCFLAGS) -DSTATS CFLAGS = -O2 -g -Wall -static $(PTHREADCFLAGS) -DSTATS
LDFLAGS = -static LDFLAGS = -static
# Hacky loss rate flag
#CFLAGS += -DDOLOSSRATE
# Define this if you implementation of cond_vars works well # Define this if you implementation of cond_vars works well
#CFLAGS += -DCONDVARS_WORK #CFLAGS += -DCONDVARS_WORK
......
...@@ -47,9 +47,6 @@ int maxinprogress = MAXINPROGRESS; ...@@ -47,9 +47,6 @@ int maxinprogress = MAXINPROGRESS;
int redodelay = CLIENT_REQUEST_REDO_DELAY; int redodelay = CLIENT_REQUEST_REDO_DELAY;
int idledelay = CLIENT_WRITER_IDLE_DELAY; int idledelay = CLIENT_WRITER_IDLE_DELAY;
int startdelay = 0, startat = 0; int startdelay = 0, startat = 0;
#ifdef DOLOSSRATE
int lossrate = 0;
#endif
int debug = 0; int debug = 0;
int tracing = 0; int tracing = 0;
...@@ -356,26 +353,14 @@ main(int argc, char **argv) ...@@ -356,26 +353,14 @@ main(int argc, char **argv)
strncpy(traceprefix, event.data.start.traceprefix, 64); strncpy(traceprefix, event.data.start.traceprefix, 64);
else else
traceprefix[0] = 0; traceprefix[0] = 0;
#ifdef DOLOSSRATE
if (event.data.start.plr >= 0.0 && event.data.start.plr <= 1.0)
lossrate = (int)(event.data.start.plr * 0x7fffffff);
else
lossrate = 0;
#endif
log("Starting: slice=%d, startat=%d, startdelay=%d, zero=%d, " log("Starting: slice=%d, startat=%d, startdelay=%d, zero=%d, "
"randomize=%d, nothreads=%d, debug=%d, tracing=%d, " "randomize=%d, nothreads=%d, debug=%d, tracing=%d, "
"pkttimeout=%d, idletimer=%d, idledelay=%d, redodelay=%d, " "pkttimeout=%d, idletimer=%d, idledelay=%d, redodelay=%d, "
#ifdef DOLOSSRATE
"plr=%.2f, "
#endif
"maxmem=%d, chunkbufs=%d, maxwritebumfem=%d, " "maxmem=%d, chunkbufs=%d, maxwritebumfem=%d, "
"maxreadahead=%d, maxinprogress=%d", "maxreadahead=%d, maxinprogress=%d",
slice, startat, startdelay, zero, randomize, nothreads, slice, startat, startdelay, zero, randomize, nothreads,
debug, tracing, pkttimeout, idletimer, idledelay, redodelay, debug, tracing, pkttimeout, idletimer, idledelay, redodelay,
#ifdef DOLOSSRATE
lossrate ? event.data.start.plr : 0,
#endif
maxmem, maxchunkbufs, maxwritebufmem, maxmem, maxchunkbufs, maxwritebufmem,
maxreadahead, maxinprogress); maxreadahead, maxinprogress);
} }
...@@ -1266,35 +1251,10 @@ PlayFrisbee(void) ...@@ -1266,35 +1251,10 @@ PlayFrisbee(void)
Stats.u.v1.redodelay = redodelay; Stats.u.v1.redodelay = redodelay;
Stats.u.v1.randomize = randomize; Stats.u.v1.randomize = randomize;
p->msg.leave2.stats = Stats; p->msg.leave2.stats = Stats;
#if 1
/* XXX hack, make sure stats get through */
delay = 0;
while (delay < 10) {
Packet_t rep;
int readretry;
PacketSend(p, 0);
for (readretry = 0; readretry < 10; readretry++) {
fsleep(100000);
while (PacketReceive(&rep) == 0) {
if (rep.hdr.subtype == PKTSUBTYPE_LEAVE2 &&
rep.hdr.type == PKTTYPE_REPLY)
goto gotit;
}
}
delay++;
}
gotit:
#else
PacketSend(p, 0); PacketSend(p, 0);
#endif
log(""); log("");
ClientStatsDump(myid, &Stats); ClientStatsDump(myid, &Stats);
#ifdef DOLOSSRATE
dump_network();
#endif
#else #else
p->hdr.type = PKTTYPE_REQUEST; p->hdr.type = PKTTYPE_REQUEST;
p->hdr.subtype = PKTSUBTYPE_LEAVE; p->hdr.subtype = PKTSUBTYPE_LEAVE;
......
...@@ -211,16 +211,6 @@ parse_event(Event_t *event, char *etype, char *buf) ...@@ -211,16 +211,6 @@ parse_event(Event_t *event, char *etype, char *buf)
gotevent = 1; gotevent = 1;
continue; continue;
} }
#ifdef DOLOSSRATE
{
double plr;
if (sscanf(cp, "PLR=%lf", &plr) == 1) {
event->data.start.plr = plr;
gotevent = 1;
continue;
}
}
#endif
} }
} }
return 0; return 0;
...@@ -289,7 +279,6 @@ EventInit(char *server) ...@@ -289,7 +279,6 @@ EventInit(char *server)
strcpy(ipbuf, inet_ntoa(myip)); strcpy(ipbuf, inet_ntoa(myip));
ipaddr = ipbuf; ipaddr = ipbuf;
#if 1
/* /*
* Hideous Hack Alert! * Hideous Hack Alert!
* *
...@@ -304,7 +293,6 @@ EventInit(char *server) ...@@ -304,7 +293,6 @@ EventInit(char *server)
return 1; return 1;
} else if (debug) } else if (debug)
log("client number %d for event handling", clientnum); log("client number %d for event handling", clientnum);
#endif
/* /*
* Convert server/port to elvin thing. * Convert server/port to elvin thing.
......
...@@ -33,9 +33,6 @@ typedef struct { ...@@ -33,9 +33,6 @@ typedef struct {
int trace; /* tracing level */ int trace; /* tracing level */
char traceprefix[STRSIZE]; char traceprefix[STRSIZE];
/* prefix for trace output file */ /* prefix for trace output file */
#ifdef DOLOSSRATE
double plr;
#endif
} start; } start;
struct { struct {
int exitstatus; int exitstatus;
......
...@@ -22,20 +22,7 @@ ...@@ -22,20 +22,7 @@
#include "decls.h" #include "decls.h"
#include "utils.h" #include "utils.h"
#ifdef DOLOSSRATE
#define LOSSONSENDER
#define LOSSONRECVER
#endif
#ifdef DOLOSSRATE
extern int lossrate;
#endif
#ifdef STATS #ifdef STATS
#ifdef DOLOSSRATE
unsigned long rpackets, rpacketslost;
unsigned long spackets, spacketslost;
#endif
unsigned long nonetbufs; unsigned long nonetbufs;
#define DOSTAT(x) (x) #define DOSTAT(x) (x)
#else #else
...@@ -53,24 +40,6 @@ struct in_addr myipaddr; ...@@ -53,24 +40,6 @@ struct in_addr myipaddr;
static int nobufdelay = -1; static int nobufdelay = -1;
int broadcast = 0; int broadcast = 0;
void
dump_network(void)
{
#ifdef DOLOSSRATE
if (lossrate == 0)
return;
if (spacketslost)
fprintf(stderr, "Lost %lu of %lu send packets (%.2f%%)\n",
spacketslost, spackets,
(double)spacketslost * 100 / spackets);
if (rpacketslost)
fprintf(stderr, "Lost %lu of %lu recv packets (%.2f%%)\n",
rpacketslost, rpackets,
(double)rpacketslost * 100 / rpackets);
#endif
}
static void static void
CommonInit(void) CommonInit(void)
{ {
...@@ -222,31 +191,7 @@ PacketReceive(Packet_t *p) ...@@ -222,31 +191,7 @@ PacketReceive(Packet_t *p)
{ {
struct sockaddr_in from; struct sockaddr_in from;
int mlen, alen; int mlen, alen;
#ifdef DOLOSSRATE
#ifdef LOSSONRECVER
struct timeval now, then;
if (lossrate) {
/*
* XXX cannot rely on socket timeout value since we need to
* treat received and dropped packets as though they never
* arrived. This is still not correct as a receive timeout
* could still be up to twice as long as it should be, but
* I don't want to mess with the socket timeout on every
* recv call.
*/
gettimeofday(&then, 0);
if ((then.tv_usec += PKTRCV_TIMEOUT) >= 1000000) {
then.tv_sec++;
then.tv_usec -= 1000000;
}
again:
gettimeofday(&now, 0);
if (timercmp(&now, &then, >=))
return -1;
}
#endif
#endif
alen = sizeof(from); alen = sizeof(from);
bzero(&from, alen); bzero(&from, alen);
if ((mlen = recvfrom(sock, p, sizeof(*p), 0, if ((mlen = recvfrom(sock, p, sizeof(*p), 0,
...@@ -270,21 +215,6 @@ PacketReceive(Packet_t *p) ...@@ -270,21 +215,6 @@ PacketReceive(Packet_t *p)
return 1; return 1;
} }
#ifdef DOLOSSRATE
#ifdef LOSSONRECVER
DOSTAT(rpackets++);
if (lossrate && random() < lossrate) {
/* XXX hack: don't loose join/leave messages, screws stats */
if (p->hdr.subtype != PKTSUBTYPE_JOIN &&
p->hdr.subtype != PKTSUBTYPE_LEAVE &&
p->hdr.subtype != PKTSUBTYPE_LEAVE2) {
DOSTAT(rpacketslost++);
goto again;
}
}
#endif
#endif
return 0; return 0;
} }
...@@ -301,21 +231,6 @@ PacketSend(Packet_t *p, int *resends) ...@@ -301,21 +231,6 @@ PacketSend(Packet_t *p, int *resends)
struct sockaddr_in to; struct sockaddr_in to;
int len, delays; int len, delays;
#ifdef DOLOSSRATE
#ifdef LOSSONSENDER
DOSTAT(spackets++);
if (lossrate && random() < lossrate) {
/* XXX hack: don't loose join/leave messages, screws stats */
if (p->hdr.subtype != PKTSUBTYPE_JOIN &&
p->hdr.subtype != PKTSUBTYPE_LEAVE &&
p->hdr.subtype != PKTSUBTYPE_LEAVE2) {
DOSTAT(spacketslost++);
return;
}
}
#endif
#endif
len = sizeof(p->hdr) + p->hdr.datalen; len = sizeof(p->hdr) + p->hdr.datalen;
p->hdr.srcip = myipaddr.s_addr; p->hdr.srcip = myipaddr.s_addr;
......
...@@ -50,9 +50,6 @@ struct in_addr mcastif; ...@@ -50,9 +50,6 @@ struct in_addr mcastif;
char *filename; char *filename;
struct timeval IdleTimeStamp, FirstReq, LastReq; struct timeval IdleTimeStamp, FirstReq, LastReq;
volatile int activeclients; volatile int activeclients;
#ifdef DOLOSSRATE
int lossrate = 0;
#endif
/* Forward decls */ /* Forward decls */
void quit(int); void quit(int);
...@@ -439,12 +436,6 @@ ClientLeave2(Packet_t *p) ...@@ -439,12 +436,6 @@ ClientLeave2(Packet_t *p)
break; break;
} }
} }
#if 1
/* XXX let the client know we got the goods */
p->hdr.type = PKTTYPE_REPLY;
p->hdr.datalen = sizeof(p->msg.leave2);
PacketReply(p);
#endif
#else #else
activeclients--; activeclients--;
...@@ -804,17 +795,6 @@ main(int argc, char **argv) ...@@ -804,17 +795,6 @@ main(int argc, char **argv)
case 'W': case 'W':
bandwidth = atol(optarg); bandwidth = atol(optarg);
break; break;
#ifdef DOLOSSRATE
/* XXX this is not the emulab way! */
case 'L':
{
double plr = atof(optarg);
if (plr < 0 || plr > 1)
fatal("bad loss rate: %f", plr);
lossrate = (int)(plr * 0x7fffffff);
break;
}
#endif
case 'h': case 'h':
case '?': case '?':
default: default:
...@@ -925,9 +905,6 @@ main(int argc, char **argv) ...@@ -925,9 +905,6 @@ main(int argc, char **argv)
Stats.intervals, Stats.missed); Stats.intervals, Stats.missed);
log(" spurious wakeups: %d", Stats.wakeups); log(" spurious wakeups: %d", Stats.wakeups);
log(" max workq size: %d", WorkQMax); log(" max workq size: %d", WorkQMax);
#ifdef DOLOSSRATE
dump_network();
#endif
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment