Changes in / [b583113:578c09a]
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/protocol.cfa
rb583113 r578c09a 5 5 #include <fcntl.h> 6 6 } 7 8 #define xstr(s) str(s) 9 #define str(s) #s 7 10 8 11 #include <fstream.hfa> … … 21 24 22 25 #define PLAINTEXT_1WRITE 26 #define PLAINTEXT_MEMCPY 23 27 #define PLAINTEXT_NOCOPY 24 28 … … 85 89 #if defined(PLAINTEXT_NOCOPY) 86 90 int 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 95 int 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); 88 109 } 89 110 #elif defined(PLAINTEXT_1WRITE) 90 111 int answer_plaintext( int fd ) { 91 char text[] = "Hello, World!\n ";112 char text[] = "Hello, World!\n\n"; 92 113 char buffer[512 + sizeof(text)]; 93 114 char * it = buffer; … … 103 124 #else 104 125 int answer_plaintext( int fd ) { 105 char text[] = "Hello, World!\n ";126 char text[] = "Hello, World!\n\n"; 106 127 int ret = answer_header(fd, sizeof(text)); 107 128 if( ret < 0 ) return ret; … … 194 215 const char * original_http_msgs[] = { 195 216 "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", 197 218 "HTTP/1.1 400 Bad Request\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: 0 \n\n", 198 219 "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 18 18 void ?{}( Worker & this ) { 19 19 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 }; 21 21 options.clopts.thrd_cnt[cli]++; 22 22 this.pipe[0] = -1; -
libcfa/src/concurrency/stats.cfa
rb583113 r578c09a 126 126 double sExt_len = ready.push.extrn.success ? ((double)ready.push.extrn.attempt) / ready.push.extrn.success : 0; 127 127 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; 132 133 133 134 __cfaabi_bits_print_safe( STDOUT_FILENO, 134 135 "----- %s \"%s\" (%p) - Ready Q Stats -----\n" 135 136 "- 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" 141 142 "- Idle Slp : %'3" PRIu64 "h, %'3" PRIu64 "c, %'3" PRIu64 "w, %'3" PRIu64 "e\n" 142 143 "\n" 143 144 , type, name, id 144 , ready.pop.local.success + ready.pop.help.success + ready.pop.steal.success + ready.pop.search.success145 , total 145 146 , ready.push.local.success + ready.push.share.success + ready.push.extrn.success 146 147 , ready.push.extrn.success, ready.threads.migration, ready.threads.threads 147 148 , 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 .eempty149 , rHlp_ len, ready.pop.help .attempt, ready.pop.help .espec, ready.pop.help .elock, ready.pop.help .eempty150 , rStl_ len, ready.pop.steal .attempt, ready.pop.steal .espec, ready.pop.steal .elock, ready.pop.steal .eempty151 , rSch_ len, ready.pop.search.attempt, ready.pop.search.espec, ready.pop.search.elock, ready.pop.search.eempty149 , 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 152 153 , ready.sleep.halts, ready.sleep.cancels, ready.sleep.wakes, ready.sleep.exits 153 154 );
Note: See TracChangeset
for help on using the changeset viewer.