Ignore:
Timestamp:
Apr 19, 2022, 3:00:04 PM (3 years ago)
Author:
m3zulfiq <m3zulfiq@…>
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.
Message:

added benchmark and evaluations chapter to thesis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/protocol.cfa

    rba897d21 r2e9b59b  
    2424
    2525#include "options.hfa"
     26#include "worker.hfa"
    2627
    2728#define PLAINTEXT_1WRITE
     
    156157
    157158                count -= ret;
    158                 offset += ret;
    159159                size_t in_pipe = ret;
    160160                SPLICE2: while(in_pipe > 0) {
     
    249249}
    250250
    251 static inline int wait_and_process(header_g & this) {
     251static inline int wait_and_process(header_g & this, sendfile_stats_t & stats) {
    252252        wait(this.f);
    253253
     
    278278        }
    279279
     280        stats.header++;
     281
    280282        // It must be a Short read
    281283        this.len  -= this.f.result;
     
    289291        io_future_t f;
    290292        int fd; int pipe; size_t len; off_t off;
     293        short zipf_idx;
    291294        FSM_Result res;
    292295};
     
    297300        this.len = len;
    298301        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";
    299310}
    300311
     
    312323}
    313324
    314 static inline int wait_and_process(splice_in_t & this) {
     325static inline int wait_and_process(splice_in_t & this, sendfile_stats_t & stats ) {
    315326        wait(this.f);
    316327
     
    328339                        return error(this.res, -ECONNRESET);
    329340                }
     341                mutex(serr) serr | "SPLICE IN got" | error | ", WTF!";
     342                return error(this.res, -ECONNRESET);
    330343        }
    331344
     
    340353                return done(this.res);
    341354        }
     355
     356        stats.splcin++;
     357        stats.avgrd[this.zipf_idx].calls++;
     358        stats.avgrd[this.zipf_idx].bytes += this.f.result;
    342359
    343360        // It must be a Short read
     
    381398}
    382399
    383 static inline void wait_and_process(splice_out_g & this) {
     400static inline void wait_and_process(splice_out_g & this, sendfile_stats_t & stats ) {
    384401        wait(this.f);
    385402
     
    397414                        return error(this, -ECONNRESET);
    398415                }
     416                mutex(serr) serr | "SPLICE OUT got" | error | ", WTF!";
     417                return error(this, -ECONNRESET);
    399418        }
    400419
     
    411430
    412431SHORT_WRITE:
     432        stats.splcot++;
     433
    413434        // It must be a Short Write
    414435        this.len -= this.f.result;
     
    417438}
    418439
    419 int answer_sendfile( int pipe[2], int fd, int ans_fd, size_t fsize ) {
     440int answer_sendfile( int pipe[2], int fd, int ans_fd, size_t fsize, sendfile_stats_t & stats ) {
     441        stats.calls++;
    420442        #if defined(LINKED_IO)
    421443                char buffer[512];
     
    426448
    427449                RETRY_LOOP: for() {
     450                        stats.tries++;
    428451                        int have = need(header.res) + need(splice_in.res) + 1;
    429452                        int idx = 0;
     
    444467                        // we may need to kill the connection if it fails
    445468                        // If it already completed, this is a no-op
    446                         wait_and_process(splice_in);
     469                        wait_and_process(splice_in, stats);
    447470
    448471                        if(is_error(splice_in.res)) {
     
    452475
    453476                        // 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);
    456479
    457480                        if(is_done(splice_out.res)) {
     
    473496                return len + fsize;
    474497        #else
     498                stats.tries++;
    475499                int ret = answer_header(fd, fsize);
    476500                if( ret < 0 ) { close(fd); return ret; }
Note: See TracChangeset for help on using the changeset viewer.