Changeset cb85603 for benchmark/io/readv.cfa
- Timestamp:
- Jun 25, 2020, 2:57:39 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- ec21f13
- Parents:
- 566fde0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/readv.cfa
r566fde0 rcb85603 50 50 51 51 int main(int argc, char * argv[]) { 52 double duration = 5.0; 53 unsigned long int nthreads = 2; 54 unsigned long int nprocs = 1; 55 bool silent = false; 56 bool procstats = false; 52 BENCH_DECL 57 53 unsigned flags = 0; 58 54 unsigned sublen = 16; … … 61 57 for(;;) { 62 58 static struct option options[] = { 63 {"duration", required_argument, 0, 'd'}, 64 {"nthreads", required_argument, 0, 't'}, 65 {"nprocs", required_argument, 0, 'p'}, 66 {"nostats", no_argument , 0, 'S'}, 67 {"procstat", no_argument , 0, 'P'}, 59 BENCH_OPT_LONG 68 60 {"bufsize", required_argument, 0, 'b'}, 69 61 {"userthread", no_argument , 0, 'u'}, … … 74 66 75 67 int idx = 0; 76 int opt = getopt_long(argc, argv, "d:t:p:SPb:usl:", options, &idx);68 int opt = getopt_long(argc, argv, BENCH_OPT_SHORT "b:usl:", options, &idx); 77 69 78 70 const char * arg = optarg ? optarg : ""; … … 82 74 case -1: 83 75 break arg_loop; 84 // Numeric Arguments 85 case 'd': 86 duration = strtod(arg, &end); 87 if(*end != '\0') { 88 fprintf(stderr, "Duration must be a valid double, was %s\n", arg); 89 goto usage; 90 } 91 break; 92 case 't': 93 nthreads = strtoul(arg, &end, 10); 94 if(*end != '\0' || nthreads < 1) { 95 fprintf(stderr, "Number of threads must be a positive integer, was %s\n", arg); 96 goto usage; 97 } 98 break; 99 case 'p': 100 nprocs = strtoul(arg, &end, 10); 101 if(*end != '\0' || nprocs < 1) { 102 fprintf(stderr, "Number of processors must be a positive integer, was %s\n", arg); 103 goto usage; 104 } 105 break; 106 case 'S': 107 silent = true; 108 break; 109 case 'P': 110 procstats = true; 111 break; 76 BENCH_OPT_CASE 112 77 case 'b': 113 78 buflen = strtoul(arg, &end, 10); … … 131 96 flags |= (sublen << CFA_CLUSTER_IO_BUFFLEN_OFFSET); 132 97 break; 133 // Other cases134 98 default: /* ? */ 135 99 fprintf(stderr, "%d\n", opt); 136 100 usage: 137 fprintf( stderr, "Usage: %s : [options]\n", argv[0] ); 138 fprintf( stderr, "\n" ); 139 fprintf( stderr, " -d, --duration=DURATION Duration of the experiment, in seconds\n" ); 140 fprintf( stderr, " -t, --nthreads=NTHREADS Number of user threads\n" ); 141 fprintf( stderr, " -p, --nprocs=NPROCS Number of kernel threads\n" ); 142 fprintf( stderr, " -S, --nostats Don't print cluster stats\n" ); 143 fprintf( stderr, " -P, --procstat Print processor stats" ); 101 bench_usage( argv ); 144 102 fprintf( stderr, " -b, --buflen=SIZE Number of bytes to read per request\n" ); 145 103 fprintf( stderr, " -u, --userthread If set, cluster uses user-thread to poll I/O\n" ); … … 155 113 } 156 114 157 printf("Running % lu threads, reading %lu bytes each, over %lu processors for %lf seconds\n", nthreads, buflen, nprocs, duration);115 printf("Running %d threads, reading %lu bytes each, over %d processors for %f seconds\n", nthreads, buflen, nprocs, duration); 158 116 159 117 { 160 118 Time start, end; 161 BenchCluster cl = { flags }; 162 #if !defined(__CFA_NO_STATISTICS__) 163 if( !silent ) { 164 print_stats_at_exit( cl.self, CFA_STATS_READY_Q | CFA_STATS_IO ); 165 } 166 #endif 119 BenchCluster cl = { flags, CFA_STATS_READY_Q | CFA_STATS_IO }; 167 120 { 168 121 BenchProc procs[nprocs]; 169 #if !defined(__CFA_NO_STATISTICS__)170 if( procstats ) {171 for(i; nprocs) {172 print_stats_at_exit( procs[i].self, CFA_STATS_READY_Q | CFA_STATS_IO );173 }174 }175 #endif176 122 { 177 123 Reader threads[nthreads];
Note: See TracChangeset
for help on using the changeset viewer.