Changes in / [b583113:578c09a]


Ignore:
Files:
3 edited

Legend:

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

    rb583113 r578c09a  
    55        #include <fcntl.h>
    66}
     7
     8#define xstr(s) str(s)
     9#define str(s) #s
    710
    811#include <fstream.hfa>
     
    2124
    2225#define PLAINTEXT_1WRITE
     26#define PLAINTEXT_MEMCPY
    2327#define PLAINTEXT_NOCOPY
    2428
     
    8589#if defined(PLAINTEXT_NOCOPY)
    8690int answer_plaintext( int fd ) {
    87         return answer(fd, http_msgs[OK200_PlainText]->msg, http_msgs[OK200_PlainText]->len + 1); // +1 cause snprintf doesn't count nullterminator
     91        return answer(fd, http_msgs[OK200_PlainText]->msg, http_msgs[OK200_PlainText]->len); // +1 cause snprintf doesn't count nullterminator
     92}
     93#elif defined(PLAINTEXT_MEMCPY)
     94#define TEXTSIZE 15
     95int answer_plaintext( int fd ) {
     96        char text[] = "Hello, World!\n\n";
     97        char ts[] = xstr(TEXTSIZE) " \n\n";
     98        _Static_assert(sizeof(text) - 1 == TEXTSIZE);
     99        char buffer[512 + TEXTSIZE];
     100        char * it = buffer;
     101        memcpy(it, http_msgs[OK200]->msg, http_msgs[OK200]->len);
     102        it += http_msgs[OK200]->len;
     103        int len = http_msgs[OK200]->len;
     104        memcpy(it, ts, sizeof(ts) - 1);
     105        it += sizeof(ts) - 1;
     106        len += sizeof(ts) - 1;
     107        memcpy(it, text, TEXTSIZE);
     108        return answer(fd, buffer, len + TEXTSIZE);
    88109}
    89110#elif defined(PLAINTEXT_1WRITE)
    90111int answer_plaintext( int fd ) {
    91         char text[] = "Hello, World!\n";
     112        char text[] = "Hello, World!\n\n";
    92113        char buffer[512 + sizeof(text)];
    93114        char * it = buffer;
     
    103124#else
    104125int answer_plaintext( int fd ) {
    105         char text[] = "Hello, World!\n";
     126        char text[] = "Hello, World!\n\n";
    106127        int ret = answer_header(fd, sizeof(text));
    107128        if( ret < 0 ) return ret;
     
    194215const char * original_http_msgs[] = {
    195216        "HTTP/1.1 200 OK\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: ",
    196         "HTTP/1.1 200 OK\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: 15\n\nHello, World!\n",
     217        "HTTP/1.1 200 OK\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: 15\n\nHello, World!\n\n",
    197218        "HTTP/1.1 400 Bad Request\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: 0 \n\n",
    198219        "HTTP/1.1 404 Not Found\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: 0 \n\n",
  • benchmark/io/http/worker.cfa

    rb583113 r578c09a  
    1818void ?{}( Worker & this ) {
    1919        size_t cli = rand() % options.clopts.cltr_cnt;
    20         ((thread&)this){ "Server Worker Thread", *options.clopts.instance[cli] };
     20        ((thread&)this){ "Server Worker Thread", *options.clopts.instance[cli], 512000 };
    2121        options.clopts.thrd_cnt[cli]++;
    2222        this.pipe[0] = -1;
  • libcfa/src/concurrency/stats.cfa

    rb583113 r578c09a  
    126126                        double sExt_len = ready.push.extrn.success ? ((double)ready.push.extrn.attempt) / ready.push.extrn.success : 0;
    127127
    128                         double rLcl_len  = ready.pop.local .success ? ((double)ready.pop.local .attempt) / ready.pop.local .success : 0;
    129                         double rHlp_len  = ready.pop.help  .success ? ((double)ready.pop.help  .attempt) / ready.pop.help  .success : 0;
    130                         double rStl_len  = ready.pop.steal .success ? ((double)ready.pop.steal .attempt) / ready.pop.steal .success : 0;
    131                         double rSch_len  = ready.pop.search.success ? ((double)ready.pop.search.attempt) / ready.pop.search.success : 0;
     128                        uint64_t total = ready.pop.local.success + ready.pop.help.success + ready.pop.steal.success + ready.pop.search.success;
     129                        double rLcl_pc = (100.0 * (double)ready.pop.local .success) / total;
     130                        double rHlp_pc = (100.0 * (double)ready.pop.help  .success) / total;
     131                        double rStl_pc = (100.0 * (double)ready.pop.steal .success) / total;
     132                        double rSch_pc = (100.0 * (double)ready.pop.search.success) / total;
    132133
    133134                        __cfaabi_bits_print_safe( STDOUT_FILENO,
    134135                                "----- %s \"%s\" (%p) - Ready Q Stats -----\n"
    135136                                "- totals   : %'3" PRIu64 " run, %'3" PRIu64 " schd (%'" PRIu64 "ext, %'" PRIu64 "mig, %'" PRId64 " )\n"
    136                                 "- push avg : %'3.2lf (l: %'3.2lf/%'" PRIu64 ", s: %'3.2lf/%'" PRIu64 ", e: %'3.2lf : %'" PRIu64 "e)\n"
    137                                 "- local    : %'3.2lf (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
    138                                 "- help     : %'3.2lf (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
    139                                 "- steal    : %'3.2lf (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
    140                                 "- search   : %'3.2lf (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
     137                                "- push avg : %'3.0lf (l: %'3.2lf/%'" PRIu64 ", s: %'3.2lf/%'" PRIu64 ", e: %'3.2lf : %'" PRIu64 "e)\n"
     138                                "- local    : %'3.0lf%%: %'3" PRIu64 " (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
     139                                "- help     : %'3.0lf%%: %'3" PRIu64 " (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
     140                                "- steal    : %'3.0lf%%: %'3" PRIu64 " (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
     141                                "- search   : %'3.0lf%%: %'3" PRIu64 " (%'3" PRIu64 " try, %'3" PRIu64 " spc, %'3" PRIu64 " lck, %'3" PRIu64 " ept)\n"
    141142                                "- Idle Slp : %'3" PRIu64 "h, %'3" PRIu64 "c, %'3" PRIu64 "w, %'3" PRIu64 "e\n"
    142143                                "\n"
    143144                                , type, name, id
    144                                 , ready.pop.local.success + ready.pop.help.success + ready.pop.steal.success + ready.pop.search.success
     145                                , total
    145146                                , ready.push.local.success + ready.push.share.success + ready.push.extrn.success
    146147                                , ready.push.extrn.success, ready.threads.migration, ready.threads.threads
    147148                                , push_len, sLcl_len, ready.push.local.attempt, sOth_len, ready.push.share.attempt, sExt_len, ready.push.extrn.attempt
    148                                 , rLcl_len, ready.pop.local .attempt, ready.pop.local .espec, ready.pop.local .elock, ready.pop.local .eempty
    149                                 , rHlp_len, ready.pop.help  .attempt, ready.pop.help  .espec, ready.pop.help  .elock, ready.pop.help  .eempty
    150                                 , rStl_len, ready.pop.steal .attempt, ready.pop.steal .espec, ready.pop.steal .elock, ready.pop.steal .eempty
    151                                 , rSch_len, ready.pop.search.attempt, ready.pop.search.espec, ready.pop.search.elock, ready.pop.search.eempty
     149                                , rLcl_pc, ready.pop.local .success, ready.pop.local .attempt, ready.pop.local .espec, ready.pop.local .elock, ready.pop.local .eempty
     150                                , rHlp_pc, ready.pop.help  .success, ready.pop.help  .attempt, ready.pop.help  .espec, ready.pop.help  .elock, ready.pop.help  .eempty
     151                                , rStl_pc, ready.pop.steal .success, ready.pop.steal .attempt, ready.pop.steal .espec, ready.pop.steal .elock, ready.pop.steal .eempty
     152                                , rSch_pc, ready.pop.search.success, ready.pop.search.attempt, ready.pop.search.espec, ready.pop.search.elock, ready.pop.search.eempty
    152153                                , ready.sleep.halts, ready.sleep.cancels, ready.sleep.wakes, ready.sleep.exits
    153154                        );
Note: See TracChangeset for help on using the changeset viewer.