#include <logweb.h>
Inheritance diagram for LogWebTrafPool:


Definition at line 78 of file logweb.h.
Public Member Functions | |
| virtual int | delay_bind_dispatch (const char *, const char *, TclObject *) |
| virtual void | delay_bind_init_all () |
| void | doneSession (int idx) |
| int | find_server (int) |
| int | isdebug () |
| void | launchReq (Node *, void *, int, int) |
| void | launchResp (int, Node *, Node *, Agent *, Agent *, int, void *) |
| LogWebTrafPool () | |
| int | nSink () |
| int | nTcp () |
| int | num_pages () const |
| int | num_pages () const |
| void | pick_ep (TcpAgent **, Agent **) |
| Node * | pickdst () |
| TcpSink * | picksink () |
| Node * | picksrc () |
| TcpAgent * | picktcp () |
| int | run () |
| virtual | ~LogWebTrafPool () |
Protected Member Functions | |
| virtual int | command (int argc, const char *const *argv) |
| Agent * | detachHead (AgentList *l) |
| void | insertAgent (AgentList *l, Agent *a) |
| LIST_HEAD (AgentList, AgentListElem) | |
| TclObject * | lookup_obj (const char *name) |
| TclObject * | lookup_obj (const char *name) |
| int | lookup_rv (RandomVariable *&rv, const char *name) |
Protected Attributes | |
| int | asimflag_ |
| Node ** | client_ |
| int | dbTcp_a |
| int | dbTcp_cr |
| int | dbTcp_r |
| int | debug_ |
| int | dont_recycle_ |
| int | duration_ |
| double | end_time_ |
| int | fulltcp_ |
| int | nClient_ |
| int | nServer_ |
| int | nSession_ |
| int | nSink_ |
| int | nTcp_ |
| int | num_pages_ |
| int | recycle_page_ |
| WebServer * | server_ |
| WebTrafSession ** | session_ |
| AgentList | sinkPool_ |
| double | start_time_ |
| AgentList | tcpPool_ |
Private Member Functions | |
| int | launchReq (int, int, int) |
| int | loadLog (const char *) |
| Node * | pickdst (int) |
| Node * | picksrc (int) |
| int | processLog () |
| int | start () |
Private Attributes | |
| FILE * | fp |
| request_s | next_req |
| int | num_obj |
| RequestTimer * | req_timer |
| double | start_t |
|
|
Definition at line 77 of file logweb.cc. References request_s::client, next_req, num_obj, req_timer, request_s::server, request_s::size, start_t, and request_s::time. 00077 { 00078 num_obj = 0; 00079 // initialize next request 00080 next_req.time = 0; 00081 next_req.client = 0; 00082 next_req.server = 0; 00083 next_req.size = 0; 00084 00085 // initialize request timer 00086 req_timer = new RequestTimer(this); 00087 start_t = 0; 00088 }
|
|
|
Definition at line 90 of file logweb.cc.
|
|
||||||||||||
|
Reimplemented from WebTrafPool. Definition at line 171 of file logweb.cc. References WebTrafPool::command(), loadLog(), and start(). 00171 { 00172 if (argc == 2) { 00173 if (strcmp(argv[1], "start") == 0) { 00174 if (start()) 00175 return (TCL_OK); 00176 else 00177 return (TCL_ERROR); 00178 00179 } 00180 00181 } else if (argc == 3) { 00182 if (strcmp(argv[1], "loadLog") == 0) { 00183 if (loadLog(argv[2])) 00184 return (TCL_OK); 00185 else 00186 return (TCL_ERROR); 00187 00188 } else if (strcmp(argv[1], "doneObj") == 0) { 00189 return (TCL_OK); 00190 } 00191 } 00192 return WebTrafPool::command(argc, argv); 00193 }
Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Definition at line 271 of file webtraf.cc. References WebTrafPool::debug_. 00273 { 00274 if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer)) 00275 return TCL_OK; 00276 return PagePool::delay_bind_dispatch(varName, localName, tracer); 00277 }
|
|
|
Definition at line 265 of file webtraf.cc.
|
|
|
Definition at line 178 of file webtraf.h. References a, WebTrafPool::AgentListElem::agt_, and LIST_REMOVE. Referenced by WebTrafPool::picksink(), and WebTrafPool::picktcp(). 00178 { 00179 AgentListElem *e = l->lh_first; 00180 if (e == NULL) 00181 return NULL; 00182 Agent *a = e->agt_; 00183 LIST_REMOVE(e, link); 00184 delete e; 00185 return a; 00186 }
|
|
|
Definition at line 117 of file webtraf.h. References WebTrafPool::isdebug(), WebTrafPool::nSession_, and WebTrafPool::session_. 00117 { 00118 assert((idx>=0) && (idx<nSession_) && (session_[idx]!=NULL)); 00119 if (isdebug()) 00120 printf("deleted session %d\n", idx); 00121 delete session_[idx]; 00122 session_[idx] = NULL; 00123 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 405 of file webtraf.cc. References WebTrafPool::nServer_, and WebTrafPool::server_. 00405 { 00406 int n = 0; 00407 while (server_[n].get_nid() != sid && n < nServer_) { 00408 n++; 00409 } 00410 00411 return(n); 00412 }
|
|
||||||||||||
|
Definition at line 174 of file webtraf.h. References WebTrafPool::AgentListElem::AgentListElem(), and LIST_INSERT_HEAD. 00174 { 00175 AgentListElem *e = new AgentListElem(a); 00176 LIST_INSERT_HEAD(l, e, link); 00177 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 129 of file webtraf.h. References WebTrafPool::debug_. Referenced by WebTrafSession::donePage(), WebTrafPool::doneSession(), WebTrafSession::expire(), and WebPage::expire(). 00129 { return debug_; }
|
|
||||||||||||||||||||
|
Definition at line 353 of file webtraf.cc. References Node::address(), Scheduler::clock(), WebPage::dst(), WebPage::id(), Scheduler::instance(), WebTrafPool::nSink(), WebTrafPool::nTcp(), and WebTrafPool::pick_ep(). Referenced by WebTrafSession::launchReq(). 00353 { 00354 TcpAgent *ctcp; 00355 Agent *csnk; 00356 00357 // Allocation new TCP connections for both directions 00358 pick_ep(&ctcp, &csnk); 00359 00360 WebPage* pg = (WebPage*)ClntData; 00361 00362 // Setup TCP connection and done 00363 Tcl::instance().evalf("%s launch-req %d %d %s %s %s %s %d %d", 00364 name(), obj, pg->id(), 00365 src_->name(), pg->dst()->name(), 00366 ctcp->name(), csnk->name(), size, ClntData); 00367 00368 // Debug only 00369 // $numPacket_ $objectId_ $pageId_ $sessionId_ [$ns_ now] src dst 00370 #if 0 00371 printf("%d \t %d \t %d \t %d \t %g %d %d\n", size, obj, pg->id(), id_, 00372 Scheduler::instance().clock(), 00373 src_->address(), pg->dst()->address()); 00374 printf("** Tcp agents %d, Tcp sinks %d\n", nTcp(),nSink()); 00375 #endif 00376 }
Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Definition at line 149 of file logweb.cc. References client, num_obj, WebTrafPool::pick_ep(), WebTrafPool::pickdst(), WebTrafPool::picksrc(), and server. Referenced by run(). 00149 { 00150 TcpAgent *tcp; 00151 Agent *snk; 00152 00153 // Allocation new TCP connections for both directions 00154 pick_ep(&tcp, &snk); 00155 00156 // pick client and server nodes 00157 Node* client = picksrc(cid); 00158 Node* server = pickdst(sid); 00159 00160 int num_pkt = size / 1000 + 1; 00161 00162 // Setup TCP connection and done 00163 Tcl::instance().evalf("%s launch-req %d %d %s %s %s %s %d %d", 00164 name(), num_obj++, num_obj, 00165 client->name(), server->name(), 00166 tcp->name(), snk->name(), num_pkt, NULL); 00167 00168 return(1); 00169 }
Here is the call graph for this function: ![]() |
|
||||||||||||||||||||||||||||||||
|
Definition at line 379 of file webtraf.cc. References Scheduler::clock(), WebPage::id(), Scheduler::instance(), WebTrafPool::nSink(), and WebTrafPool::nTcp(). Referenced by WebServer::job_arrival(), and WebServer::job_departure(). 00379 { 00380 int pid; 00381 pid = obj_id; 00382 00383 // Get webpage (client data) if any 00384 if (ClntData) { 00385 WebPage* pg = (WebPage*)ClntData; 00386 pid = pg->id(); 00387 } 00388 00389 // Setup TCP connection and done 00390 Tcl::instance().evalf("%s launch-resp %d %d %s %s %s %s %d %d", 00391 name(), obj_id, pid, svr_->name(), clnt_->name(), 00392 tcp->name(), snk->name(), size, ClntData); 00393 00394 // Debug only 00395 // $numPacket_ $objectId_ $pageId_ $sessionId_ [$ns_ now] src dst 00396 #if 0 00397 printf("%d \t %d \t %d \t %d \t %g %d %d\n", size, obj, pg->id(), id_, 00398 Scheduler::instance().clock(), 00399 src_->address(), pg->dst()->address()); 00400 printf("** Tcp agents %d, Tcp sinks %d\n", nTcp(),nSink()); 00401 #endif 00402 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
|
|
|
Definition at line 96 of file logweb.cc. References fp. Referenced by command(). 00096 { 00097 fp = fopen(filename, "r"); 00098 if (fp == 0) 00099 return(0); 00100 00101 return(1); 00102 }
|
|
|
Definition at line 273 of file pagepool.h. 00273 { 00274 TclObject* obj = Tcl::instance().lookup(name); 00275 if (obj == NULL) 00276 fprintf(stderr, "Bad object name %s\n", name); 00277 return obj; 00278 }
|
|
|
Definition at line 30 of file persconn.h. Referenced by EmpFtpTrafPool::command(), WebTrafPool::lookup_rv(), EmpWebTrafPool::lookup_rv(), EmpFtpTrafPool::lookup_rv(), WebTrafPool::picksink(), EmpWebTrafPool::picksink(), EmpFtpTrafPool::picksink(), WebTrafPool::picktcp(), EmpWebTrafPool::picktcp(), and EmpFtpTrafPool::picktcp(). 00030 { 00031 TclObject* obj = Tcl::instance().lookup(name); 00032 if (obj == NULL) 00033 fprintf(stderr, "Bad object name %s\n", name); 00034 return obj; 00035 }
|
|
||||||||||||
|
Definition at line 193 of file webtraf.h. References PagePool::lookup_obj(). 00193 { 00194 if (rv != NULL) 00195 Tcl::instance().evalf("delete %s", rv->name()); 00196 rv = (RandomVariable*)lookup_obj(name); 00197 return rv ? (TCL_OK) : (TCL_ERROR); 00198 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 128 of file webtraf.h. References WebTrafPool::nSink_. Referenced by WebTrafPool::launchReq(), and WebTrafPool::launchResp(). 00128 { return nSink_; }
|
|
|
Definition at line 127 of file webtraf.h. References WebTrafPool::nTcp_. Referenced by WebTrafPool::launchReq(), and WebTrafPool::launchResp(). 00127 { return nTcp_; }
|
|
|
Definition at line 264 of file pagepool.h. References PagePool::num_pages_. 00264 { return num_pages_; }
|
|
|
Definition at line 21 of file persconn.h. References PagePool::num_pages_. 00021 { return num_pages_; }
|
|
||||||||||||
|
Definition at line 340 of file webtraf.cc. References WebTrafPool::fulltcp_, WebTrafPool::picksink(), and WebTrafPool::picktcp(). Referenced by WebTrafPool::launchReq(), and launchReq(). 00340 { 00341 // Choose source 00342 *tcp = picktcp(); 00343 00344 // Choose destination 00345 if (fulltcp_) { 00346 *snk = picktcp(); 00347 } else { 00348 *snk = picksink(); 00349 } 00350 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 333 of file webtraf.cc. References WebTrafPool::nServer_, WebTrafPool::server_, and Random::uniform(). Referenced by WebTrafSession::expire(), and launchReq(). 00333 { 00334 int n = int(floor(Random::uniform(0, nServer_))); 00335 assert((n >= 0) && (n < nServer_)); 00336 return(server_[n].get_node()); 00337 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 143 of file logweb.cc. References WebServer::get_node(), WebTrafPool::nServer_, and WebTrafPool::server_. 00143 { 00144 int n = id % nServer_; 00145 assert((n >= 0) && (n < nServer_)); 00146 return server_[n].get_node(); 00147 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 311 of file webtraf.cc. References a, abort(), WebTrafPool::detachHead(), PagePool::lookup_obj(), WebTrafPool::nSink_, and WebTrafPool::sinkPool_. Referenced by WebTrafPool::pick_ep(). 00312 { 00313 TcpSink* a = (TcpSink*)detachHead(&sinkPool_); 00314 if (a == NULL) { 00315 Tcl& tcl = Tcl::instance(); 00316 tcl.evalf("%s alloc-tcp-sink", name()); 00317 a = (TcpSink*)lookup_obj(tcl.result()); 00318 if (a == NULL) { 00319 fprintf(stderr, "Failed to allocate a TCP sink\n"); 00320 abort(); 00321 } 00322 } else 00323 nSink_--; 00324 return a; 00325 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 327 of file webtraf.cc. References WebTrafPool::client_, WebTrafPool::nClient_, and Random::uniform(). Referenced by launchReq(). 00327 { 00328 int n = int(floor(Random::uniform(0, nClient_))); 00329 assert((n >= 0) && (n < nClient_)); 00330 return client_[n]; 00331 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 137 of file logweb.cc. References WebTrafPool::client_, and WebTrafPool::nClient_. 00137 { 00138 int n = id % nClient_; 00139 assert((n >= 0) && (n < nClient_)); 00140 return client_[n]; 00141 }
|
|
|
Definition at line 294 of file webtraf.cc. References a, abort(), WebTrafPool::detachHead(), PagePool::lookup_obj(), WebTrafPool::nTcp_, and WebTrafPool::tcpPool_. Referenced by WebTrafPool::pick_ep(). 00295 { 00296 TcpAgent* a = (TcpAgent*)detachHead(&tcpPool_); 00297 if (a == NULL) { 00298 Tcl& tcl = Tcl::instance(); 00299 tcl.evalf("%s alloc-tcp", name()); 00300 a = (TcpAgent*)lookup_obj(tcl.result()); 00301 if (a == NULL) { 00302 fprintf(stderr, "Failed to allocate a TCP agent\n"); 00303 abort(); 00304 } 00305 } else 00306 nTcp_--; 00307 //printf("A# %d\n", dbTcp_a++); 00308 return a; 00309 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 110 of file logweb.cc. References request_s::client, client, Scheduler::clock(), fp, Scheduler::instance(), next_req, req_timer, TimerHandler::resched(), request_s::server, server, request_s::size, start_t, and request_s::time. Referenced by run(), and start(). 00110 { 00111 int time, client, server, size; 00112 00113 if (!feof(fp)) { 00114 fscanf(fp, "%d %d %d %d\n", &time, &client, &server, &size); 00115 // save information for next request 00116 next_req.time = time; 00117 next_req.client = client; 00118 next_req.server = server; 00119 next_req.size = size; 00120 00121 double now = Scheduler::instance().clock(); 00122 double delay = time + start_t - now; 00123 req_timer->resched(delay); 00124 00125 return(1); 00126 00127 } else 00128 return(0); 00129 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 131 of file logweb.cc. References request_s::client, launchReq(), next_req, processLog(), request_s::server, and request_s::size. Referenced by RequestTimer::expire(). 00131 { 00132 launchReq(next_req.client, next_req.server, next_req.size); 00133 processLog(); 00134 return(1); 00135 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 104 of file logweb.cc. References Scheduler::clock(), Scheduler::instance(), processLog(), and start_t. Referenced by command(). 00104 { 00105 start_t = Scheduler::instance().clock(); 00106 processLog(); 00107 return(1); 00108 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 162 of file webtraf.h. Referenced by WebTrafPool::command(), and WebTrafPool::WebTrafPool(). |
|
|
Definition at line 159 of file webtraf.h. Referenced by WebTrafPool::command(), WebTrafPool::picksrc(), picksrc(), and WebTrafPool::~WebTrafPool(). |
|
|
Definition at line 188 of file webtraf.h. Referenced by WebTrafPool::WebTrafPool(). |
|
|
Definition at line 188 of file webtraf.h. Referenced by WebTrafPool::WebTrafPool(). |
|
|
Definition at line 188 of file webtraf.h. Referenced by WebTrafPool::WebTrafPool(). |
|
|
Definition at line 199 of file webtraf.h. Referenced by WebTrafPool::delay_bind_dispatch(), and WebTrafPool::isdebug(). |
|
|
Definition at line 205 of file webtraf.h. Referenced by WebTrafPool::WebTrafPool(). |
|
|
Definition at line 27 of file persconn.h. Referenced by ProxyTracePagePool::command(), CompMathPagePool::command(), MathPagePool::command(), TracePagePool::command(), MediaPagePool::command(), and MediaPagePool::MediaPagePool(). |
|
|
Definition at line 26 of file persconn.h. Referenced by CompMathPagePool::command(), MathPagePool::command(), TracePagePool::command(), MediaPagePool::command(), and TracePagePool::load_page(). |
|
|
Definition at line 89 of file logweb.h. Referenced by loadLog(), processLog(), and ~LogWebTrafPool(). |
|
|
Definition at line 201 of file webtraf.h. Referenced by WebTrafPool::pick_ep(), and WebTrafPool::WebTrafPool(). |
|
|
Definition at line 158 of file webtraf.h. Referenced by WebTrafPool::command(), WebTrafPool::picksrc(), and picksrc(). |
|
|
Definition at line 94 of file logweb.h. Referenced by LogWebTrafPool(), processLog(), and run(). |
|
|
Definition at line 152 of file webtraf.h. Referenced by WebTrafPool::command(), WebTrafPool::find_server(), WebTrafPool::pickdst(), and pickdst(). |
|
|
Definition at line 148 of file webtraf.h. Referenced by WebTrafPool::command(), WebTrafPool::doneSession(), and WebTrafPool::~WebTrafPool(). |
|
|
Definition at line 187 of file webtraf.h. Referenced by WebTrafPool::nSink(), and WebTrafPool::picksink(). |
|
|
Definition at line 187 of file webtraf.h. Referenced by WebTrafPool::nTcp(), and WebTrafPool::picktcp(). |
|
|
Definition at line 90 of file logweb.h. Referenced by launchReq(), and LogWebTrafPool(). |
|
|
|
Definition at line 203 of file webtraf.h. Referenced by WebTrafPool::WebTrafPool(). |
|
|
Definition at line 93 of file logweb.h. Referenced by LogWebTrafPool(), processLog(), and ~LogWebTrafPool(). |
|
|
Definition at line 155 of file webtraf.h. Referenced by WebTrafPool::command(), WebTrafPool::find_server(), WebTrafPool::pickdst(), pickdst(), and WebTrafPool::~WebTrafPool(). |
|
|
Definition at line 149 of file webtraf.h. Referenced by WebTrafPool::command(), WebTrafPool::doneSession(), and WebTrafPool::~WebTrafPool(). |
|
|
Definition at line 190 of file webtraf.h. Referenced by WebTrafPool::picksink(), and WebTrafPool::WebTrafPool(). |
|
|
Definition at line 92 of file logweb.h. Referenced by LogWebTrafPool(), processLog(), and start(). |
|
|
Definition at line 25 of file persconn.h. Referenced by TracePagePool::change_time(), ProxyTracePagePool::command(), CompMathPagePool::command(), MathPagePool::command(), TracePagePool::command(), MediaPagePool::command(), TracePagePool::load_page(), and ProxyTracePagePool::load_req(). |
|
|
Definition at line 189 of file webtraf.h. Referenced by WebTrafPool::picktcp(), and WebTrafPool::WebTrafPool(). |
1.4.6