Changes in benchmark/io/readv.cfa [4069faad:cbabfd4]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/readv.cfa
r4069faad rcbabfd4 16 16 #include <thread.hfa> 17 17 #include <time.hfa> 18 19 #if !defined(HAVE_LINUX_IO_URING_H)20 #warning no io uring21 #endif22 18 23 19 extern bool traceHeapOn(); … … 53 49 while(__atomic_load_n(&run, __ATOMIC_RELAXED)) { 54 50 int r = cfa_preadv2(fd, &iov, 1, 0, 0); 55 if(r < 0) abort( strerror(-r));51 if(r < 0) abort("%s\n", strerror(-r)); 56 52 57 53 __atomic_fetch_add( &count, 1, __ATOMIC_SEQ_CST ); … … 63 59 unsigned long int nthreads = 2; 64 60 unsigned long int nprocs = 1; 65 66 printf("Setting local\n"); 67 setlocale(LC_NUMERIC, ""); 61 int flags = 0; 68 62 69 63 arg_loop: 70 64 for(;;) { 71 65 static struct option options[] = { 72 {"duration", required_argument, 0, 'd'}, 73 {"nthreads", required_argument, 0, 't'}, 74 {"nprocs", required_argument, 0, 'p'}, 75 {"bufsize", required_argument, 0, 'b'}, 66 {"duration", required_argument, 0, 'd'}, 67 {"nthreads", required_argument, 0, 't'}, 68 {"nprocs", required_argument, 0, 'p'}, 69 {"bufsize", required_argument, 0, 'b'}, 70 {"userthread", no_argument , 0, 'u'}, 76 71 {0, 0, 0, 0} 77 72 }; 78 73 79 74 int idx = 0; 80 int opt = getopt_long(argc, argv, "d:t:p:b: ", options, &idx);75 int opt = getopt_long(argc, argv, "d:t:p:b:u", options, &idx); 81 76 82 77 const char * arg = optarg ? optarg : ""; … … 115 110 } 116 111 break; 112 case 'u': 113 flags |= CFA_CLUSTER_IO_POLLER_USER_THREAD; 114 break; 117 115 // Other cases 118 116 default: /* ? */ … … 135 133 } 136 134 137 printf("Running %lu threads over %lu processors for %lf seconds\n", nthreads, nprocs, duration);135 printf("Running %lu threads, reading %lu bytes each, over %lu processors for %lf seconds\n", nthreads, buflen, nprocs, duration); 138 136 139 137 { 140 138 Time start, end; 141 cluster cl = { "IO Cluster" };139 cluster cl = { "IO Cluster", flags }; 142 140 the_cluster = &cl; 143 141 #if !defined(__CFA_NO_STATISTICS__) … … 161 159 } 162 160 } 163 printf("Took %ld ms\n", (end - start)`ms); 164 printf("Total reads: %'zu\n", count); 165 printf("Reads per second: %'lf\n", ((double)count) / (end - start)`s); 161 printf("Took %'ld ms\n", (end - start)`ms); 162 printf("Total reads : %'15zu\n", count); 163 printf("Reads per second : %'18.2lf\n", ((double)count) / (end - start)`s); 164 printf("Total read size : %'15zu\n", buflen * count); 165 printf("Bytes per second : %'18.2lf\n", ((double)count * buflen) / (end - start)`s); 166 166 } 167 167
Note: See TracChangeset
for help on using the changeset viewer.