MCPcopy Create free account
hub / github.com/apache/httpd / dump_iphash_statistics

Function dump_iphash_statistics

server/vhost.c:297–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295
296
297static void dump_iphash_statistics(server_rec *main_s)
298{
299 unsigned count[IPHASH_TABLE_SIZE];
300 int i;
301 ipaddr_chain *src;
302 unsigned total;
303 char buf[HUGE_STRING_LEN];
304 char *p;
305
306 total = 0;
307 for (i = 0; i < IPHASH_TABLE_SIZE; ++i) {
308 count[i] = 0;
309 for (src = iphash_table[i]; src; src = src->next) {
310 ++count[i];
311 if (i < IPHASH_TABLE_SIZE) {
312 /* don't count the slop buckets in the total */
313 ++total;
314 }
315 }
316 }
317 qsort(count, IPHASH_TABLE_SIZE, sizeof(count[0]), iphash_compare);
318 p = buf + apr_snprintf(buf, sizeof(buf),
319 APLOGNO(03235) "iphash: total hashed = %u, avg chain = %u, "
320 "chain lengths (count x len):",
321 total, total / IPHASH_TABLE_SIZE);
322 total = 1;
323 for (i = 1; i < IPHASH_TABLE_SIZE; ++i) {
324 if (count[i - 1] != count[i]) {
325 p += apr_snprintf(p, sizeof(buf) - (p - buf), " %ux%u",
326 total, count[i - 1]);
327 total = 1;
328 }
329 else {
330 ++total;
331 }
332 }
333 p += apr_snprintf(p, sizeof(buf) - (p - buf), " %ux%u",
334 total, count[IPHASH_TABLE_SIZE - 1]);
335 /* Intentional no APLOGNO */
336 /* buf provides APLOGNO */
337 ap_log_error(APLOG_MARK, APLOG_DEBUG, main_s, buf);
338}
339#endif
340
341

Callers 1

ap_fini_vhost_configFunction · 0.85

Calls 1

ap_log_errorFunction · 0.50

Tested by

no test coverage detected