Changeset 2e9b59b for benchmark/io/http/protocol.cfa
- Timestamp:
- Apr 19, 2022, 3:00:04 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 5b84a321
- Parents:
- ba897d21 (diff), bb7c77d (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
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/protocol.cfa
rba897d21 r2e9b59b 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) { … … 249 249 } 250 250 251 static inline int wait_and_process(header_g & this ) {251 static inline int wait_and_process(header_g & this, sendfile_stats_t & stats) { 252 252 wait(this.f); 253 253 … … 278 278 } 279 279 280 stats.header++; 281 280 282 // It must be a Short read 281 283 this.len -= this.f.result; … … 289 291 io_future_t f; 290 292 int fd; int pipe; size_t len; off_t off; 293 short zipf_idx; 291 294 FSM_Result res; 292 295 }; … … 297 300 this.len = len; 298 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"; 299 310 } 300 311 … … 312 323 } 313 324 314 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 ) { 315 326 wait(this.f); 316 327 … … 328 339 return error(this.res, -ECONNRESET); 329 340 } 341 mutex(serr) serr | "SPLICE IN got" | error | ", WTF!"; 342 return error(this.res, -ECONNRESET); 330 343 } 331 344 … … 340 353 return done(this.res); 341 354 } 355 356 stats.splcin++; 357 stats.avgrd[this.zipf_idx].calls++; 358 stats.avgrd[this.zipf_idx].bytes += this.f.result; 342 359 343 360 // It must be a Short read … … 381 398 } 382 399 383 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 ) { 384 401 wait(this.f); 385 402 … … 397 414 return error(this, -ECONNRESET); 398 415 } 416 mutex(serr) serr | "SPLICE OUT got" | error | ", WTF!"; 417 return error(this, -ECONNRESET); 399 418 } 400 419 … … 411 430 412 431 SHORT_WRITE: 432 stats.splcot++; 433 413 434 // It must be a Short Write 414 435 this.len -= this.f.result; … … 417 438 } 418 439 419 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++; 420 442 #if defined(LINKED_IO) 421 443 char buffer[512]; … … 426 448 427 449 RETRY_LOOP: for() { 450 stats.tries++; 428 451 int have = need(header.res) + need(splice_in.res) + 1; 429 452 int idx = 0; … … 444 467 // we may need to kill the connection if it fails 445 468 // If it already completed, this is a no-op 446 wait_and_process(splice_in );469 wait_and_process(splice_in, stats); 447 470 448 471 if(is_error(splice_in.res)) { … … 452 475 453 476 // Process the other 2 454 wait_and_process(header );455 wait_and_process(splice_out );477 wait_and_process(header, stats); 478 wait_and_process(splice_out, stats); 456 479 457 480 if(is_done(splice_out.res)) { … … 473 496 return len + fsize; 474 497 #else 498 stats.tries++; 475 499 int ret = answer_header(fd, fsize); 476 500 if( ret < 0 ) { close(fd); return ret; }
Note:
See TracChangeset
for help on using the changeset viewer.