Logfile * logfileOpen(const char *path, size_t bufsz, int fatal_flag) { Logfile *lf; const char *patharg; int ret; debug(50, 1) ("logfileOpen: opening log %s\n", path); CBDATA_INIT_TYPE(Logfile); lf = cbdataAlloc(Logfile); xstrncpy(lf->path, path, MAXPATHLEN); patharg = path; /* need to call the per-logfile-type code */ if (strncmp(path, "stdio:", 6) == 0) { patharg = path + 6; ret = logfile_mod_stdio_open(lf, patharg, bufsz, fatal_flag); } else if (strncmp(path, "daemon:", 7) == 0) { patharg = path + 7; ret = logfile_mod_daemon_open(lf, patharg, bufsz, fatal_flag); } else if (strncmp(path, "udp:", 4) == 0) { patharg = path + 4; ret = logfile_mod_udp_open(lf, patharg, bufsz, fatal_flag); #if HAVE_SYSLOG } else if (strncmp(path, "syslog:", 7) == 0) { patharg = path + 7; ret = logfile_mod_syslog_open(lf, patharg, bufsz, fatal_flag); #endif } else { ret = logfile_mod_stdio_open(lf, patharg, bufsz, fatal_flag); } if (!ret) { if (fatal_flag) fatalf("logfileOpen: path %s: couldn't open!\n", path); else debug(50, 1) ("logfileOpen: path %s: couldn't open!\n", path); lf->f_close(lf); cbdataFree(lf); return NULL; } assert(lf->data != NULL); if (fatal_flag) lf->flags.fatal = 1; lf->sequence_number = 0; return lf; }
Lng32 SqlciRWInterfaceExecutor::printOutputRow(SqlciEnv * sqlci_env, char * outputBuf, Lng32 outputBufLen) { Logfile *log = sqlci_env->get_logfile(); log->WriteAll(outputBuf, outputBufLen, 0); return 0; }
void File::parseOutputs(TiXmlNode* o){ TiXmlElement* pElem=o->FirstChild()->ToElement(); // for(TiXmlElement* pElem=o->FirstChild()->ToElement();pElem != NULL; pElem=pElem->NextSiblingElement()){ string type = pElem->Attribute("type"); string filename = pElem->Attribute("type"); // Strategy to add with memoization option if(type.compare("logfile") == 0){ Logfile l = Logfile(filename); l.setFilenameFormat(pElem->Attribute("filename")); l.setDelim(pElem->Attribute("delim")[0]); logfile = l; } }
short QueryId::process(SqlciEnv * sqlci_env) { Lng32 retcode = 0; HandleCLIErrorInit(); char * stmtName = get_argument(); if ((stmtName) && (! sqlci_env->get_prep_stmts()->get(stmtName))) { sqlci_env->diagsArea() << DgSqlCode(-SQLCI_STMT_NOT_FOUND) << DgString0(stmtName); return 0; } Logfile *log = sqlci_env->get_logfile(); char sprintfBuf[225]; if (!stmtName) { //try to find the last executed statement if present if (sqlci_env->lastExecutedStmt() && sqlci_env->lastExecutedStmt()->getStmtNameLen() > 0) stmtName = sqlci_env->lastExecutedStmt()->getStmtName(); //if not, try to find the last prepared statement if present else if (sqlci_env->getLastAllocatedStmt() && sqlci_env->getLastAllocatedStmt()->identifier_len > 0) stmtName = (char *) sqlci_env->getLastAllocatedStmt()->identifier; } if (!stmtName) // no statement name found Display error. { sprintf(sprintfBuf, "No statment found. Enter command with valid statement name."); log->WriteAll(sprintfBuf); return 0; } SQLSTMT_ID stmt; SQLMODULE_ID module; init_SQLMODULE_ID(&module); init_SQLSTMT_ID(&stmt, SQLCLI_CURRENT_VERSION, stmt_name, &module); char * id = new char[strlen(stmtName) + 1]; #pragma nowarn(1506) // warning elimination stmt.identifier_len = strlen(stmtName); #pragma warn(1506) // warning elimination str_cpy_all(id,stmtName, stmt.identifier_len); id[stmt.identifier_len] = 0; stmt.identifier = id; char queryId[200]; Lng32 queryIdLen; retcode = SQL_EXEC_GetStmtAttr(&stmt, SQL_ATTR_UNIQUE_STMT_ID, NULL, queryId, 200, &queryIdLen); delete [] id; if (queryIdLen < 200) queryId[queryIdLen] = 0; else queryId[199] = 0; HandleCLIError(retcode, sqlci_env); if (retcode == 0) { snprintf(sprintfBuf, 225, "QID is %s",queryId); log->WriteAll(sprintfBuf); log->WriteAll(""); } // display details of this query // for string attributes, use {type,maxLength,char[maxLength+1]} UNIQUEQUERYID_ATTR queryIdAttrs[11] = { {UNIQUEQUERYID_SEGMENTNUM, 0, 0}, {UNIQUEQUERYID_SEGMENTNAME, 10, new char[11]}, {UNIQUEQUERYID_CPU, 0, 0}, {UNIQUEQUERYID_PIN, 0, 0}, {UNIQUEQUERYID_EXESTARTTIME, 0, 0}, {UNIQUEQUERYID_SESSIONNUM, 0, 0}, {UNIQUEQUERYID_USERNAME, 24, new char[25]}, {UNIQUEQUERYID_SESSIONNAME, 32, new char[33]}, {UNIQUEQUERYID_QUERYNUM, 0, 0}, {UNIQUEQUERYID_STMTNAME, 110, new char[111]}, {UNIQUEQUERYID_SESSIONID, 104, new char[105]} }; retcode = SQL_EXEC_GetUniqueQueryIdAttrs(queryId, queryIdLen, 11, queryIdAttrs); HandleCLIError(retcode, sqlci_env); if (retcode == 0) { snprintf(sprintfBuf, 225, "QID details: "); log->WriteAll(sprintfBuf); log->WriteAll("============"); // display UNIQUEQUERYID_SEGMENTNUM snprintf(sprintfBuf, 225, " Segment Num: " PFLL,queryIdAttrs[0].num_val_or_len); log->WriteAll(sprintfBuf); // display UNIQUEQUERYID_SEGMENTNAME snprintf(sprintfBuf, 225, " Segment Name: %s",queryIdAttrs[1].string_val); log->WriteAll(sprintfBuf); // display UNIQUEQUERYID_CPU snprintf(sprintfBuf, 225, " Cpu: " PFLL,queryIdAttrs[2].num_val_or_len); log->WriteAll(sprintfBuf); // display UNIQUEQUERYID_PIN snprintf(sprintfBuf, 225, " Pin: " PFLL,queryIdAttrs[3].num_val_or_len); log->WriteAll(sprintfBuf); // UNIQUEQUERYID_EXESTARTTIME short startTimeArray[8]; _int64 startTime = queryIdAttrs[4].num_val_or_len; short error; INTERPRETTIMESTAMP( CONVERTTIMESTAMP(startTime, 0, // GMT to LCT -1, // use current node &error), startTimeArray); sprintf(sprintfBuf, " ExeStartTime: " PF64 "= %02d/%02d/%02d %02d:%02d:%02d.%03d%03d LCT", startTime, startTimeArray[0],startTimeArray[1],startTimeArray[2], startTimeArray[3], startTimeArray[4], startTimeArray[5], startTimeArray[6], startTimeArray[7]); log->WriteAll(sprintfBuf); // display UNIQUEQUERYID_SESSIONNUM sprintf(sprintfBuf," SessionNum: " PFLL,queryIdAttrs[5].num_val_or_len); log->WriteAll(sprintfBuf); // display UNIQUEQUERYID_USERNAME sprintf(sprintfBuf," UserName: %s",queryIdAttrs[6].string_val); log->WriteAll(sprintfBuf); // display UNIQUEQUERYID_SESSIONNAME if (strlen(queryIdAttrs[7].string_val) > 0) sprintf(sprintfBuf," SessionName: %s",queryIdAttrs[7].string_val); else sprintf(sprintfBuf," SessionName: NULL"); log->WriteAll(sprintfBuf); // display UNIQUEQUERYID_QUERYNUM sprintf(sprintfBuf," QueryNum: " PFLL,queryIdAttrs[8].num_val_or_len); log->WriteAll(sprintfBuf); // display UNIQUEQUERYID_STMTNAME: sprintf(sprintfBuf," StmtName: %s",queryIdAttrs[9].string_val); log->WriteAll(sprintfBuf); // display UNIQUEQUERYID_SESSIONID: sprintf(sprintfBuf," SessionId: %s",queryIdAttrs[10].string_val); log->WriteAll(sprintfBuf); log->WriteAll(""); } return 0; }
short Env::process(SqlciEnv *sqlci_env) { // ## Should any of this text come from the message file, // ## i.e. from a translatable file for I18N? // When adding new variables, please keep the information in // alphabetic order Logfile *log = sqlci_env->get_logfile(); log->WriteAll("----------------------------------"); log->WriteAll("Current Environment"); log->WriteAll("----------------------------------"); bool authenticationEnabled = false; bool authorizationEnabled = false; bool authorizationReady = false; bool auditingEnabled = false; Int32 rc = sqlci_env->getAuthState(authenticationEnabled, authorizationEnabled, authorizationReady, auditingEnabled); // TDB: add auditing state log->WriteAllWithoutEOL("AUTHENTICATION "); if (authenticationEnabled) log->WriteAll("enabled"); else log->WriteAll("disabled"); log->WriteAllWithoutEOL("AUTHORIZATION "); if (authorizationEnabled) log->WriteAll("enabled"); else log->WriteAll("disabled"); log->WriteAllWithoutEOL("CURRENT DIRECTORY "); // NT_PORT (bv 10/24/96) Added NA_MAX_PATH here and in common/Platform.h log->WriteAll(getcwd((char *)NULL, NA_MAX_PATH)); log->WriteAllWithoutEOL("LIST_COUNT "); char buf[100]; Int32 len = sprintf(buf, "%u", sqlci_env->getListCount()); if (len-- > 0) if (buf[len] == 'L' || buf[len] == 'l') buf[len] = '\0'; log->WriteAll(buf); if (log->IsOpen()) { log->WriteAllWithoutEOL("LOG FILE "); log->WriteAll(log->Logname()); } else { log->WriteAll("LOG FILE"); } log->WriteAllWithoutEOL("MESSAGEFILE "); const char *mf = GetErrorMessageFileName(); log->WriteAll(mf ? mf : ""); #if 0 log->WriteAllWithoutEOL("ISO88591 MAPPING "); log->WriteAll(CharInfo::getCharSetName(sqlci_env->getIsoMappingCharset())); log->WriteAllWithoutEOL("DEFAULT CHARSET "); log->WriteAll(CharInfo::getCharSetName(sqlci_env->getDefaultCharset())); log->WriteAllWithoutEOL("INFER CHARSET "); log->WriteAll((sqlci_env->getInferCharset())?"ON":"OFF"); #endif // ## These need to have real values detected from the env and written out: // "US English" is more "politically correct" than "American English". // log->WriteAllWithoutEOL("MESSAGEFILE LANG US English\n"); log->WriteAllWithoutEOL("MESSAGEFILE VRSN "); char vmsgcode[10]; sprintf(vmsgcode, "%d", SQLERRORS_MSGFILE_VERSION_INFO); #pragma nowarn(1506) // warning elimination Error vmsg(vmsgcode, strlen(vmsgcode), Error::ENVCMD_); #pragma warn(1506) // warning elimination vmsg.process(sqlci_env); ComAnsiNamePart defaultCat; ComAnsiNamePart defaultSch; sqlci_env->getDefaultCatAndSch (defaultCat, defaultSch); CharInfo::CharSet TCS = sqlci_env->getTerminalCharset(); CharInfo::CharSet ISOMAPCS = sqlci_env->getIsoMappingCharset(); if(TCS != CharInfo::UTF8 ) { NAString dCat = defaultCat.getExternalName(); NAString dSch = defaultSch.getExternalName(); charBuf cbufCat((unsigned char*)dCat.data(), dCat.length()); charBuf cbufSch((unsigned char*)dSch.data(), dSch.length()); NAWcharBuf* wcbuf = 0; Int32 errorcode = 0; wcbuf = csetToUnicode(cbufCat, 0, wcbuf, CharInfo::UTF8, errorcode); NAString* tempstr; if (errorcode != 0){ tempstr = new NAString(defaultCat.getExternalName().data()); } else { tempstr = unicodeToChar(wcbuf->data(),wcbuf->getStrLen(), TCS, NULL, TRUE); TrimNAStringSpace(*tempstr, FALSE, TRUE); // trim trailing blanks } log->WriteAllWithoutEOL("SQL CATALOG "); log->WriteAll(tempstr->data()); // Default Schema wcbuf = 0; // must 0 out to get next call to allocate memory. wcbuf = csetToUnicode(cbufSch, 0, wcbuf, CharInfo::UTF8, errorcode); if (errorcode != 0){ tempstr = new NAString(defaultSch.getExternalName().data()); } else { tempstr = unicodeToChar(wcbuf->data(),wcbuf->getStrLen(), TCS, NULL, TRUE); TrimNAStringSpace(*tempstr, FALSE, TRUE); // trim trailing blanks } log->WriteAllWithoutEOL("SQL SCHEMA "); log->WriteAll(tempstr->data()); } else { log->WriteAllWithoutEOL("SQL CATALOG "); log->WriteAll(defaultCat.getExternalName()); log->WriteAllWithoutEOL("SQL SCHEMA "); log->WriteAll(defaultSch.getExternalName()); } // On Linux we include the database user name and user ID in the // command output NAString username; rc = sqlci_env->getExternalUserName(username); log->WriteAllWithoutEOL("SQL USER CONNECTED "); if (rc >= 0) log->WriteAll(username.data()); else log->WriteAll("?"); rc = sqlci_env->getDatabaseUserName(username); log->WriteAllWithoutEOL("SQL USER DB NAME "); if (rc >= 0) log->WriteAll(username.data()); else log->WriteAll("?"); Int32 uid = 0; rc = sqlci_env->getDatabaseUserID(uid); log->WriteAllWithoutEOL("SQL USER ID "); if (rc >= 0) sprintf(buf, "%d", (int) uid); else strcpy(buf, "?"); log->WriteAll(buf); log->WriteAllWithoutEOL("TERMINAL CHARSET "); log->WriteAll(CharInfo::getCharSetName(sqlci_env->getTerminalCharset())); Int64 transid; if (sqlci_env->statusTransaction(&transid)) { // transaction is active. char transid_str[20]; convertInt64ToAscii(transid, transid_str); log->WriteAllWithoutEOL("TRANSACTION ID "); log->WriteAll(transid_str); log->WriteAll("TRANSACTION STATE in progress"); } else { log->WriteAll("TRANSACTION ID "); log->WriteAll("TRANSACTION STATE not in progress"); } if (log->isVerbose()) log->WriteAll("WARNINGS on"); else log->WriteAll("WARNINGS off"); return 0; }
int main (int argc, char **argv) { eventlist.setEndtime (timeFromSec (200)); Clock c (timeFromSec (50 / 100.), eventlist); int algo = COUPLED_EPSILON; double epsilon = 1; int param = 0; stringstream filename (ios_base::out); uint64_t pktperflow = 1048576LL/1000 + 1; if (argc > 1) { int i = 1; if (!strcmp (argv[1], "-o")) { filename << argv[2]; i += 2; } else { filename << "logout.dat"; } if (argc > i && !strcmp (argv[i], "-sub")) { subflow_count = atoi (argv[i + 1]); i += 2; } if (argc > i && !strcmp (argv[i], "-flowM")) { pktperflow = atoi (argv[i + 1])*1048576LL/1000; i += 2; cout << "Using subflow count " << subflow_count << endl; } if (argc > i && !strcmp (argv[i], "-param")) { param = atoi (argv[i + 1]); i += 2; cout << "Using subflow count " << subflow_count << endl; } if (argc > i) { epsilon = -1; if (!strcmp (argv[i], "UNCOUPLED")) { algo = UNCOUPLED; } else if (!strcmp (argv[i], "COUPLED_INC")) { algo = COUPLED_INC; } else if (!strcmp (argv[i], "FULLY_COUPLED")) { algo = FULLY_COUPLED; } else if (!strcmp (argv[i], "COUPLED_TCP")) { algo = COUPLED_TCP; } else if (!strcmp (argv[i], "COUPLED_SCALABLE_TCP")) { algo = COUPLED_SCALABLE_TCP; } else if (!strcmp (argv[i], "COUPLED_EPSILON")) { algo = COUPLED_EPSILON; if (argc > i + 1) { epsilon = atof (argv[i + 1]); } printf ("Using epsilon %f\n", epsilon); } else { exit_error (argv[0]); } } } srand (time (NULL)); cout << "Using algo=" << algo << " epsilon=" << epsilon << endl; // prepare the loggers cout << "Logging to " << filename.str () << endl; //Logfile Logfile logfile (filename.str (), eventlist); #if PRINT_PATHS filename << ".paths"; cout << "Logging path choices to " << filename.str () << endl; std::ofstream paths (filename.str ().c_str ()); if (!paths) { cout << "Can't open for writing paths file!" << endl; exit (1); } #endif int tot_subs = 0; int cnt_con = 0; lg = &logfile; logfile.setStartTime (timeFromSec (0)); SinkLoggerSampling sinkLogger = SinkLoggerSampling (timeFromMs (1000), eventlist); logfile.addLogger (sinkLogger); //TcpLoggerSimple logTcp;logfile.addLogger(logTcp); TcpSrc *tcpSrc; TcpSink *tcpSnk; //CbrSrc* cbrSrc; //CbrSink* cbrSnk; route_t *routeout, *routein; double extrastarttime; TcpRtxTimerScanner tcpRtxScanner (timeFromMs (10), eventlist); MultipathTcpSrc *mtcp; vector<MultipathTcpSrc*> mptcpVector; int dest; #if USE_FIRST_FIT if (subflow_count == 1) { ff = new FirstFit (timeFromMs (FIRST_FIT_INTERVAL), eventlist); } #endif #ifdef FAT_TREE FatTreeTopology *top = new FatTreeTopology (&logfile, &eventlist, ff); #endif #ifdef OV_FAT_TREE OversubscribedFatTreeTopology *top = new OversubscribedFatTreeTopology (&logfile, &eventlist, ff); #endif #ifdef MH_FAT_TREE MultihomedFatTreeTopology *top = new MultihomedFatTreeTopology (&logfile, &eventlist, ff); #endif #ifdef STAR StarTopology *top = new StarTopology (&logfile, &eventlist, ff); #endif #ifdef BCUBE BCubeTopology *top = new BCubeTopology (&logfile, &eventlist, ff); cout << "BCUBE " << K << endl; #endif #ifdef VL2 VL2Topology *top = new VL2Topology (&logfile, &eventlist, ff); #endif vector < route_t * >***net_paths; net_paths = new vector < route_t * >**[N]; int *is_dest = new int[N]; for (int i = 0; i < N; i++) { is_dest[i] = 0; net_paths[i] = new vector < route_t * >*[N]; for (int j = 0; j < N; j++) { net_paths[i][j] = NULL; } } if (ff) { ff->net_paths = net_paths; } vector < int >*destinations; // Permutation connections ConnectionMatrix *conns = new ConnectionMatrix (N); //conns->setLocalTraffic(top); //cout << "Running perm with " << param << " connections" << endl; //conns->setPermutation(param); //conns->setStaggeredPermutation(top,(double)param/100.0); //conns->setStaggeredRandom(top,512,1); // conns->setHotspot(param,512/param); conns->setStride (3,0); //conns->setManytoMany(128); //conns->setVL2(); //conns->setRandom(param); map < int, vector < int >*>::iterator it; int connID = 0; for (it = conns->connections.begin (); it != conns->connections.end (); it++) { int src = (*it).first; destinations = (vector < int >*) (*it).second; vector < int >subflows_chosen; for (unsigned int dst_id = 0; dst_id < destinations->size (); dst_id++) { connID++; dest = destinations->at (dst_id); if (!net_paths[src][dest]) { net_paths[src][dest] = top->get_paths (src, dest); } /*bool cbr = 1; if (cbr){ cbrSrc = new CbrSrc(eventlist,speedFromPktps(7999),timeFromMs(0),timeFromMs(0)); cbrSnk = new CbrSink(); cbrSrc->setName("cbr_" + ntoa(src) + "_" + ntoa(dest)+"_"+ntoa(dst_id)); logfile.writeName(*cbrSrc); cbrSnk->setName("cbr_sink_" + ntoa(src) + "_" + ntoa(dest)+"_"+ntoa(dst_id)); logfile.writeName(*cbrSnk); // tell it the route if (net_paths[src][dest]->size()==1){ choice = 0; } else { choice = rand()%net_paths[src][dest]->size(); } routeout = new route_t(*(net_paths[src][dest]->at(choice))); routeout->push_back(cbrSnk); cbrSrc->connect(*routeout, *cbrSnk, timeFromMs(0)); } */ { //we should create multiple connections. How many? //if (connID%3!=0) //continue; for (int connection = 0; connection < 1; connection++) { if (algo == COUPLED_EPSILON) { mtcp = new MultipathTcpSrc (algo, eventlist, NULL, epsilon); } else { mtcp = new MultipathTcpSrc (algo, eventlist, NULL); } mptcpVector.push_back(mtcp); //uint64_t bb = generateFlowSize(); // if (subflow_control) //subflow_control->add_flow(src,dest,mtcp); subflows_chosen.clear (); int it_sub; int crt_subflow_count = subflow_count; tot_subs += crt_subflow_count; cnt_con++; it_sub = crt_subflow_count > net_paths[src][dest]-> size ()? net_paths[src][dest]->size () : crt_subflow_count; int use_all = it_sub == net_paths[src][dest]->size (); //if (connID%10!=0) //it_sub = 1; uint64_t pktpersubflow = pktperflow / it_sub; for (int inter = 0; inter < it_sub; inter++) { // if (connID%10==0){ tcpSrc = new TcpSrc (NULL, NULL, eventlist); tcpSrc->set_max_packets(pktpersubflow); tcpSnk = new TcpSink (); /*} else { tcpSrc = new TcpSrcTransfer(NULL,NULL,eventlist,bb,net_paths[src][dest]); tcpSnk = new TcpSinkTransfer(); } */ //if (connection==1) //tcpSrc->set_app_limit(9000); tcpSrc->setName ("mtcp_" + ntoa (src) + "_" + ntoa (inter) + "_" + ntoa (dest) + "(" + ntoa (connection) + ")"); logfile.writeName (*tcpSrc); tcpSnk->setName ("mtcp_sink_" + ntoa (src) + "_" + ntoa (inter) + "_" + ntoa (dest) + "(" + ntoa (connection) + ")"); logfile.writeName (*tcpSnk); tcpRtxScanner.registerTcp (*tcpSrc); /*int found; do { found = 0; //if (net_paths[src][dest]->size()==K*K/4 && it_sub <= K/2) //choice = rand()%(K/2); //else choice = rand()%net_paths[src][dest]->size(); for (unsigned int cnt = 0;cnt<subflows_chosen.size();cnt++){ if (subflows_chosen.at(cnt)==choice){ found = 1; break; } } }while(found); // */ int choice = 0; #ifdef FAT_TREE choice = rand () % net_paths[src][dest]->size (); #endif #ifdef OV_FAT_TREE choice = rand () % net_paths[src][dest]->size (); #endif #ifdef MH_FAT_TREE if (use_all) { choice = inter; } else { choice = rand () % net_paths[src][dest]->size (); } #endif #ifdef VL2 choice = rand () % net_paths[src][dest]->size (); #endif #ifdef STAR choice = 0; #endif #ifdef BCUBE //choice = inter; int min = -1, max = -1, minDist = 1000, maxDist = 0; if (subflow_count == 1) { //find shortest and longest path for (int dd = 0; dd < net_paths[src][dest]->size (); dd++) { if (net_paths[src][dest]->at (dd)->size () < minDist) { minDist = net_paths[src][dest]->at (dd)->size (); min = dd; } if (net_paths[src][dest]->at (dd)->size () > maxDist) { maxDist = net_paths[src][dest]->at (dd)->size (); max = dd; } } choice = min; } else { choice = rand () % net_paths[src][dest]->size (); } #endif //cout << "Choice "<<choice<<" out of "<<net_paths[src][dest]->size(); subflows_chosen.push_back (choice); /*if (net_paths[src][dest]->size()==K*K/4 && it_sub<=K/2){ int choice2 = rand()%(K/2); */ if (choice >= net_paths[src][dest]->size ()) { printf ("Weird path choice %d out of %u\n", choice, net_paths[src][dest]->size ()); exit (1); } #if PRINT_PATHS paths << "Route from " << ntoa (src) << " to " << ntoa (dest) << " (" << choice << ") -> "; print_path (paths, net_paths[src][dest]->at (choice)); #endif routeout = new route_t (*(net_paths[src][dest]->at (choice))); routeout->push_back (tcpSnk); routein = new route_t (); routein->push_back (tcpSrc); extrastarttime = 50 * drand (); //join multipath connection mtcp->addSubflow (tcpSrc); if (inter == 0) { mtcp->setName ("multipath" + ntoa (src) + "_" + ntoa (dest) + "(" + ntoa (connection) + ")"); logfile.writeName (*mtcp); } tcpSrc->connect (*routeout, *routein, *tcpSnk, timeFromMs (extrastarttime)); #ifdef PACKET_SCATTER tcpSrc->set_paths (net_paths[src][dest]); cout << "Using PACKET SCATTER!!!!" << endl << end; #endif if (ff && !inter) { ff->add_flow (src, dest, tcpSrc); } sinkLogger.monitorSink (tcpSnk); } } } } } //ShortFlows* sf = new ShortFlows(2560, eventlist, net_paths,conns,lg, &tcpRtxScanner); cout << "Mean number of subflows " << ntoa ((double) tot_subs / cnt_con) << endl; // Record the setup int pktsize = TcpPacket::DEFAULTDATASIZE; logfile.write ("# pktsize=" + ntoa (pktsize) + " bytes"); logfile.write ("# subflows=" + ntoa (subflow_count)); logfile.write ("# hostnicrate = " + ntoa (HOST_NIC) + " pkt/sec"); logfile.write ("# corelinkrate = " + ntoa (HOST_NIC * CORE_TO_HOST) + " pkt/sec"); //logfile.write("# buffer = " + ntoa((double) (queues_na_ni[0][1]->_maxsize) / ((double) pktsize)) + " pkt"); double rtt = timeAsSec (timeFromUs (RTT)); logfile.write ("# rtt =" + ntoa (rtt)); // GO! double last = 0.0; while (eventlist.doNextEvent ()) { if (timeAsMs(eventlist.now())>last+10.0) { cout << (last = timeAsMs(eventlist.now())) << endl; for (vector<MultipathTcpSrc*>::iterator iA = mptcpVector.begin(); iA!=mptcpVector.end(); iA++) { cout << (*iA)->compute_total_bytes()*0.001*0.001 <<" "; } cout << endl; } } }