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