| 127 | } |
| 128 | |
| 129 | static int header_parse(const char* filepath, int max) |
| 130 | { |
| 131 | int i; |
| 132 | double n; |
| 133 | ACL_VSTREAM* fp; |
| 134 | ACL_ITER iter; |
| 135 | struct timeval begin, end; |
| 136 | char line[1024]; |
| 137 | ACL_ARGV* tokens = acl_argv_alloc(10); |
| 138 | |
| 139 | fp = acl_vstream_fopen(filepath, O_RDONLY, 0600, 8192); |
| 140 | if (fp == NULL) |
| 141 | { |
| 142 | printf("open file %s error\r\n", filepath); |
| 143 | return 0; |
| 144 | } |
| 145 | |
| 146 | while (1) |
| 147 | { |
| 148 | i = acl_vstream_gets_nonl(fp, line, sizeof(line)); |
| 149 | if (i == 0 || i == ACL_VSTREAM_EOF) |
| 150 | break; |
| 151 | acl_argv_add(tokens, line, NULL); |
| 152 | } |
| 153 | |
| 154 | acl_foreach(iter, tokens) |
| 155 | { |
| 156 | printf("%s\r\n", (const char*) iter.data); |
| 157 | } |
| 158 | |
| 159 | printf("----------------------------------------------------\r\n"); |
| 160 | |
| 161 | gettimeofday(&begin, NULL); |
| 162 | |
| 163 | #define HDR_RES |
| 164 | |
| 165 | ACL_METER_TIME("begin run"); |
| 166 | for (i = 0; i < max; i++) |
| 167 | { |
| 168 | #ifdef HDR_RES |
| 169 | HTTP_HDR_RES* hdr; |
| 170 | #else |
| 171 | HTTP_HDR_REQ* hdr; |
| 172 | #endif |
| 173 | int j = 0; |
| 174 | |
| 175 | #ifdef HDR_RES |
| 176 | hdr = http_hdr_res_new(); |
| 177 | #else |
| 178 | hdr = http_hdr_req_new(); |
| 179 | #endif |
| 180 | acl_foreach(iter, tokens) |
| 181 | { |
| 182 | HTTP_HDR_ENTRY* entry = |
| 183 | http_hdr_entry_new((const char*) iter.data); |
| 184 | http_hdr_append_entry(&hdr->hdr, entry); |
| 185 | if (++j == 200) |
| 186 | break; |
no test coverage detected
searching dependent graphs…