Changeset 2cd784a for benchmark/io/http/main.cfa
- Timestamp:
- Mar 2, 2021, 1:59:38 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d5006b1
- Parents:
- dddb3dd0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/main.cfa
rdddb3dd0 r2cd784a 38 38 } 39 39 40 void ^?{}( StatsPrinter & mutex this ) {} 41 40 42 void main(StatsPrinter & this) { 41 43 LOOP: for() { … … 54 56 // Globals 55 57 //============================================================================================= 56 // struct ServerProc {57 // processor self;58 // };59 60 // void ?{}( ServerProc & this ) {61 // /* paranoid */ assert( options.clopts.instance != 0p );62 // (this.self){ "Benchmark Processor", *options.clopts.instance };63 64 // #if !defined(__CFA_NO_STATISTICS__)65 // if( options.clopts.procstats ) {66 // print_stats_at_exit( this.self, options.clopts.instance->print_stats );67 // }68 // if( options.clopts.viewhalts ) {69 // print_halts( this.self );70 // }71 // #endif72 // }73 74 // struct ServerIoContext {75 // io_context self;76 // };77 78 // void ?{}( ServerIoContext & this ) {79 // /* paranoid */ assert( options.clopts.instance != 0p );80 // (this.self){ *options.clopts.instance };81 // }82 83 58 struct ServerCluster { 84 59 cluster self; 85 60 processor * procs; 86 io_context * ctxs;61 // io_context * ctxs; 87 62 StatsPrinter * prnt; 88 63 … … 106 81 } 107 82 108 this.ctxs = alloc(options.clopts.nprocs); 109 for(i; options.clopts.nprocs) { 110 (this.ctxs[i]){ this.self }; 111 } 112 113 this.prnt = alloc(options.clopts.nprocs); 114 for(i; options.clopts.nprocs) { 115 (this.prnt[i]){ this.self }; 83 if(options.stats) { 84 this.prnt = alloc(); 85 (*this.prnt){ this.self }; 86 } else { 87 this.prnt = 0p; 116 88 } 117 89 … … 125 97 126 98 void ^?{}( ServerCluster & this ) { 127 for(i; options.clopts.nprocs) { 128 ^(this.prnt[i]){}; 129 } 130 free(this.prnt); 131 132 for(i; options.clopts.nprocs) { 133 ^(this.ctxs[i]){}; 134 } 135 free(this.ctxs); 99 delete(this.prnt); 136 100 137 101 for(i; options.clopts.nprocs) { … … 250 214 { 251 215 char buffer[128]; 252 while(int ret = cfa_read(0, buffer, 128, 0); ret != 0) { 216 for() { 217 int ret = cfa_read(0, buffer, 128, 0); 218 if(ret == 0) break; 253 219 if(ret < 0) abort( "main read error: (%d) %s\n", (int)errno, strerror(errno) ); 220 sout | "User wrote '" | "" | nonl; 221 write(sout, buffer, ret - 1); 222 sout | "'"; 254 223 } 255 224
Note: See TracChangeset
for help on using the changeset viewer.