| 48 | } |
| 49 | |
| 50 | static void* thread_read(void* ctx) |
| 51 | { |
| 52 | acl::socket_stream* conn = (acl::socket_stream*) ctx; |
| 53 | acl::string buf; |
| 54 | |
| 55 | struct timeval begin; |
| 56 | gettimeofday(&begin, NULL); |
| 57 | |
| 58 | int i; |
| 59 | for (i = 0; i < __max; i++) |
| 60 | { |
| 61 | if (conn->gets(buf, false) == false) |
| 62 | { |
| 63 | printf("readline from client over!\r\n"); |
| 64 | break; |
| 65 | } |
| 66 | if (i % 10000 == 0) |
| 67 | printf("read count: %d, readline: %s", i, buf.c_str()); |
| 68 | } |
| 69 | |
| 70 | struct timeval end; |
| 71 | gettimeofday(&end, NULL); |
| 72 | |
| 73 | double n = util::stamp_sub(&end, &begin); |
| 74 | printf("total read: %d, spent: %0.2f ms, speed: %0.2f\r\n", |
| 75 | i, n, (i * 1000) /(n > 0 ? n : 1)); |
| 76 | |
| 77 | return NULL; |
| 78 | } |
| 79 | |
| 80 | static void* thread_write(void* ctx) |
| 81 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…