Changeset d95969a for benchmark/io/http/options.cfa
- Timestamp:
- Jan 25, 2021, 3:45:42 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- c292244
- Parents:
- b6a8b31 (diff), 7158202 (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
-
benchmark/io/http/options.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/options.cfa
rb6a8b31 rd95969a 9 9 } 10 10 11 #include <bitmanip.hfa> 12 #include <fstream.hfa> 11 13 #include <kernel.hfa> 12 14 #include <parseargs.hfa> 13 15 16 #include <stdlib.h> 14 17 #include <string.h> 15 18 … … 18 21 19 22 { // file_cache 23 0, // path 20 24 0, // open_flags; 21 25 42u, // hash_seed; … … 34 38 1, // nprocs; 35 39 1, // nworkers; 36 0, // flags;40 {}, // params; 37 41 false, // procstats 38 42 false, // viewhalts … … 41 45 }; 42 46 43 const char *parse_options( int argc, char * argv[] ) {47 void parse_options( int argc, char * argv[] ) { 44 48 bool subthrd = false; 45 49 bool eagrsub = false; … … 48 52 bool iokpoll = false; 49 53 unsigned sublen = 16; 54 unsigned nentries = 16; 55 50 56 51 57 static cfa_option opt[] = { 52 {'p', "port", "Port the server will listen on", options.socket.port}, 53 {'c', "cpus", "Number of processors to use", options.clopts.nprocs}, 54 {'L', "log", "Enable logs", options.log, parse_settrue}, 55 {'t', "threads", "Number of worker threads to use", options.clopts.nworkers}, 56 {'b', "accept-backlog", "Maximum number of pending accepts", options.socket.backlog}, 57 {'r', "request_len", "Maximum number of bytes in the http request, requests with more data will be answered with Http Code 414", options.socket.buflen}, 58 {'S', "seed", "seed to use for hashing", options.file_cache.hash_seed }, 59 {'C', "cache-size", "Size of the cache to use, if set to small, will uses closes power of 2", options.file_cache.size }, 60 {'l', "list-files", "List the files in the specified path and exit", options.file_cache.list, parse_settrue }, 61 {'s', "submitthread", "If set, cluster uses polling thread to submit I/O", subthrd, parse_settrue }, 62 {'e', "eagersubmit", "If set, cluster submits I/O eagerly but still aggregates submits", eagrsub, parse_settrue}, 63 {'f', "fixed-fds", "If set, files are open eagerly and pre-registered with the cluster", fixedfd, parse_settrue}, 64 {'k', "kpollsubmit", "If set, cluster uses IORING_SETUP_SQPOLL, implies -f", sqkpoll, parse_settrue }, 65 {'i', "kpollcomplete", "If set, cluster uses IORING_SETUP_IOPOLL", iokpoll, parse_settrue }, 66 {'L', "submitlength", "Max number of submitions that can be submitted together", sublen }, 58 { 'p', "port", "Port the server will listen on", options.socket.port}, 59 { 'c', "cpus", "Number of processors to use", options.clopts.nprocs}, 60 { 't', "threads", "Number of worker threads to use", options.clopts.nworkers}, 61 {'\0', "log", "Enable logs", options.log, parse_settrue}, 62 {'\0', "accept-backlog", "Maximum number of pending accepts", options.socket.backlog}, 63 {'\0', "request_len", "Maximum number of bytes in the http request, requests with more data will be answered with Http Code 414", options.socket.buflen}, 64 {'\0', "seed", "seed to use for hashing", options.file_cache.hash_seed }, 65 {'\0', "cache-size", "Size of the cache to use, if set to small, will uses closes power of 2", options.file_cache.size }, 66 {'\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 }, 73 {'\0', "numentries", "Number of I/O entries", nentries }, 67 74 68 75 }; … … 71 78 char **left; 72 79 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; 73 94 74 95 options.clopts.params.poller_submits = subthrd; … … 91 112 options.clopts.params.num_ready = sublen; 92 113 93 if( left[0] == 0p ) { return "."; }114 if( left[0] == 0p ) { return; } 94 115 95 116 const char * path = left[0]; … … 97 118 98 119 if( left[0] != 0p ) { 99 abort("Too many trailing arguments!\n"); 120 serr | "Too many trailing arguments!" | '\'' | path | '\''; 121 while(left[0] != 0p) { 122 serr | " - " | left[0]; 123 left++; 124 } 125 exit(EXIT_FAILURE); 100 126 } 101 127 102 returnpath;128 options.file_cache.path = path; 103 129 }
Note:
See TracChangeset
for help on using the changeset viewer.