| 78 | } |
| 79 | |
| 80 | static void* thread_write(void* ctx) |
| 81 | { |
| 82 | acl::socket_stream* conn = (acl::socket_stream*) ctx; |
| 83 | acl::string buf; |
| 84 | |
| 85 | int i; |
| 86 | for (i = 0; i < __dlen; i++) |
| 87 | buf += 'X'; |
| 88 | buf += "\r\n"; |
| 89 | |
| 90 | struct timeval begin; |
| 91 | gettimeofday(&begin, NULL); |
| 92 | |
| 93 | for (i = 0; i < __max; i++) |
| 94 | { |
| 95 | if (conn->write(buf) == -1) |
| 96 | { |
| 97 | printf("write to client finish!\r\n"); |
| 98 | break; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | struct timeval end; |
| 103 | gettimeofday(&end, NULL); |
| 104 | |
| 105 | double n = util::stamp_sub(&end, &begin); |
| 106 | printf("total write: %d, spent: %0.2f ms, speed: %0.2f\r\n", |
| 107 | i, n, (i * 1000) /(n > 0 ? n : 1)); |
| 108 | |
| 109 | return NULL; |
| 110 | } |
| 111 | |
| 112 | static void usage(const char* procname) |
| 113 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…