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