Changeset 4f762d3


Ignore:
Timestamp:
Feb 19, 2021, 1:48:14 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
d60d30e
Parents:
78da4ab
Message:

Fix httpforall after changes to I/O

Location:
benchmark/io/http
Files:
6 edited

Legend:

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

    r78da4ab r4f762d3  
    4747                }
    4848        #endif
     49}
     50
     51struct ServerIoContext {
     52        io_context self;
     53};
     54
     55void ?{}( ServerIoContext & this ) {
     56        /* paranoid */ assert( options.clopts.instance != 0p );
     57        (this.self){ *options.clopts.instance };
    4958}
    5059
     
    153162                }
    154163
    155                 if(options.file_cache.path && options.file_cache.fixed_fds) {
    156                         register_fixed_files(cl, fds, pipe_off);
    157                 }
     164                // if(options.file_cache.path && options.file_cache.fixed_fds) {
     165                //      register_fixed_files(cl, fds, pipe_off);
     166                // }
    158167
    159168                {
    160169                        ServerProc procs[options.clopts.nprocs];
    161                         StatsPrinter printer;
     170                        ServerIoContext ioctxs[options.clopts.nprocs];
     171                        // StatsPrinter printer;
    162172
    163173                        init_protocol();
     
    183193                                {
    184194                                        char buffer[128];
    185                                         while(int ret = cfa_read(0, buffer, 128, 0, -1`s, 0p, 0p); ret != 0) {
     195                                        while(int ret = cfa_read(0, buffer, 128, 0); ret != 0) {
    186196                                                if(ret < 0) abort( "main read error: (%d) %s\n", (int)errno, strerror(errno) );
    187197                                        }
     
    193203                                for(i; options.clopts.nworkers) {
    194204                                        workers[i].done = true;
    195                                         cancel(workers[i].cancel);
    196205                                }
    197206                                sout | "done";
  • benchmark/io/http/options.cfa

    r78da4ab r4f762d3  
    4646
    4747void parse_options( int argc, char * argv[] ) {
    48         bool subthrd = false;
    49         bool eagrsub = false;
    50         bool fixedfd = false;
    51         bool sqkpoll = false;
    52         bool iokpoll = false;
    53         unsigned sublen = 16;
     48        // bool fixedfd = false;
     49        // bool sqkpoll = false;
     50        // bool iokpoll = false;
    5451        unsigned nentries = 16;
    5552
     
    6562                {'\0', "cache-size",     "Size of the cache to use, if set to small, will uses closes power of 2", options.file_cache.size },
    6663                {'\0', "list-files",     "List the files in the specified path and exit", options.file_cache.list, parse_settrue },
    67                 { 's', "submitthread",   "If set, cluster uses polling thread to submit I/O", subthrd, parse_settrue },
    68                 { 'e', "eagersubmit",    "If set, cluster submits I/O eagerly but still aggregates submits", eagrsub, parse_settrue},
    69                 { 'f', "fixed-fds",      "If set, files are open eagerly and pre-registered with the cluster", fixedfd, parse_settrue},
    70                 { 'k', "kpollsubmit",    "If set, cluster uses IORING_SETUP_SQPOLL, implies -f", sqkpoll, parse_settrue },
    71                 { 'i', "kpollcomplete",  "If set, cluster uses IORING_SETUP_IOPOLL", iokpoll, parse_settrue },
    72                 {'\0', "submitlength",   "Max number of submitions that can be submitted together", sublen },
     64                // { 'f', "fixed-fds",      "If set, files are open eagerly and pre-registered with the cluster", fixedfd, parse_settrue},
     65                // { 'k', "kpollsubmit",    "If set, cluster uses IORING_SETUP_SQPOLL, implies -f", sqkpoll, parse_settrue },
     66                // { 'i', "kpollcomplete",  "If set, cluster uses IORING_SETUP_IOPOLL", iokpoll, parse_settrue },
    7367                {'\0', "numentries",     "Number of I/O entries", nentries },
    7468
     
    9387        options.clopts.params.num_entries = nentries;
    9488
    95         options.clopts.params.poller_submits = subthrd;
    96         options.clopts.params.eager_submits  = eagrsub;
     89        // if( fixedfd ) {
     90        //      options.file_cache.fixed_fds = true;
     91        // }
    9792
    98         if( fixedfd ) {
    99                 options.file_cache.fixed_fds = true;
    100         }
     93        // if( sqkpoll ) {
     94        //      options.file_cache.fixed_fds = true;
     95        // }
    10196
    102         if( sqkpoll ) {
    103                 options.clopts.params.poll_submit = true;
    104                 options.file_cache.fixed_fds = true;
    105         }
    106 
    107         if( iokpoll ) {
    108                 options.clopts.params.poll_complete = true;
    109                 options.file_cache.open_flags |= O_DIRECT;
    110         }
    111 
    112         options.clopts.params.num_ready = sublen;
     97        // if( iokpoll ) {
     98        //      options.file_cache.open_flags |= O_DIRECT;
     99        // }
    113100
    114101        if( left[0] == 0p ) { return; }
  • benchmark/io/http/protocol.cfa

    r78da4ab r4f762d3  
    5353        while(len > 0) {
    5454                // Call write
    55                 int ret = cfa_write(fd, it, len, 0, -1`s, 0p, 0p);
    56                 // int ret = write(fd, it, len);
     55                int ret = cfa_send(fd, it, len, 0, 0);
    5756                if( ret < 0 ) {
    5857                        if( errno == ECONNRESET || errno == EPIPE ) return -ECONNRESET;
     
    9493
    9594
    96 [HttpCode code, bool closed, * const char file, size_t len] http_read(int fd, []char buffer, size_t len, io_cancellation * cancel) {
     95[HttpCode code, bool closed, * const char file, size_t len] http_read(int fd, []char buffer, size_t len) {
    9796        char * it = buffer;
    9897        size_t count = len - 1;
     
    10099        READ:
    101100        for() {
    102                 int ret = cfa_read(fd, (void*)it, count, 0, -1`s, cancel, 0p);
     101                int ret = cfa_recv(fd, (void*)it, count, 0, 0);
    103102                // int ret = read(fd, (void*)it, count);
    104103                if(ret == 0 ) return [OK200, true, 0, 0];
     
    139138        ssize_t ret;
    140139        SPLICE1: while(count > 0) {
    141                 ret = cfa_splice(ans_fd, &offset, pipe[1], 0p, count, sflags, 0, -1`s, 0p, 0p);
     140                ret = cfa_splice(ans_fd, &offset, pipe[1], 0p, count, sflags, 0);
    142141                // ret = splice(ans_fd, &offset, pipe[1], 0p, count, sflags);
    143142                if( ret < 0 ) {
     
    152151                size_t in_pipe = ret;
    153152                SPLICE2: while(in_pipe > 0) {
    154                         ret = cfa_splice(pipe[0], 0p, fd, 0p, in_pipe, sflags, 0, -1`s, 0p, 0p);
     153                        ret = cfa_splice(pipe[0], 0p, fd, 0p, in_pipe, sflags, 0);
    155154                        // ret = splice(pipe[0], 0p, fd, 0p, in_pipe, sflags);
    156155                        if( ret < 0 ) {
  • benchmark/io/http/protocol.hfa

    r78da4ab r4f762d3  
    11#pragma once
    2 
    3 struct io_cancellation;
    42
    53enum HttpCode {
     
    2119int answer_empty( int fd );
    2220
    23 [HttpCode code, bool closed, * const char file, size_t len] http_read(int fd, []char buffer, size_t len, io_cancellation *);
     21[HttpCode code, bool closed, * const char file, size_t len] http_read(int fd, []char buffer, size_t len);
    2422
    2523int sendfile( int pipe[2], int fd, int ans_fd, size_t count );
  • benchmark/io/http/worker.cfa

    r78da4ab r4f762d3  
    3535        for() {
    3636                if( options.log ) sout | "=== Accepting connection ===";
    37                 int fd = cfa_accept4( this.[sockfd, addr, addrlen, flags], 0, -1`s, &this.cancel, 0p );
    38                 // int fd = accept4( this.[sockfd, addr, addrlen, flags] );
     37                int fd = cfa_accept4( this.[sockfd, addr, addrlen, flags], 0 );
    3938                if(fd < 0) {
    4039                        if( errno == ECONNABORTED ) break;
     
    4241                        abort( "accept error: (%d) %s\n", (int)errno, strerror(errno) );
    4342                }
     43                if(this.done) break;
    4444
    4545                if( options.log ) sout | "=== New connection" | fd | "" | ", waiting for requests ===";
     
    5555                        char buffer[len];
    5656                        if( options.log ) sout | "=== Reading request ===";
    57                         [code, closed, file, name_size] = http_read(fd, buffer, len, &this.cancel);
     57                        [code, closed, file, name_size] = http_read(fd, buffer, len);
    5858
    5959                        // if we are done, break out of the loop
  • benchmark/io/http/worker.hfa

    r78da4ab r4f762d3  
    1717        socklen_t * addrlen;
    1818        int flags;
    19         io_cancellation cancel;
    2019        volatile bool done;
    2120};
Note: See TracChangeset for help on using the changeset viewer.