Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/readv.cfa

    r4069faad rb1ac7dd  
    1616#include <thread.hfa>
    1717#include <time.hfa>
    18 
    19 #if !defined(HAVE_LINUX_IO_URING_H)
    20 #warning no io uring
    21 #endif
    2218
    2319extern bool traceHeapOn();
     
    5349        while(__atomic_load_n(&run, __ATOMIC_RELAXED)) {
    5450                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));
    5652
    5753                __atomic_fetch_add( &count, 1, __ATOMIC_SEQ_CST );
     
    6359        unsigned long int nthreads = 2;
    6460        unsigned long int nprocs   = 1;
    65 
    66         printf("Setting local\n");
    67         setlocale(LC_NUMERIC, "");
     61        int flags = 0;
    6862
    6963        arg_loop:
    7064        for(;;) {
    7165                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'},
    7671                        {0, 0, 0, 0}
    7772                };
    7873
    7974                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);
    8176
    8277                const char * arg = optarg ? optarg : "";
     
    115110                                }
    116111                                break;
     112                        case 'u':
     113                                flags |= CFA_CLUSTER_IO_POLLER_USER_THREAD;
     114                                break;
    117115                        // Other cases
    118116                        default: /* ? */
     
    135133        }
    136134
    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", buflen, nthreads, nprocs, duration);
    138136
    139137        {
    140138                Time start, end;
    141                 cluster cl = { "IO Cluster" };
     139                cluster cl = { "IO Cluster", flags };
    142140                the_cluster = &cl;
    143141                #if !defined(__CFA_NO_STATISTICS__)
     
    161159                        }
    162160                }
    163                 printf("Took %ld ms\n", (end - start)`ms);
     161                printf("Took %'ld ms\n", (end - start)`ms);
    164162                printf("Total reads:      %'zu\n", count);
    165                 printf("Reads per second: %'lf\n", ((double)count) / (end - start)`s);
     163                printf("Reads per second: %'.2lf\n", ((double)count) / (end - start)`s);
     164                printf("Total read size:  %'zu\n", buflen * count);
     165                printf("Bytes per second: %'.2lf\n", ((double)count * buflen) / (end - start)`s);
    166166        }
    167167
Note: See TracChangeset for help on using the changeset viewer.