Changeset 8c58e73
- Timestamp:
- Jun 8, 2022, 7:24:27 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 137974ae
- Parents:
- bbf61838
- Location:
- benchmark/io/http
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/main.cfa
rbbf61838 r8c58e73 163 163 #endif 164 164 165 options.clopts.instance[options.clopts.cltr_cnt] = &this.self; 166 options.clopts.cltr_cnt++; 165 options.clopts.instance = &this.self; 167 166 } 168 167 … … 268 267 Acceptor * acceptors = 0p; 269 268 Q * queues = 0p; 270 ServerCluster cl [options.clopts.nclusters];269 ServerCluster cl; 271 270 272 271 init_protocol(); … … 320 319 } 321 320 } 322 cl[0].prnt->conns = conns; 323 cl[0].prnt->conn_cnt = options.clopts.nworkers; 324 sout | options.clopts.nworkers | "workers started on" | options.clopts.nprocs | "processors /" | options.clopts.nclusters | "clusters"; 325 for(i; options.clopts.nclusters) { 326 sout | options.clopts.thrd_cnt[i] | nonl; 327 } 321 cl.prnt->conns = conns; 322 cl.prnt->conn_cnt = options.clopts.nworkers; 323 sout | options.clopts.nworkers | "workers started on" | options.clopts.nprocs | "processors"; 328 324 sout | nl; 329 325 { … … 440 436 441 437 sout | "Stopping printer threads..." | nonl; flush( sout ); 442 for(i; options.clopts.nclusters) { 443 StatsPrinter * p = cl[i].prnt; 444 if(p) { 445 notify_one(p->var); 446 join(*p); 447 } 438 StatsPrinter * p = cl.prnt; 439 if(p) { 440 notify_one(p->var); 441 join(*p); 448 442 } 449 443 sout | "done"; -
benchmark/io/http/options.cfa
rbbf61838 r8c58e73 42 42 43 43 { // cluster 44 1, // nclusters;45 44 1, // nprocs; 46 45 1, // nworkers; … … 53 52 54 53 void parse_options( int argc, char * argv[] ) { 55 // bool fixedfd = false;56 // bool sqkpoll = false;57 // bool iokpoll = false;58 54 unsigned nentries = 0; 59 bool isolate = false;60 61 62 55 static cfa_option opt[] = { 63 56 { 'p', "port", "Port the server will listen on", options.socket.port}, 64 57 { 'c', "cpus", "Number of processors to use", options.clopts.nprocs}, 65 58 { 't', "threads", "Number of worker threads to use", options.clopts.nworkers}, 66 {'\0', "isolate", "Create one cluster per processor", isolate, parse_settrue},67 59 {'\0', "log", "Enable logs", options.log, parse_settrue}, 68 60 {'\0', "sout", "Redirect standard out to file", options.reopen_stdout}, … … 99 91 nentries = v; 100 92 } 101 if(isolate) {102 options.clopts.nclusters = options.clopts.nprocs;103 options.clopts.nprocs = 1;104 }105 93 options.clopts.params.num_entries = nentries; 106 options.clopts.instance = alloc(options.clopts.nclusters); 107 options.clopts.thrd_cnt = alloc(options.clopts.nclusters); 108 options.clopts.cltr_cnt = 0; 109 for(i; options.clopts.nclusters) { 110 options.clopts.thrd_cnt[i] = 0; 111 } 94 options.clopts.instance = 0p; 95 options.clopts.thrd_cnt = 0; 112 96 113 97 -
benchmark/io/http/options.hfa
rbbf61838 r8c58e73 31 31 32 32 struct { 33 int nclusters;34 33 int nprocs; 35 34 int nworkers; … … 37 36 bool procstats; 38 37 bool viewhalts; 39 cluster ** instance; 40 size_t * thrd_cnt; 41 size_t cltr_cnt; 38 cluster * instance; 39 size_t thrd_cnt; 42 40 } clopts; 43 41 }; -
benchmark/io/http/worker.cfa
rbbf61838 r8c58e73 117 117 //============================================================================================= 118 118 void ?{}( AcceptWorker & this ) { 119 size_t cli = rand() % options.clopts.cltr_cnt; 120 ((thread&)this){ "Server Worker Thread", *options.clopts.instance[cli], 64000 }; 121 options.clopts.thrd_cnt[cli]++; 119 ((thread&)this){ "Server Worker Thread", *options.clopts.instance, 64000 }; 120 options.clopts.thrd_cnt++; 122 121 this.done = false; 123 122 } … … 151 150 //============================================================================================= 152 151 void ?{}( ChannelWorker & this ) { 153 size_t cli = rand() % options.clopts.cltr_cnt; 154 ((thread&)this){ "Server Worker Thread", *options.clopts.instance[cli], 64000 }; 155 options.clopts.thrd_cnt[cli]++; 152 ((thread&)this){ "Server Worker Thread", *options.clopts.instance, 64000 }; 153 options.clopts.thrd_cnt++; 156 154 this.done = false; 157 155 } … … 182 180 183 181 void ?{}( Acceptor & this ) { 184 size_t cli = rand() % options.clopts.cltr_cnt; 185 ((thread&)this){ "Server Worker Thread", *options.clopts.instance[cli], 64000 }; 186 options.clopts.thrd_cnt[cli]++; 182 ((thread&)this){ "Server Worker Thread", *options.clopts.instance, 64000 }; 183 options.clopts.thrd_cnt++; 187 184 this.done = false; 188 185 }
Note: See TracChangeset
for help on using the changeset viewer.