- Timestamp:
- Jun 10, 2022, 5:35:55 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 1f0ee71
- Parents:
- 8419b76
- Location:
- benchmark/io/http
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/socket.cfa
r8419b76 r07997cd 27 27 int listener(struct sockaddr_in & address, int addrlen) { 28 28 int type = SOCK_STREAM; 29 if(options.socket.reuseport) type |= SOCK_NONBLOCK;29 // if(options.socket.reuseport) type |= SOCK_NONBLOCK; 30 30 int sockfd = socket(AF_INET, type, 0); 31 31 if(sockfd < 0) { -
benchmark/io/http/worker.cfa
r8419b76 r07997cd 189 189 } 190 190 191 #define ACCEPT_SPIN 191 static inline __s32 get_res( io_future_t & this ) { 192 if( this.result < 0 ) {{ 193 errno = -this.result; 194 return -1; 195 }} 196 return this.result; 197 } 198 199 static inline void push_connection( Acceptor & this, int fd ) { 200 PendingRead * p = 0p; 201 for() { 202 if(this.done) return; 203 p = pop(*this.queue); 204 if(p) break; 205 yield(); 206 this.stats.creates++; 207 }; 208 209 p->out.fd = fd; 210 async_recv(p->f, p->out.fd, p->in.buf, p->in.len, 0, CFA_IO_LAZY); 211 } 212 213 // #define ACCEPT_SPIN 214 #define ACCEPT_MANY 192 215 193 216 void main( Acceptor & this ) { … … 215 238 if( options.log ) sout | "=== New connection" | fd | "" | ", waiting for requests ==="; 216 239 217 if(fd) { 218 PendingRead * p = 0p; 219 for() { 220 if(this.done) return; 221 p = pop(*this.queue); 222 if(p) break; 223 yield(); 224 this.stats.creates++; 225 }; 226 227 p->out.fd = fd; 228 async_recv(p->f, p->out.fd, p->in.buf, p->in.len, 0, CFA_IO_LAZY); 229 } 240 if(fd) push_connection(this, fd); 230 241 231 242 if (stats_thrd) { … … 243 254 } 244 255 245 #elif define (ACCEPT_MANY)256 #elif defined(ACCEPT_MANY) 246 257 const int nacc = 10; 247 258 io_future_t results[nacc];
Note: See TracChangeset
for help on using the changeset viewer.