Changeset 92538ab for benchmark/io/http/protocol.cfa
- Timestamp:
- Apr 10, 2022, 2:53:18 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- d8e2a09
- Parents:
- 4559b34 (diff), 6256891 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
benchmark/io/http/protocol.cfa (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/protocol.cfa
r4559b34 r92538ab 24 24 25 25 #include "options.hfa" 26 #include "worker.hfa" 26 27 27 28 #define PLAINTEXT_1WRITE … … 156 157 157 158 count -= ret; 158 offset += ret;159 159 size_t in_pipe = ret; 160 160 SPLICE2: while(in_pipe > 0) { … … 173 173 } 174 174 175 static void zero_sqe(struct io_uring_sqe * sqe) {176 sqe->flags = 0;177 sqe->ioprio = 0;178 sqe->fd = 0;179 sqe->off = 0;180 sqe->addr = 0;181 sqe->len = 0;182 sqe->fsync_flags = 0;183 sqe->__pad2[0] = 0;184 sqe->__pad2[1] = 0;185 sqe->__pad2[2] = 0;186 sqe->fd = 0;187 sqe->off = 0;188 sqe->addr = 0;189 sqe->len = 0;190 }191 192 175 enum FSM_STATE { 193 176 Initial, … … 266 249 } 267 250 268 static inline int wait_and_process(header_g & this ) {251 static inline int wait_and_process(header_g & this, sendfile_stats_t & stats) { 269 252 wait(this.f); 270 253 … … 295 278 } 296 279 280 stats.header++; 281 297 282 // It must be a Short read 298 283 this.len -= this.f.result; … … 306 291 io_future_t f; 307 292 int fd; int pipe; size_t len; off_t off; 293 short zipf_idx; 308 294 FSM_Result res; 309 295 }; … … 314 300 this.len = len; 315 301 this.off = 0; 302 this.zipf_idx = -1; 303 STATS: for(i; zipf_cnts) { 304 if(len <= zipf_sizes[i]) { 305 this.zipf_idx = i; 306 break STATS; 307 } 308 } 309 if(this.zipf_idx < 0) mutex(serr) serr | "SPLICE IN" | len | " greated than biggest zipf file"; 316 310 } 317 311 … … 329 323 } 330 324 331 static inline int wait_and_process(splice_in_t & this ) {325 static inline int wait_and_process(splice_in_t & this, sendfile_stats_t & stats ) { 332 326 wait(this.f); 333 327 … … 345 339 return error(this.res, -ECONNRESET); 346 340 } 341 mutex(serr) serr | "SPLICE IN got" | error | ", WTF!"; 342 return error(this.res, -ECONNRESET); 347 343 } 348 344 … … 357 353 return done(this.res); 358 354 } 355 356 stats.splcin++; 357 stats.avgrd[this.zipf_idx].calls++; 358 stats.avgrd[this.zipf_idx].bytes += this.f.result; 359 359 360 360 // It must be a Short read … … 398 398 } 399 399 400 static inline void wait_and_process(splice_out_g & this ) {400 static inline void wait_and_process(splice_out_g & this, sendfile_stats_t & stats ) { 401 401 wait(this.f); 402 402 … … 414 414 return error(this, -ECONNRESET); 415 415 } 416 mutex(serr) serr | "SPLICE OUT got" | error | ", WTF!"; 417 return error(this, -ECONNRESET); 416 418 } 417 419 … … 428 430 429 431 SHORT_WRITE: 432 stats.splcot++; 433 430 434 // It must be a Short Write 431 435 this.len -= this.f.result; … … 434 438 } 435 439 436 int answer_sendfile( int pipe[2], int fd, int ans_fd, size_t fsize ) { 440 int answer_sendfile( int pipe[2], int fd, int ans_fd, size_t fsize, sendfile_stats_t & stats ) { 441 stats.calls++; 437 442 #if defined(LINKED_IO) 438 443 char buffer[512]; … … 443 448 444 449 RETRY_LOOP: for() { 450 stats.tries++; 445 451 int have = need(header.res) + need(splice_in.res) + 1; 446 452 int idx = 0; … … 461 467 // we may need to kill the connection if it fails 462 468 // If it already completed, this is a no-op 463 wait_and_process(splice_in );469 wait_and_process(splice_in, stats); 464 470 465 471 if(is_error(splice_in.res)) { … … 469 475 470 476 // Process the other 2 471 wait_and_process(header );472 wait_and_process(splice_out );477 wait_and_process(header, stats); 478 wait_and_process(splice_out, stats); 473 479 474 480 if(is_done(splice_out.res)) { … … 490 496 return len + fsize; 491 497 #else 498 stats.tries++; 492 499 int ret = answer_header(fd, fsize); 493 500 if( ret < 0 ) { close(fd); return ret; }
Note:
See TracChangeset
for help on using the changeset viewer.