From: Bradley Nicholes Date: Mon, 21 Jun 2004 19:49:42 +0000 (+0000) Subject: Added display code for the URL cache X-Git-Tag: pre_ajp_proxy~138 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4497da3c53466109e34ab70bc1776314cb7bc000;p=apache Added display code for the URL cache git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104010 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/util_ldap_cache.c b/modules/experimental/util_ldap_cache.c index 0225d4ce8b..7cfe8b6771 100644 --- a/modules/experimental/util_ldap_cache.c +++ b/modules/experimental/util_ldap_cache.c @@ -82,6 +82,53 @@ void util_ldap_url_node_free(util_ald_cache_t *cache, void *n) void util_ldap_url_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_url_node_t *node = (util_url_node_t *)n; + char date_str[APR_CTIME_LEN+1]; + char *buf; + const char *type_str; + util_ald_cache_t *cache_node; + int x; + + for (x=0;x<3;x++) { + switch (x) { + case 0: + cache_node = node->search_cache; + type_str = "Searches"; + break; + case 1: + cache_node = node->compare_cache; + type_str = "Compares"; + break; + case 2: + cache_node = node->dn_compare_cache; + type_str = "DN Compares"; + break; + } + + if (cache_node->marktime) { + apr_ctime(date_str, cache_node->marktime); + } + else + date_str[0] = 0; + + buf = apr_psprintf(r->pool, + "" + "%s (%s)" + "%ld" + "%ld" + "%ld" + "%ld" + "%s" + "", + node->url, + type_str, + cache_node->size, + cache_node->maxentries, + cache_node->numentries, + cache_node->fullmark, + date_str); + + ap_rputs(buf, r); + } } diff --git a/modules/experimental/util_ldap_cache_mgr.c b/modules/experimental/util_ldap_cache_mgr.c index 9e684ecb4a..fe9745fc8f 100644 --- a/modules/experimental/util_ldap_cache_mgr.c +++ b/modules/experimental/util_ldap_cache_mgr.c @@ -529,8 +529,8 @@ char *util_ald_cache_display(request_rec *r, util_ldap_state_t *st) char *argfmt = "cache=%s&id=%d&off=%d"; char *scanfmt = "cache=%4s&id=%u&off=%u%1s"; apr_pool_t *pool = r->pool; - util_cache_node_t *p; - util_url_node_t *n; + util_cache_node_t *p = NULL; + util_url_node_t *n = NULL; util_ald_cache_t *util_ldap_cache = st->util_ldap_cache; @@ -543,12 +543,18 @@ char *util_ald_cache_display(request_rec *r, util_ldap_state_t *st) char cachetype[5], lint[2]; unsigned int id, off; int ret; + char date_str[APR_CTIME_LEN+1]; if ((3 == sscanf(r->args, scanfmt, cachetype, &id, &off, lint)) && (id < util_ldap_cache->size)) { - p = util_ldap_cache->nodes[id]; - n = (util_url_node_t *)p->payload; + if ((p = util_ldap_cache->nodes[id]) != NULL) { + n = (util_url_node_t *)p->payload; + buf = (char*)n->url; + } + else { + buf = ""; + } ap_rputs(apr_psprintf(r->pool, "

\n" @@ -558,10 +564,70 @@ char *util_ald_cache_display(request_rec *r, util_ldap_state_t *st) "%s (%s)" "\n" "\n

\n", - n->url, - cachetype[0] == 's' ? "Search" : (cachetype[0] == 'c' ? "Compares" : "DNCompares")), r); + buf, + cachetype[0] == 'm'? "Main" : + (cachetype[0] == 's' ? "Search" : + (cachetype[0] == 'c' ? "Compares" : "DNCompares"))), r); switch (cachetype[0]) { + case 'm': + if (util_ldap_cache->marktime) { + apr_ctime(date_str, util_ldap_cache->marktime); + } + else + date_str[0] = 0; + + ap_rputs(apr_psprintf(r->pool, + "

\n" + "\n" + "\n" + "" + "" + "\n" + "\n" + "" + "" + "\n" + "\n" + "" + "" + "\n" + "\n" + "" + "" + "\n" + "\n" + "" + "" + "\n" + "
Size:%ld
Max Entries:%ld
# Entries:%ld
Full Mark:%ld
Full Mark Time:%s
\n

\n", + util_ldap_cache->size, + util_ldap_cache->maxentries, + util_ldap_cache->numentries, + util_ldap_cache->fullmark, + date_str), r); + + ap_rputs("

\n" + "\n" + "\n" + "" + "" + "" + "" + "" + "" + "\n", r + ); + for (i=0; i < util_ldap_cache->size; ++i) { + for (p = util_ldap_cache->nodes[i]; p != NULL; p = p->next) { + + (*util_ldap_cache->display)(r, util_ldap_cache, p->payload); + } + } + ap_rputs("
LDAP URLSizeMax Entries# EntriesFull MarkFull Mark Time
\n

\n", r); + + + break; case 's': ap_rputs("

\n" "\n" @@ -635,7 +701,8 @@ char *util_ald_cache_display(request_rec *r, util_ldap_state_t *st) ); - buf = util_ald_cache_display_stats(r, st->util_ldap_cache, "LDAP URL Cache", NULL); + id1 = apr_psprintf(pool, argfmt, "main", 0, 0); + buf = util_ald_cache_display_stats(r, st->util_ldap_cache, "LDAP URL Cache", id1); for (i=0; i < util_ldap_cache->size; ++i) { for (p = util_ldap_cache->nodes[i],j=0; p != NULL; p = p->next,j++) {