Changeset 01c6256
- Timestamp:
- Aug 11, 2020, 1:54:30 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 9f1c286
- Parents:
- e857743
- Location:
- benchmark
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/benchcltr.hfa
re857743 r01c6256 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
re857743 r01c6256 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
re857743 r01c6256 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];
Note: See TracChangeset
for help on using the changeset viewer.