Changes in / [e699eb6:7ed1d8f]
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/benchcltr.hfa
re699eb6 r7ed1d8f 1 1 #pragma once 2 #include <assert.h> 3 #include <stdint.h> 2 4 3 #include <assert.h> 4 #include <kernel.hfa> 5 #include <thread.hfa> 6 #include <stats.hfa> 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 7 15 8 16 #define BENCH_OPT_SHORT "d:p:t:SPV" … … 55 63 bool procstats = false; 56 64 bool viewhalts = false; 65 66 #ifdef __cforall 57 67 struct cluster * the_benchmark_cluster = 0p; 58 68 struct BenchCluster { … … 60 70 }; 61 71 62 void ?{}( BenchCluster & this, int flags, int stats ) {63 (this.self){ "Benchmark Cluster", flags };72 void ?{}( BenchCluster & this, int num_io, const io_context_params & io_params, int stats ) { 73 (this.self){ "Benchmark Cluster", num_io, io_params }; 64 74 65 75 assert( the_benchmark_cluster == 0p ); … … 105 115 } 106 116 } 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 107 145 108 146 void bench_usage( char * argv [] ) { -
benchmark/io/readv.cfa
re699eb6 r7ed1d8f 40 40 int do_read(int fd, struct iovec * iov) { 41 41 // 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; 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 ; 43 49 if(fixed_file) { 44 50 sflags |= CFA_IO_FIXED_FD1; … … 130 136 bench_usage( argv ); 131 137 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" );133 138 fprintf( stderr, " -s, --submitthread If set, cluster uses polling thread to submit I/O\n" ); 134 139 fprintf( stderr, " -e, --eagersubmit If set, cluster submits I/O eagerly but still aggregates submits\n" ); … … 139 144 } 140 145 } 146 147 if(params.poll_submit ) fixed_file = true; 148 if(params.poll_complete) file_flags |= O_DIRECT; 141 149 142 150 int lfd = open(__FILE__, file_flags); -
benchmark/readyQ/yield.cfa
re699eb6 r7ed1d8f 44 44 int main(int argc, char * argv[]) { 45 45 BENCH_DECL 46 unsigned num_io = 1; 47 io_context_params params; 46 48 47 49 for(;;) { … … 73 75 74 76 Time start, end; 75 BenchCluster cl = { 0, CFA_STATS_READY_Q };77 BenchCluster cl = { num_io, params, CFA_STATS_READY_Q }; 76 78 { 77 79 BenchProc procs[nprocs]; -
libcfa/src/concurrency/io.cfa
re699eb6 r7ed1d8f 359 359 360 360 // We got the lock 361 // Collect the submissions 361 362 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 362 368 int ret = __io_uring_enter( ring, to_submit, false ); 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) ); 369 if( ret < 0 ) return; 369 370 370 371 // Release the consumed SQEs … … 372 373 373 374 // update statistics 374 __STATS__( true,375 __STATS__( false, 375 376 io.submit_q.submit_avg.rdy += to_submit; 376 377 io.submit_q.submit_avg.csm += ret; 377 378 io.submit_q.submit_avg.cnt += 1; 378 379 ) 379 380 unlock(ring.submit_q.lock);381 380 } 382 381 else {
Note: See TracChangeset
for help on using the changeset viewer.