Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/worker.hfa

    r329e26a ref3c383  
    11#pragma once
    22
    3 #include <iofwd.hfa>
    4 #include <queueLockFree.hfa>
    53#include <thread.hfa>
    64
     
    97}
    108
    11 #include "printer.hfa"
    12 
    139//=============================================================================================
    1410// Worker Thread
    1511//=============================================================================================
    1612
    17 struct connection {
    18         int pipe[2];
     13extern const size_t zipf_sizes[];
     14enum { zipf_cnts = 36, };
     15
     16struct sendfile_stats_t {
     17        volatile uint64_t calls;
     18        volatile uint64_t tries;
     19        volatile uint64_t header;
     20        volatile uint64_t splcin;
     21        volatile uint64_t splcot;
    1922        struct {
    20                 sendfile_stats_t sendfile;
    21         } stats;
     23                volatile uint64_t calls;
     24                volatile uint64_t bytes;
     25        } avgrd[zipf_cnts];
    2226};
    2327
    24 static inline void ?{}( connection & this ) {
    25         this.pipe[0] = -1;
    26         this.pipe[1] = -1;
    27 }
    28 
    29 thread AcceptWorker {
    30         connection conn;
     28thread Worker {
     29        int pipe[2];
    3130        int sockfd;
    3231        struct sockaddr * addr;
     
    3433        int flags;
    3534        volatile bool done;
     35        struct {
     36                sendfile_stats_t sendfile;
     37        } stats;
    3638};
    37 void ?{}( AcceptWorker & this);
    38 void main( AcceptWorker & );
    39 
    40 
    41 struct PendingRead {
    42         PendingRead * volatile next;
    43         io_future_t f;
    44         struct {
    45                 void * buf;
    46                 size_t len;
    47         } in;
    48         struct {
    49                 volatile int fd;
    50         } out;
    51 };
    52 
    53 static inline PendingRead * volatile & ?`next ( PendingRead * node ) {
    54         return node->next;
    55 }
    56 
    57 thread ChannelWorker {
    58         connection conn;
    59         volatile bool done;
    60         mpsc_queue(PendingRead) * queue;
    61 };
    62 void ?{}( ChannelWorker & );
    63 void main( ChannelWorker & );
    64 
    65 thread Acceptor {
    66         mpsc_queue(PendingRead) * queue;
    67         int sockfd;
    68         struct sockaddr * addr;
    69         socklen_t * addrlen;
    70         int flags;
    71         volatile bool done;
    72         acceptor_stats_t stats;
    73 };
    74 void ?{}( Acceptor &, int cli );
    75 void main( Acceptor & );
     39void ?{}( Worker & this);
     40void main( Worker & );
Note: See TracChangeset for help on using the changeset viewer.