Changes in / [7ed1d8f:e699eb6]


Ignore:
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • benchmark/benchcltr.hfa

    r7ed1d8f re699eb6  
    11#pragma once
     2
    23#include <assert.h>
    3 #include <stdint.h>
    4 
    5 #ifdef __cforall
    6         #include <kernel.hfa>
    7         #include <thread.hfa>
    8         #include <stats.hfa>
    9 #else
    10 #include <time.h>                                                                               // timespec
    11 #include <sys/time.h>                                                                   // timeval
    12 
    13 enum { TIMEGRAN = 1000000000LL };                                       // nanosecond granularity, except for timeval
    14 #endif
     4#include <kernel.hfa>
     5#include <thread.hfa>
     6#include <stats.hfa>
    157
    168#define BENCH_OPT_SHORT "d:p:t:SPV"
     
    6355bool procstats = false;
    6456bool viewhalts = false;
    65 
    66 #ifdef __cforall
    6757struct cluster * the_benchmark_cluster = 0p;
    6858struct BenchCluster {
     
    7060};
    7161
    72 void ?{}( BenchCluster & this, int num_io, const io_context_params & io_params, int stats ) {
    73         (this.self){ "Benchmark Cluster", num_io, io_params };
     62void ?{}( BenchCluster & this, int flags, int stats ) {
     63        (this.self){ "Benchmark Cluster", flags };
    7464
    7565        assert( the_benchmark_cluster == 0p );
     
    115105        }
    116106}
    117 #else
    118 uint64_t getTimeNsec() {
    119         timespec curr;
    120         clock_gettime( CLOCK_REALTIME, &curr );
    121         return (int64_t)curr.tv_sec * TIMEGRAN + curr.tv_nsec;
    122 }
    123 
    124 uint64_t to_miliseconds( uint64_t durtn ) { return durtn / (TIMEGRAN / 1000LL); }
    125 double to_fseconds(uint64_t durtn ) { return durtn / (double)TIMEGRAN; }
    126 uint64_t from_fseconds(double sec) { return sec * TIMEGRAN; }
    127 
    128 
    129 void wait_duration(double duration, uint64_t & start, uint64_t & end, bool is_tty) {
    130         for(;;) {
    131                 usleep(100000);
    132                 end = getTimeNsec();
    133                 uint64_t delta = end - start;
    134                 /*if(is_tty)*/ {
    135                         printf(" %.1f\r", to_fseconds(delta));
    136                         fflush(stdout);
    137                 }
    138                 if( delta >= from_fseconds(duration) ) {
    139                         break;
    140                 }
    141         }
    142 }
    143 #endif
    144 
    145107
    146108void bench_usage( char * argv [] ) {
  • benchmark/io/readv.cfa

    r7ed1d8f re699eb6  
    4040int do_read(int fd, struct iovec * iov) {
    4141        // extern ssize_t cfa_preadv2(int, const struct iovec *, int, off_t, int, int = 0, Duration = -1`s, io_cancellation * = 0p, io_context * = 0p);
    42         int sflags = 0
    43         #if defined(CFA_HAVE_IOSQE_ASYNC)
    44                 | CFA_IO_ASYNC
    45         #else
    46         #warning no CFA_IO_ASYNC support
    47         #endif
    48         ;
     42        int sflags = 0;
    4943        if(fixed_file) {
    5044                sflags |= CFA_IO_FIXED_FD1;
     
    136130                                bench_usage( argv );
    137131                                fprintf( stderr, "  -b, --buflen=SIZE        Number of bytes to read per request\n" );
     132                                fprintf( stderr, "  -u, --userthread         If set, cluster uses user-thread to poll I/O\n" );
    138133                                fprintf( stderr, "  -s, --submitthread       If set, cluster uses polling thread to submit I/O\n" );
    139134                                fprintf( stderr, "  -e, --eagersubmit        If set, cluster submits I/O eagerly but still aggregates submits\n" );
     
    144139                }
    145140        }
    146 
    147         if(params.poll_submit  ) fixed_file = true;
    148         if(params.poll_complete) file_flags |= O_DIRECT;
    149141
    150142        int lfd = open(__FILE__, file_flags);
  • benchmark/readyQ/yield.cfa

    r7ed1d8f re699eb6  
    4444int main(int argc, char * argv[]) {
    4545        BENCH_DECL
    46         unsigned num_io = 1;
    47         io_context_params params;
    4846
    4947        for(;;) {
     
    7573
    7674                Time start, end;
    77                 BenchCluster cl = { num_io, params, CFA_STATS_READY_Q };
     75                BenchCluster cl = { 0, CFA_STATS_READY_Q };
    7876                {
    7977                        BenchProc procs[nprocs];
  • libcfa/src/concurrency/io.cfa

    r7ed1d8f re699eb6  
    359359
    360360                        // We got the lock
    361                         // Collect the submissions
    362361                        unsigned to_submit = __collect_submitions( ring );
    363 
    364                         // Release the lock now so syscalls can overlap
    365                         unlock(ring.submit_q.lock);
    366 
    367                         // Actually submit
    368362                        int ret = __io_uring_enter( ring, to_submit, false );
    369                         if( ret < 0 ) return;
     363                        if( ret < 0 ) {
     364                                unlock(ring.submit_q.lock);
     365                                return;
     366                        }
     367
     368                        /* paranoid */ verify( ret > 0 || to_submit == 0 || (ring.ring_flags & IORING_SETUP_SQPOLL) );
    370369
    371370                        // Release the consumed SQEs
     
    373372
    374373                        // update statistics
    375                         __STATS__( false,
     374                        __STATS__( true,
    376375                                io.submit_q.submit_avg.rdy += to_submit;
    377376                                io.submit_q.submit_avg.csm += ret;
    378377                                io.submit_q.submit_avg.cnt += 1;
    379378                        )
     379
     380                        unlock(ring.submit_q.lock);
    380381                }
    381382                else {
Note: See TracChangeset for help on using the changeset viewer.