Changeset ae020ea for benchmark/io/http


Ignore:
Timestamp:
Jun 14, 2022, 11:46:48 AM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
aec20700
Parents:
563a36b
Message:

Printer now prints max fd and open/closed/live connections.

Location:
benchmark/io/http
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/printer.cfa

    r563a36b rae020ea  
    66
    77void ?{}( sendfile_stats_t & this ) {
     8        this.maxfd = 0;
     9        this.close = 0;
    810        this.calls = 0;
    911        this.tries = 0;
     
    1820
    1921void push(sendfile_stats_t & from, sendfile_stats_t & to) {
    20         __atomic_fetch_add(&to.calls, from.calls, __ATOMIC_RELAXED); from.calls = 0;
    21         __atomic_fetch_add(&to.tries, from.tries, __ATOMIC_RELAXED); from.tries = 0;
    22         __atomic_fetch_add(&to.header, from.header, __ATOMIC_RELAXED); from.header = 0;
    23         __atomic_fetch_add(&to.splcin, from.splcin, __ATOMIC_RELAXED); from.splcin = 0;
    24         __atomic_fetch_add(&to.splcot, from.splcot, __ATOMIC_RELAXED); from.splcot = 0;
     22        to.maxfd = max( to.maxfd, from.maxfd);
     23        to.close += from.close; from.close = 0;
     24        to.calls += from.calls; from.calls = 0;
     25        to.tries += from.tries; from.tries = 0;
     26        to.header += from.header; from.header = 0;
     27        to.splcin += from.splcin; from.splcin = 0;
     28        to.splcot += from.splcot; from.splcot = 0;
    2529        for(i; zipf_cnts) {
    26                 __atomic_fetch_add(&to.avgrd[i].calls, from.avgrd[i].calls, __ATOMIC_RELAXED); from.avgrd[i].calls = 0;
    27                 __atomic_fetch_add(&to.avgrd[i].bytes, from.avgrd[i].bytes, __ATOMIC_RELAXED); from.avgrd[i].bytes = 0;
     30                to.avgrd[i].calls += from.avgrd[i].calls; from.avgrd[i].calls = 0;
     31                to.avgrd[i].bytes += from.avgrd[i].bytes; from.avgrd[i].bytes = 0;
    2832        };
    2933}
     
    3640
    3741void push(acceptor_stats_t & from, acceptor_stats_t & to) {
    38         __atomic_fetch_add(&to.creates, from.creates, __ATOMIC_RELAXED); from.creates = 0;
    39         __atomic_fetch_add(&to.accepts, from.accepts, __ATOMIC_RELAXED); from.accepts = 0;
    40         __atomic_fetch_add(&to.eagains, from.eagains, __ATOMIC_RELAXED); from.eagains = 0;
     42        to.creates += from.creates; from.creates = 0;
     43        to.accepts += from.accepts; from.accepts = 0;
     44        to.eagains += from.eagains; from.eagains = 0;
    4145}
    4246
     
    5357void main(StatsPrinter & this) {
    5458        LOOP: for() {
    55                 waitfor( ^?{} : this) {
    56                         break LOOP;
    57                 }
    58                 or else {}
    59 
    6059                wait(this.var, 10`s);
    6160
     
    7978
    8079                        double ratio = ((double)tries) / calls;
     80                        uint64_t accp_open = this.stats.accpt.accepts;
     81                        uint64_t accp_clse = this.stats.send.close;
     82                        uint64_t accp_live = accp_open - accp_clse;
    8183
    82                         if(this.stats.accpt.accepts > 0) {
    83                                 sout | "----- Acceptor Stats -----";
    84                                 sout | "accept  : " | eng3(this.stats.accpt.accepts) | "calls," | eng3(this.stats.accpt.eagains) | "eagains," | eng3(this.stats.accpt.creates) | " thrds";
    85                                 sout | nl;
    86                         }
     84                        sout | "----- Acceptor Stats -----";
     85                        sout | "accepts : " | eng3(accp_open) |"opened," | eng3(accp_clse) |"closed," | eng3(accp_live) |"live";
     86                        sout | "accept  : " | eng3(this.stats.accpt.accepts) | "calls," | eng3(this.stats.accpt.eagains) | "eagains," | eng3(this.stats.accpt.creates) | " thrds";
     87                        sout | nl;
    8788
    8889                        sout | "----- Connection Stats -----";
     90                        sout | "max fd    : " | this.stats.send.maxfd;
    8991                        sout | "sendfile  : " | eng3(calls) | "calls," | eng3(tries) | "tries (" | ratio | " try/call)";
    9092                        sout | "            " | eng3(header) | "header," | eng3(splcin) | "splice in," | eng3(splcot) | "splice out";
     
    9597                        }
    9698                }
     99
     100                waitfor( ^?{} : this) {
     101                        break LOOP;
     102                }
     103                or else {}
    97104        }
    98105}
  • benchmark/io/http/printer.hfa

    r563a36b rae020ea  
    1010
    1111struct sendfile_stats_t {
     12        volatile uint64_t maxfd;
     13        volatile uint64_t close;
    1214        volatile uint64_t calls;
    1315        volatile uint64_t tries;
Note: See TracChangeset for help on using the changeset viewer.