|
From: Jonathan L. <le...@us...> - 2009-01-18 03:16:43
|
Update of /cvsroot/pyxida/Pyxida/sim In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21465/sim Modified Files: vivaldi.cc vs.cc Log Message: releasing 0.1.5 Index: vivaldi.cc =================================================================== RCS file: /cvsroot/pyxida/Pyxida/sim/vivaldi.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** vivaldi.cc 15 Mar 2007 12:20:50 -0000 1.1 --- vivaldi.cc 18 Jan 2009 01:58:05 -0000 1.2 *************** *** 25,29 **** if (debug) ! cout << "\n\nLINE: "<< o_stamp << " me " << myId << " you " << o_yourId << " s " << o_rawLatency << endl; --- 25,29 ---- if (debug) ! cout << "\n\nLINE: EXIT"<< o_stamp << " me " << myId << " you " << o_yourId << " s " << o_rawLatency << endl; Index: vs.cc =================================================================== RCS file: /cvsroot/pyxida/Pyxida/sim/vs.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** vs.cc 19 Dec 2008 19:00:52 -0000 1.2 --- vs.cc 18 Jan 2009 01:58:05 -0000 1.3 *************** *** 8,11 **** --- 8,12 ---- #include <unistd.h> #include <signal.h> + #include <map> #include "node.h" *************** *** 91,94 **** --- 92,96 ---- << " -O output prefix\n" << " -z use height\n" + << " -a autonomous system mapping file\n" << " -s seed\n"; exit (-1); *************** *** 105,109 **** char c = 0; char *sampleFile = NULL; ! char *trueLatencyMatrixFile = NULL; int seed = getpid(); int meanLifetime = 0; --- 107,111 ---- char c = 0; char *sampleFile = NULL; ! char *trueLatencyMatrixFile = NULL, *as_map_file; int seed = getpid(); int meanLifetime = 0; *************** *** 111,119 **** bool clearCoordMemory = false; bool bimodalPrune = false; (void) signal(SIGINT, exit_program); ! FILE *fp; ! while ((c = getopt(argc,argv,"BCc:I:bf:n:e:u:s:o:x:h:p:dg:m:t:w:i:l:zr:j:O:k:M")) >= 0) { switch (c) { case 'O': outputPrefix = optarg; --- 113,128 ---- bool clearCoordMemory = false; bool bimodalPrune = false; + bool as_clustering = false; (void) signal(SIGINT, exit_program); + map<int,int> id2as; + char line_buffer [8192]; ! FILE *fp, *as_fp; ! while ((c = getopt(argc,argv,"a:BCc:I:bf:n:e:u:s:o:x:h:p:dg:m:t:w:i:l:zr:j:O:k:M")) >= 0) { switch (c) { + case 'a': + as_map_file = optarg; + as_clustering = true; + break; case 'O': outputPrefix = optarg; *************** *** 279,283 **** #ifdef TRUE_MATRIX ! for (int myId = 0; myId < nodeCount; myId++) { --- 288,294 ---- #ifdef TRUE_MATRIX ! // Scans in files of form ! // L(0,0) L(0,1) L(0,n-1) ! // L(1,0) L(1,1) for (int myId = 0; myId < nodeCount; myId++) { *************** *** 433,436 **** --- 444,474 ---- } + + if (as_clustering) { + if ((as_fp = fopen (as_map_file, "r")) == NULL) { + printf ("Cannot open as_map file %s", as_map_file); + exit (-1); + } + + int as_id = 0; + + while (1) { + memset (line_buffer, 0, sizeof(line_buffer)); + if (fgets(line_buffer, sizeof(line_buffer), as_fp) == NULL) + break; + int node_in_as; + char *line_ptr; + char *lb_ptr = line_buffer; + while (line_ptr = strtok (lb_ptr, " ")) { + lb_ptr = NULL; + int ret = sscanf (line_ptr, "%d", &node_in_as); + ASSERT (ret == 1); + id2as[node_in_as] = as_id; + //printf ("id %d as %d\n", node_in_as, as_id); + } + as_id++; + } + } + if (PING_SAMPLE_PERCENTILE < 0 || PING_SAMPLE_PERCENTILE > 1) { printf ("Bad ping sample percentile\n"); *************** *** 573,576 **** --- 611,630 ---- ASSERT (rawLatencySample > 0); + if (as_clustering) { + if (id2as[myId] == id2as[yourId]) { + float clusterSample = randPct() * 10; + //if (debug) { + //printf ("same AS: me %d you %d as %d lat %f rLat %f\n", + //myId, yourId, id2as[myId], rawLatencySample, + //clusterSample); + //} + rawLatencySample = clusterSample; + } else { + //printf ("diff AS: me %d %d you %d %d lat %f\n", + //myId, yourId, id2as[myId], id2as[yourId], + //rawLatencySample); + } + } + nodes[myId].processSample (stamp, myId, yourId, rawLatencySample); |