Changeset a6b587f


Ignore:
Timestamp:
Jan 21, 2021, 1:46:29 PM (8 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
c2df303
Parents:
2fab24e3
Message:

Fix bugs and added nentries command line option.

File:
1 edited

Legend:

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

    r2fab24e3 ra6b587f  
    99}
    1010
     11#include <bitmanip.hfa>
    1112#include <fstream.hfa>
    1213#include <kernel.hfa>
     
    5152        bool iokpoll = false;
    5253        unsigned sublen = 16;
     54        unsigned nentries = 16;
     55
    5356
    5457        static cfa_option opt[] = {
     
    6871                { 'i', "kpollcomplete",  "If set, cluster uses IORING_SETUP_IOPOLL", iokpoll, parse_settrue },
    6972                {'\0', "submitlength",   "Max number of submitions that can be submitted together", sublen },
     73                {'\0', "numentries",     "Number of I/O entries", nentries },
    7074
    7175        };
     
    7478        char **left;
    7579        parse_args( argc, argv, opt, opt_cnt, "[OPTIONS]... [PATH]\ncforall http server", left );
     80
     81        if( !is_pow2(nentries) ) {
     82                unsigned v = nentries;
     83                v--;
     84                v |= v >> 1;
     85                v |= v >> 2;
     86                v |= v >> 4;
     87                v |= v >> 8;
     88                v |= v >> 16;
     89                v++;
     90                serr | "Warning: num_entries not a power of 2" | '(' | nentries | ')' | "raising to " | v;
     91                nentries = v;
     92        }
     93        options.clopts.params.num_entries = nentries;
    7694
    7795        options.clopts.params.poller_submits = subthrd;
     
    94112        options.clopts.params.num_ready = sublen;
    95113
    96         if( left[0] == 0p ) { return "."; }
     114        if( left[0] == 0p ) { return; }
    97115
    98116        const char * path = left[0];
     
    100118
    101119        if( left[0] != 0p ) {
    102                 serr | "Too many trailing arguments!";
     120                serr | "Too many trailing arguments!" | '\'' | path | '\'';
     121                while(left[0] != 0p) {
     122                        serr | " - " | left[0];
     123                        left++;
     124                }
    103125                exit(EXIT_FAILURE);
    104126        }
Note: See TracChangeset for help on using the changeset viewer.