Changes in benchmark/io/http/protocol.cfa [ef3c383:644162a]
- File:
-
- 1 edited
-
benchmark/io/http/protocol.cfa (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/protocol.cfa
ref3c383 r644162a 24 24 25 25 #include "options.hfa" 26 #include "worker.hfa"27 26 28 27 #define PLAINTEXT_1WRITE … … 157 156 158 157 count -= ret; 158 offset += ret; 159 159 size_t in_pipe = ret; 160 160 SPLICE2: while(in_pipe > 0) { … … 266 266 } 267 267 268 static inline int wait_and_process(header_g & this , sendfile_stats_t & stats) {268 static inline int wait_and_process(header_g & this) { 269 269 wait(this.f); 270 270 … … 295 295 } 296 296 297 stats.header++;298 299 297 // It must be a Short read 300 298 this.len -= this.f.result; … … 308 306 io_future_t f; 309 307 int fd; int pipe; size_t len; off_t off; 310 short zipf_idx;311 308 FSM_Result res; 312 309 }; … … 317 314 this.len = len; 318 315 this.off = 0; 319 this.zipf_idx = -1;320 STATS: for(i; zipf_cnts) {321 if(len <= zipf_sizes[i]) {322 this.zipf_idx = i;323 break STATS;324 }325 }326 if(this.zipf_idx < 0) mutex(serr) serr | "SPLICE IN" | len | " greated than biggest zipf file";327 316 } 328 317 … … 340 329 } 341 330 342 static inline int wait_and_process(splice_in_t & this , sendfile_stats_t & stats) {331 static inline int wait_and_process(splice_in_t & this) { 343 332 wait(this.f); 344 333 … … 356 345 return error(this.res, -ECONNRESET); 357 346 } 358 mutex(serr) serr | "SPLICE IN got" | error | ", WTF!";359 return error(this.res, -ECONNRESET);360 347 } 361 348 … … 370 357 return done(this.res); 371 358 } 372 373 stats.splcin++;374 stats.avgrd[this.zipf_idx].calls++;375 stats.avgrd[this.zipf_idx].bytes += this.f.result;376 359 377 360 // It must be a Short read … … 415 398 } 416 399 417 static inline void wait_and_process(splice_out_g & this , sendfile_stats_t & stats) {400 static inline void wait_and_process(splice_out_g & this) { 418 401 wait(this.f); 419 402 … … 431 414 return error(this, -ECONNRESET); 432 415 } 433 mutex(serr) serr | "SPLICE OUT got" | error | ", WTF!";434 return error(this, -ECONNRESET);435 416 } 436 417 … … 447 428 448 429 SHORT_WRITE: 449 stats.splcot++;450 451 430 // It must be a Short Write 452 431 this.len -= this.f.result; … … 455 434 } 456 435 457 int answer_sendfile( int pipe[2], int fd, int ans_fd, size_t fsize, sendfile_stats_t & stats ) { 458 stats.calls++; 436 int answer_sendfile( int pipe[2], int fd, int ans_fd, size_t fsize ) { 459 437 #if defined(LINKED_IO) 460 438 char buffer[512]; … … 465 443 466 444 RETRY_LOOP: for() { 467 stats.tries++;468 445 int have = need(header.res) + need(splice_in.res) + 1; 469 446 int idx = 0; … … 484 461 // we may need to kill the connection if it fails 485 462 // If it already completed, this is a no-op 486 wait_and_process(splice_in , stats);463 wait_and_process(splice_in); 487 464 488 465 if(is_error(splice_in.res)) { … … 492 469 493 470 // Process the other 2 494 wait_and_process(header , stats);495 wait_and_process(splice_out , stats);471 wait_and_process(header); 472 wait_and_process(splice_out); 496 473 497 474 if(is_done(splice_out.res)) { … … 513 490 return len + fsize; 514 491 #else 515 stats.tries++;516 492 int ret = answer_header(fd, fsize); 517 493 if( ret < 0 ) { close(fd); return ret; }
Note:
See TracChangeset
for help on using the changeset viewer.