| 54 | } |
| 55 | |
| 56 | static void handle_client(acl::socket_stream* client) |
| 57 | { |
| 58 | acl::http_response res(client); |
| 59 | http_response response(&res); |
| 60 | |
| 61 | int i = 0; |
| 62 | |
| 63 | __header_spent = 0; |
| 64 | __body_spent = 0; |
| 65 | __parse_spent = 0; |
| 66 | __build_spent = 0; |
| 67 | __response_spent = 0; |
| 68 | |
| 69 | char buf[64]; |
| 70 | ACL_METER_TIME("begin run"); |
| 71 | while (true) |
| 72 | { |
| 73 | if (handle_one(response, i > 1 ? false : true) == false) |
| 74 | break; |
| 75 | |
| 76 | __header_spent += response.header_spent(); |
| 77 | __body_spent += response.body_spent(); |
| 78 | __parse_spent += response.parse_spent(); |
| 79 | __build_spent += response.build_spent(); |
| 80 | __response_spent += response.response_spent(); |
| 81 | |
| 82 | if (++i % 1000 == 0) |
| 83 | { |
| 84 | snprintf(buf, sizeof(buf), "total: %d", i); |
| 85 | ACL_METER_TIME(buf); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | printf("total count: %d, header_spent: %0.2f, body_spent: %0.2f, " |
| 90 | "parse_spent: %0.2f, build_spent: %0.2f, response_spent: %0.2f\r\n", |
| 91 | i, __header_spent, __body_spent, __parse_spent, |
| 92 | __build_spent, __response_spent); |
| 93 | } |
| 94 | |
| 95 | static void usage(const char* procname) |
| 96 | { |
no test coverage detected
searching dependent graphs…