mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Patch add msg, rrset, infra and key cache sizes to stats command
from Maciej Soltysiak. git-svn-id: file:///svn/unbound/trunk@3203 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
e752c94cf6
commit
5a9c377104
9 changed files with 80 additions and 4 deletions
|
|
@ -961,7 +961,9 @@ stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h $(s
|
|||
$(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/daemon/daemon.h \
|
||||
$(srcdir)/services/modstack.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \
|
||||
$(srcdir)/services/outside_network.h $(srcdir)/util/config_file.h $(srcdir)/util/tube.h \
|
||||
$(srcdir)/util/net_help.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h
|
||||
$(srcdir)/util/net_help.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h \
|
||||
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h \
|
||||
$(srcdir)/util/rtt.h $(srcdir)/validator/val_kcache.h
|
||||
unbound.lo unbound.o: $(srcdir)/daemon/unbound.c config.h $(srcdir)/util/log.h $(srcdir)/daemon/daemon.h \
|
||||
$(srcdir)/util/locks.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h $(srcdir)/daemon/remote.h \
|
||||
$(srcdir)/util/config_file.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h \
|
||||
|
|
@ -1035,7 +1037,9 @@ stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h $(s
|
|||
$(srcdir)/ldns/pkthdr.h $(srcdir)/ldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/daemon/daemon.h \
|
||||
$(srcdir)/services/modstack.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \
|
||||
$(srcdir)/services/outside_network.h $(srcdir)/util/config_file.h $(srcdir)/util/tube.h \
|
||||
$(srcdir)/util/net_help.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h
|
||||
$(srcdir)/util/net_help.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h \
|
||||
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h \
|
||||
$(srcdir)/util/rtt.h $(srcdir)/validator/val_kcache.h
|
||||
replay.lo replay.o: $(srcdir)/testcode/replay.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \
|
||||
$(srcdir)/util/config_file.h $(srcdir)/testcode/replay.h $(srcdir)/util/netevent.h $(srcdir)/testcode/testpkts.h \
|
||||
$(srcdir)/util/rbtree.h $(srcdir)/testcode/fake_event.h $(srcdir)/ldns/str2wire.h $(srcdir)/ldns/rrdef.h
|
||||
|
|
|
|||
|
|
@ -267,6 +267,10 @@ if test "$1" = "config" ; then
|
|||
p_config "mem.cache.message" "Message cache memory"
|
||||
p_config "mem.mod.iterator" "Iterator module memory"
|
||||
p_config "mem.mod.validator" "Validator module and key cache memory"
|
||||
p_config "msg.cache.count" "msg cache count"
|
||||
p_config "rrset.cache.count" "rrset cache count"
|
||||
p_config "infra.cache.count" "infra cache count"
|
||||
p_config "key.cache.count" "key cache count"
|
||||
echo "graph_info The memory used by unbound."
|
||||
;;
|
||||
by_type)
|
||||
|
|
@ -454,8 +458,9 @@ memory)
|
|||
fi
|
||||
fi
|
||||
echo "$mn.value" $value
|
||||
for x in mem.cache.rrset mem.cache.message \
|
||||
mem.mod.iterator mem.mod.validator; do
|
||||
for x in mem.cache.rrset mem.cache.message mem.mod.iterator \
|
||||
mem.mod.validator msg.cache.count rrset.cache.count \
|
||||
infra.cache.count key.cache.count; do
|
||||
print_value $x
|
||||
done
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -876,6 +876,15 @@ print_ext(SSL* ssl, struct stats_info* s)
|
|||
(unsigned long)s->svr.unwanted_queries)) return 0;
|
||||
if(!ssl_printf(ssl, "unwanted.replies"SQ"%lu\n",
|
||||
(unsigned long)s->svr.unwanted_replies)) return 0;
|
||||
/* cache counts */
|
||||
if(!ssl_printf(ssl, "msg.cache.count"SQ"%u\n",
|
||||
(unsigned)s->svr.msg_cache_count)) return 0;
|
||||
if(!ssl_printf(ssl, "rrset.cache.count"SQ"%u\n",
|
||||
(unsigned)s->svr.rrset_cache_count)) return 0;
|
||||
if(!ssl_printf(ssl, "infra.cache.count"SQ"%u\n",
|
||||
(unsigned)s->svr.infra_cache_count)) return 0;
|
||||
if(!ssl_printf(ssl, "key.cache.count"SQ"%u\n",
|
||||
(unsigned)s->svr.key_cache_count)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@
|
|||
#include "util/net_help.h"
|
||||
#include "validator/validator.h"
|
||||
#include "ldns/sbuffer.h"
|
||||
#include "services/cache/rrset.h"
|
||||
#include "services/cache/infra.h"
|
||||
#include "validator/val_kcache.h"
|
||||
|
||||
/** add timers and the values do not overflow or become negative */
|
||||
static void
|
||||
|
|
@ -163,6 +166,14 @@ server_stats_compile(struct worker* worker, struct stats_info* s, int reset)
|
|||
/* get and reset validator rrset bogus number */
|
||||
s->svr.rrset_bogus = get_rrset_bogus(worker);
|
||||
|
||||
/* get cache sizes */
|
||||
s->svr.msg_cache_count = count_slabhash_entries(worker->env.msg_cache);
|
||||
s->svr.rrset_cache_count = count_slabhash_entries(&worker->env.rrset_cache->table);
|
||||
s->svr.infra_cache_count = count_slabhash_entries(worker->env.infra_cache->hosts);
|
||||
if(worker->env.key_cache)
|
||||
s->svr.key_cache_count = count_slabhash_entries(worker->env.key_cache->slab);
|
||||
else s->svr.key_cache_count = 0;
|
||||
|
||||
if(reset && !worker->env.cfg->stat_cumulative) {
|
||||
worker_stats_clear(worker);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,15 @@ struct server_stats {
|
|||
* if all histograms are same size (is so by default) then
|
||||
* adding up works well. */
|
||||
size_t hist[NUM_BUCKETS_HIST];
|
||||
|
||||
/** number of message cache entries */
|
||||
size_t msg_cache_count;
|
||||
/** number of rrset cache entries */
|
||||
size_t rrset_cache_count;
|
||||
/** number of infra cache entries */
|
||||
size_t infra_cache_count;
|
||||
/** number of key cache entries */
|
||||
size_t key_cache_count;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
1 August 2014: Wouter
|
||||
- Patch add msg, rrset, infra and key cache sizes to stats command
|
||||
from Maciej Soltysiak.
|
||||
|
||||
31 July 2014: Wouter
|
||||
- DNS64 from Viagenie (BSD Licensed), written by Simon Perrault.
|
||||
Initial commit of the patch from the FreeBSD base (with its fixes).
|
||||
|
|
|
|||
|
|
@ -463,6 +463,21 @@ Replies that were unwanted or unsolicited. Could have been random traffic,
|
|||
delayed duplicates, very late answers, or could be spoofing attempts.
|
||||
Some low level of late answers and delayed duplicates are to be expected
|
||||
with the UDP protocol. Very high values could indicate a threat (spoofing).
|
||||
.TP
|
||||
.I msg.cache.count
|
||||
The number of items (DNS replies) in the message cache.
|
||||
.TP
|
||||
.I rrset.cache.count
|
||||
The number of RRsets in the rrset cache. This includes rrsets used by
|
||||
the messages in the message cache, but also delegation information.
|
||||
.TP
|
||||
.I infra.cache.count
|
||||
The number of items in the infra cache. These are IP addresses with their
|
||||
timing and protocol support information.
|
||||
.TP
|
||||
.I key.cache.count
|
||||
The number of items in the key cache. These are DNSSEC keys, one item
|
||||
per delegation point, and their validation status.
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I @ub_conf_file@
|
||||
|
|
|
|||
|
|
@ -217,3 +217,15 @@ void slabhash_traverse(struct slabhash* sh, int wr,
|
|||
for(i=0; i<sh->size; i++)
|
||||
lruhash_traverse(sh->array[i], wr, func, arg);
|
||||
}
|
||||
|
||||
size_t count_slabhash_entries(struct slabhash* sh)
|
||||
{
|
||||
size_t slab, cnt = 0;
|
||||
|
||||
for(slab=0; slab<sh->size; slab++) {
|
||||
lock_quick_lock(&sh->array[slab]->lock);
|
||||
cnt += sh->array[slab]->num;
|
||||
lock_quick_unlock(&sh->array[slab]->lock);
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,6 +184,13 @@ void slabhash_setmarkdel(struct slabhash* table, lruhash_markdelfunc_t md);
|
|||
void slabhash_traverse(struct slabhash* table, int wr,
|
||||
void (*func)(struct lruhash_entry*, void*), void* arg);
|
||||
|
||||
/*
|
||||
* Count entries in slabhash.
|
||||
* @param table: slabbed hash table;
|
||||
* @return the number of items
|
||||
*/
|
||||
size_t count_slabhash_entries(struct slabhash* table);
|
||||
|
||||
/* --- test representation --- */
|
||||
/** test structure contains test key */
|
||||
struct slabhash_testkey {
|
||||
|
|
|
|||
Loading…
Reference in a new issue