| 26 | static struct timeval __begin; |
| 27 | |
| 28 | static void echo_client(int fd) |
| 29 | { |
| 30 | char buf[8192]; |
| 31 | int ret, i; |
| 32 | const char *str = "hello world\r\n"; |
| 33 | |
| 34 | for (i = 0; i < __max_loop; i++) { |
| 35 | if (write(fd, str, strlen(str)) <= 0) { |
| 36 | printf("write error: %s\r\n", strerror(errno)); |
| 37 | break; |
| 38 | } |
| 39 | |
| 40 | if (!__read_data) { |
| 41 | __total_count++; |
| 42 | if (i % 10000 == 0) |
| 43 | printf("fiber-%d: total %lld, curr %d\r\n", |
| 44 | acl_fiber_self(), __total_count, i); |
| 45 | if (__total_count % 10000 == 0) |
| 46 | acl_fiber_yield(); |
| 47 | continue; |
| 48 | } |
| 49 | |
| 50 | ret = read(fd, buf, sizeof(buf)); |
| 51 | if (ret <= 0) { |
| 52 | printf("read error: %s\r\n", strerror(errno)); |
| 53 | break; |
| 54 | } |
| 55 | |
| 56 | __total_count++; |
| 57 | } |
| 58 | |
| 59 | close(fd); |
| 60 | } |
| 61 | |
| 62 | static void fiber_connect(ACL_FIBER *fiber acl_unused, void *ctx acl_unused) |
| 63 | { |
no test coverage detected
searching dependent graphs…