Changes in / [3f06c05:463cb33]
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/main.cfa
r3f06c05 r463cb33 7 7 extern "C" { 8 8 #include <sys/socket.h> 9 #include <sys/types.h>10 9 #include <netinet/in.h> 11 10 } … … 18 17 #include "filecache.hfa" 19 18 #include "options.hfa" 19 #include "parseargs.hfa" 20 20 #include "worker.hfa" 21 21 … … 57 57 int main( int argc, char * argv[] ) { 58 58 int port = 8080; 59 int ret = 0;60 59 int backlog = 10; 61 60 int nprocs = 1; … … 66 65 //=================== 67 66 // Parse args 67 static cfa_option opt[] = { 68 {'p', "port", "Port the server will listen on", port}, 69 {'c', "cpus", "Number of processors to use", nprocs}, 70 {'t', "threads", "Number of worker threads to use", nworkers}, 71 {'b', "accept-backlog", "Maximum number of pending accepts", backlog}, 72 {'B', "channel-size", "Maximum number of accepted connection pending", chan_size} 73 }; 74 int opt_cnt = sizeof(opt) / sizeof(cfa_option); 75 76 char **left; 77 parse_args( argc, argv, opt, opt_cnt, "[OPTIONS] [PATH] -- cforall http server", left ); 78 68 79 69 80 //=================== … … 80 91 } 81 92 93 int ret = 0; 82 94 struct sockaddr_in address; 83 95 int addrlen = sizeof(address); -
benchmark/io/http/worker.cfa
r3f06c05 r463cb33 7 7 #include <string.h> 8 8 extern "C" { 9 #include <fcntl.h> 9 10 #include <sys/socket.h> 10 11 #include <sys/types.h> 11 #include <linux/fcntl.h>12 #include <linux/stat.h>13 12 #include <netinet/in.h> 14 13 } … … 37 36 ssize_t ret; 38 37 SPLICE1: while(count > 0) { 39 ret = cfa_splice(ans_fd, &offset, this.pipe[1], 0p, count, 5);38 ret = cfa_splice(ans_fd, &offset, this.pipe[1], 0p, count, SPLICE_F_MOVE | SPLICE_F_MORE); 40 39 if( ret < 0 ) { 41 40 if( errno != EAGAIN && errno != EWOULDBLOCK) continue SPLICE1; … … 47 46 size_t in_pipe = ret; 48 47 SPLICE2: while(in_pipe > 0) { 49 ret = cfa_splice(this.pipe[0], 0p, fd, 0p, in_pipe, 5);48 ret = cfa_splice(this.pipe[0], 0p, fd, 0p, in_pipe, SPLICE_F_MOVE | SPLICE_F_MORE); 50 49 if( ret < 0 ) { 51 50 if( errno != EAGAIN && errno != EWOULDBLOCK) continue SPLICE2; -
libcfa/src/bits/containers.hfa
r3f06c05 r463cb33 194 194 195 195 int ?!=?( const __queue(T) & this, __attribute__((unused)) zero_t zero ) { 196 return this.head != 0;196 return this.head != 1p; 197 197 } 198 198 } -
libcfa/src/concurrency/iocall.cfa
r3f06c05 r463cb33 345 345 } 346 346 347 int cfa_statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf) { 348 #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_STATX) 349 return syscall( __NR_statx, dirfd, pathname, flags, mask, statxbuf ); 350 #else 351 __submit_prelude 352 353 (*sqe){ IORING_OP_STATX, dirfd, pathname, mask, (uint64_t)statxbuf }; 354 sqe->flags = flags; 355 356 __submit_wait 357 #endif 358 } 359 347 360 ssize_t cfa_read(int fd, void *buf, size_t count) { 348 361 #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_READ) … … 396 409 __submit_wait 397 410 #endif 398 }399 400 ssize_t cfa_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) {401 return cfa_splice(in_fd, offset, out_fd, 0p, count, 0);402 411 } 403 412 -
libcfa/src/concurrency/iofwd.hfa
r3f06c05 r463cb33 16 16 #pragma once 17 17 18 #include <unistd.h> 18 19 extern "C" { 19 20 #include <sys/types.h> 20 21 } 22 #include "bits/defs.hfa" 23 24 struct iovec; 25 struct msghdr; 26 struct sockaddr; 27 struct statx; 21 28 22 29 extern ssize_t cfa_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags); … … 40 47 extern ssize_t cfa_splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags); 41 48 extern ssize_t cfa_tee(int fd_in, int fd_out, size_t len, unsigned int flags); 42 extern ssize_t cfa_sendfile(int out_fd, int in_fd, off_t *offset, size_t count);43 49 44 50 //----------------------------------------------------------------------------- -
libcfa/src/concurrency/mutex.cfa
r3f06c05 r463cb33 30 30 this.lock{}; 31 31 this.blocked_threads{}; 32 this.is_locked = false; 32 33 } 33 34
Note:
See TracChangeset
for help on using the changeset viewer.