Changeset 2a01c9b
- Timestamp:
- Apr 23, 2020, 5:53:21 PM (5 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:
- 9edf835, cefc59f
- Parents:
- 40b5417 (diff), 8962722 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified benchmark/io/readv.cfa ¶
r40b5417 r2a01c9b 17 17 #include <time.hfa> 18 18 19 extern bool traceHeapOn(); 19 20 extern ssize_t async_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags); 20 21 … … 38 39 } 39 40 40 Time now(void);41 42 41 int main(int argc, char * argv[]) { 43 42 double duration = 5.0; … … 45 44 unsigned long int nprocs = 1; 46 45 46 printf("Setting local\n"); 47 47 setlocale(LC_NUMERIC, ""); 48 48 49 49 50 arg_loop: … … 76 77 case 't': 77 78 nthreads = strtoul(arg, &end, 10); 78 if(*end != '\0' ) {79 if(*end != '\0' || nthreads < 1) { 79 80 fprintf(stderr, "Number of threads must be a positive integer, was %s\n", arg); 80 81 goto usage; … … 83 84 case 'p': 84 85 nprocs = strtoul(arg, &end, 10); 85 if(*end != '\0' ) {86 if(*end != '\0' || nprocs < 1) { 86 87 fprintf(stderr, "Number of processors must be a positive integer, was %s\n", arg); 87 88 goto usage; … … 119 120 Time start, end; 120 121 { 121 processor procs[nprocs ];122 processor procs[nprocs - 1]; 122 123 { 123 124 Reader threads[nthreads]; … … 134 135 } 135 136 } 136 printf("Done\n");137 137 printf("Took %ld ms\n", (end - start)`ms); 138 138 printf("Total reads: %'zu\n", count); … … 140 140 141 141 close(fd); 142 printf("Done\n"); 142 143 } -
TabularUnified libcfa/src/concurrency/io.cfa ¶
r40b5417 r2a01c9b 36 36 37 37 static void * __io_poller( void * arg ); 38 39 // Weirdly, some systems that do support io_uring don't actually define these 40 #ifdef __alpha__ 41 /* 42 * alpha is the only exception, all other architectures 43 * have common numbers for new system calls. 44 */ 45 # ifndef __NR_io_uring_setup 46 # define __NR_io_uring_setup 535 47 # endif 48 # ifndef __NR_io_uring_enter 49 # define __NR_io_uring_enter 536 50 # endif 51 # ifndef __NR_io_uring_register 52 # define __NR_io_uring_register 537 53 # endif 54 #else /* !__alpha__ */ 55 # ifndef __NR_io_uring_setup 56 # define __NR_io_uring_setup 425 57 # endif 58 # ifndef __NR_io_uring_enter 59 # define __NR_io_uring_enter 426 60 # endif 61 # ifndef __NR_io_uring_register 62 # define __NR_io_uring_register 427 63 # endif 64 #endif 65 38 66 39 67 //============================================================================================= … … 188 216 189 217 struct io_user_data * data = (struct io_user_data *)cqe.user_data; 190 __cfaabi_bits_print_safe( STDERR_FILENO, "Performed reading io cqe %p, result %d for %p\n", data, cqe.res, data->thrd );218 // __cfaabi_bits_print_safe( STDERR_FILENO, "Performed reading io cqe %p, result %d for %p\n", data, cqe.res, data->thrd ); 191 219 192 220 data->result = cqe.res; … … 296 324 // Submit however, many entries need to be submitted 297 325 int ret = syscall( __NR_io_uring_enter, ring.fd, 1, 0, 0, 0p, 0); 298 __cfaabi_bits_print_safe( STDERR_FILENO, "Performed io_submit, returned %d\n", ret );326 // __cfaabi_bits_print_safe( STDERR_FILENO, "Performed io_submit, returned %d\n", ret ); 299 327 if( ret < 0 ) { 300 328 switch((int)errno) { … … 352 380 #define __submit_wait \ 353 381 io_user_data data = { 0, active_thread() }; \ 354 __cfaabi_bits_print_safe( STDERR_FILENO, "Preparing user data %p for %p\n", &data, data.thrd );\382 /*__cfaabi_bits_print_safe( STDERR_FILENO, "Preparing user data %p for %p\n", &data, data.thrd );*/ \ 355 383 sqe->user_data = (uint64_t)&data; \ 356 384 __submit( ring, idx ); \ … … 575 603 int async_statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf) { 576 604 #if !defined(IORING_OP_STATX) 577 return statx( dirfd, pathname, flags, mask, statxbuf ); 605 //return statx( dirfd, pathname, flags, mask, statxbuf ); 606 return syscall( __NR_io_uring_setup, dirfd, pathname, flags, mask, statxbuf ); 578 607 #else 579 608 __submit_prelude -
TabularUnified libcfa/src/concurrency/preemption.cfa ¶
r40b5417 r2a01c9b 97 97 while( node = get_expired( alarms, currtime ) ) { 98 98 // __cfaabi_dbg_print_buffer_decl( " KERNEL: preemption tick.\n" ); 99 Duration period = node->period; 100 if( period == 0) { 101 node->set = false; // Node is one-shot, just mark it as not pending 102 } 99 103 100 104 // Check if this is a kernel … … 107 111 108 112 // Check if this is a periodic alarm 109 Duration period = node->period;110 113 if( period > 0 ) { 111 114 // __cfaabi_dbg_print_buffer_local( " KERNEL: alarm period is %lu.\n", period.tv ); 112 115 node->alarm = currtime + period; // Alarm is periodic, add currtime to it (used cached current time) 113 116 insert( alarms, node ); // Reinsert the node for the next time it triggers 114 }115 else {116 node->set = false; // Node is one-shot, just mark it as not pending117 117 } 118 118 } -
TabularUnified tests/vector.cfa ¶
r40b5417 r2a01c9b 14 14 // 15 15 16 #include <vector.hfa> 16 17 #include <fstream.hfa> 17 #include <vector.hfa>18 18 19 19 #undef assert … … 28 28 int main() { 29 29 vector( int ) iv; 30 31 assert( ((uintptr_t)&iv.storage.storage ) == (((uintptr_t)&iv)) ); 32 assert( ((uintptr_t)&iv.storage.capacity) == (((uintptr_t)&iv) + sizeof(void *)) ); 33 assert( ((uintptr_t)&iv.size ) == (((uintptr_t)&iv) + sizeof(void *) + sizeof(size_t)) ); 30 34 31 35 assert( empty( &iv ) );
Note: See TracChangeset
for help on using the changeset viewer.