mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- better module memory lookup, fix of unbound-control shm names for
module memory printout of statistics. git-svn-id: file:///svn/unbound/trunk@4161 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
305f6f0295
commit
92d625b648
7 changed files with 40 additions and 65 deletions
|
|
@ -866,7 +866,6 @@ print_longnum(SSL* ssl, const char* desc, size_t x)
|
||||||
static int
|
static int
|
||||||
print_mem(SSL* ssl, struct worker* worker, struct daemon* daemon)
|
print_mem(SSL* ssl, struct worker* worker, struct daemon* daemon)
|
||||||
{
|
{
|
||||||
int m;
|
|
||||||
size_t msg, rrset, val, iter, respip;
|
size_t msg, rrset, val, iter, respip;
|
||||||
#ifdef CLIENT_SUBNET
|
#ifdef CLIENT_SUBNET
|
||||||
size_t subnet = 0;
|
size_t subnet = 0;
|
||||||
|
|
@ -876,47 +875,14 @@ print_mem(SSL* ssl, struct worker* worker, struct daemon* daemon)
|
||||||
#endif /* USE_IPSECMOD */
|
#endif /* USE_IPSECMOD */
|
||||||
msg = slabhash_get_mem(daemon->env->msg_cache);
|
msg = slabhash_get_mem(daemon->env->msg_cache);
|
||||||
rrset = slabhash_get_mem(&daemon->env->rrset_cache->table);
|
rrset = slabhash_get_mem(&daemon->env->rrset_cache->table);
|
||||||
val=0;
|
val = mod_get_mem(&worker->env, "validator");
|
||||||
iter=0;
|
iter = mod_get_mem(&worker->env, "iterator");
|
||||||
respip=0;
|
respip = mod_get_mem(&worker->env, "respip");
|
||||||
m = modstack_find(&worker->env.mesh->mods, "validator");
|
|
||||||
if(m != -1) {
|
|
||||||
fptr_ok(fptr_whitelist_mod_get_mem(worker->env.mesh->
|
|
||||||
mods.mod[m]->get_mem));
|
|
||||||
val = (*worker->env.mesh->mods.mod[m]->get_mem)
|
|
||||||
(&worker->env, m);
|
|
||||||
}
|
|
||||||
m = modstack_find(&worker->env.mesh->mods, "iterator");
|
|
||||||
if(m != -1) {
|
|
||||||
fptr_ok(fptr_whitelist_mod_get_mem(worker->env.mesh->
|
|
||||||
mods.mod[m]->get_mem));
|
|
||||||
iter = (*worker->env.mesh->mods.mod[m]->get_mem)
|
|
||||||
(&worker->env, m);
|
|
||||||
}
|
|
||||||
m = modstack_find(&worker->env.mesh->mods, "respip");
|
|
||||||
if(m != -1) {
|
|
||||||
fptr_ok(fptr_whitelist_mod_get_mem(worker->env.mesh->
|
|
||||||
mods.mod[m]->get_mem));
|
|
||||||
respip = (*worker->env.mesh->mods.mod[m]->get_mem)
|
|
||||||
(&worker->env, m);
|
|
||||||
}
|
|
||||||
#ifdef CLIENT_SUBNET
|
#ifdef CLIENT_SUBNET
|
||||||
m = modstack_find(&worker->env.mesh->mods, "subnet");
|
subnet = mod_get_mem(&worker->env, "subnet");
|
||||||
if(m != -1) {
|
|
||||||
fptr_ok(fptr_whitelist_mod_get_mem(worker->env.mesh->
|
|
||||||
mods.mod[m]->get_mem));
|
|
||||||
subnet = (*worker->env.mesh->mods.mod[m]->get_mem)
|
|
||||||
(&worker->env, m);
|
|
||||||
}
|
|
||||||
#endif /* CLIENT_SUBNET */
|
#endif /* CLIENT_SUBNET */
|
||||||
#ifdef USE_IPSECMOD
|
#ifdef USE_IPSECMOD
|
||||||
m = modstack_find(&worker->env.mesh->mods, "ipsecmod");
|
ipsecmod = mod_get_mem(&worker->env, "ipsecmod");
|
||||||
if(m != -1) {
|
|
||||||
fptr_ok(fptr_whitelist_mod_get_mem(worker->env.mesh->
|
|
||||||
mods.mod[m]->get_mem));
|
|
||||||
ipsecmod = (*worker->env.mesh->mods.mod[m]->get_mem)
|
|
||||||
(&worker->env, m);
|
|
||||||
}
|
|
||||||
#endif /* USE_IPSECMOD */
|
#endif /* USE_IPSECMOD */
|
||||||
|
|
||||||
if(!print_longnum(ssl, "mem.cache.rrset"SQ, rrset))
|
if(!print_longnum(ssl, "mem.cache.rrset"SQ, rrset))
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
- updated dependencies in the makefile.
|
- updated dependencies in the makefile.
|
||||||
- document trust-anchor-signaling in example config file.
|
- document trust-anchor-signaling in example config file.
|
||||||
- updated configure, dependencies and flex output.
|
- updated configure, dependencies and flex output.
|
||||||
|
- better module memory lookup, fix of unbound-control shm names for
|
||||||
|
module memory printout of statistics.
|
||||||
|
|
||||||
12 May 2017: Wouter
|
12 May 2017: Wouter
|
||||||
- Adjust servfail by iterator to not store in cache when serve-expired
|
- Adjust servfail by iterator to not store in cache when serve-expired
|
||||||
|
|
|
||||||
|
|
@ -621,6 +621,7 @@ struct ub_shm_stat_info {
|
||||||
long long iter;
|
long long iter;
|
||||||
long long subnet;
|
long long subnet;
|
||||||
long long ipsecmod;
|
long long ipsecmod;
|
||||||
|
long long respip;
|
||||||
} mem;
|
} mem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -243,3 +243,15 @@ modstack_find(struct module_stack* stack, const char* name)
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
mod_get_mem(struct module_env* env, const char* name)
|
||||||
|
{
|
||||||
|
int m = modstack_find(&env->mesh->mods, name);
|
||||||
|
if(m != -1) {
|
||||||
|
fptr_ok(fptr_whitelist_mod_get_mem(env->mesh->
|
||||||
|
mods.mod[m]->get_mem));
|
||||||
|
return (*env->mesh->mods.mod[m]->get_mem)(env, m);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,4 +110,7 @@ void modstack_desetup(struct module_stack* stack, struct module_env* env);
|
||||||
*/
|
*/
|
||||||
int modstack_find(struct module_stack* stack, const char* name);
|
int modstack_find(struct module_stack* stack, const char* name);
|
||||||
|
|
||||||
|
/** fetch memory for a module by name, returns 0 if module not there */
|
||||||
|
size_t mod_get_mem(struct module_env* env, const char* name);
|
||||||
|
|
||||||
#endif /* SERVICES_MODSTACK_H */
|
#endif /* SERVICES_MODSTACK_H */
|
||||||
|
|
|
||||||
|
|
@ -242,10 +242,14 @@ static void print_mem(struct ub_shm_stat_info* shm_stat)
|
||||||
{
|
{
|
||||||
PR_LL("mem.cache.rrset", shm_stat->mem.rrset);
|
PR_LL("mem.cache.rrset", shm_stat->mem.rrset);
|
||||||
PR_LL("mem.cache.message", shm_stat->mem.msg);
|
PR_LL("mem.cache.message", shm_stat->mem.msg);
|
||||||
PR_LL("mem.cache.iterator", shm_stat->mem.iter);
|
PR_LL("mem.mod.iterator", shm_stat->mem.iter);
|
||||||
PR_LL("mem.cache.validator", shm_stat->mem.val);
|
PR_LL("mem.mod.validator", shm_stat->mem.val);
|
||||||
|
PR_LL("mem.mod.respip", shm_stat->mem.respip);
|
||||||
#ifdef CLIENT_SUBNET
|
#ifdef CLIENT_SUBNET
|
||||||
PR_LL("mem.cache.subnet", shm_stat->mem.subnet);
|
PR_LL("mem.mod.subnet", shm_stat->mem.subnet);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_IPSECMOD
|
||||||
|
PR_LL("mem.mod.ipsecmod", shm_stat->mem.ipsecmod);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,6 @@ void shm_main_run(struct worker *worker)
|
||||||
struct ub_shm_stat_info *shm_stat;
|
struct ub_shm_stat_info *shm_stat;
|
||||||
struct ub_stats_info *stat_total;
|
struct ub_stats_info *stat_total;
|
||||||
struct ub_stats_info *stat_info;
|
struct ub_stats_info *stat_info;
|
||||||
int modstack;
|
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
verbose(VERB_DETAIL, "SHM run - worker [%d] - daemon [%p] - timenow(%u) - timeboot(%u)",
|
verbose(VERB_DETAIL, "SHM run - worker [%d] - daemon [%p] - timenow(%u) - timeboot(%u)",
|
||||||
|
|
@ -250,40 +249,28 @@ void shm_main_run(struct worker *worker)
|
||||||
|
|
||||||
shm_stat->mem.msg = (long long)slabhash_get_mem(worker->env.msg_cache);
|
shm_stat->mem.msg = (long long)slabhash_get_mem(worker->env.msg_cache);
|
||||||
shm_stat->mem.rrset = (long long)slabhash_get_mem(&worker->env.rrset_cache->table);
|
shm_stat->mem.rrset = (long long)slabhash_get_mem(&worker->env.rrset_cache->table);
|
||||||
shm_stat->mem.val = 0;
|
shm_stat->mem.val = (long long)mod_get_mem(&worker->env,
|
||||||
shm_stat->mem.iter = 0;
|
"validator");
|
||||||
|
shm_stat->mem.iter = (long long)mod_get_mem(&worker->env,
|
||||||
|
"iterator");
|
||||||
|
shm_stat->mem.respip = (long long)mod_get_mem(&worker->env,
|
||||||
|
"respip");
|
||||||
|
|
||||||
modstack = modstack_find(&worker->env.mesh->mods, "validator");
|
|
||||||
if(modstack != -1) {
|
|
||||||
fptr_ok(fptr_whitelist_mod_get_mem(worker->env.mesh->mods.mod[modstack]->get_mem));
|
|
||||||
shm_stat->mem.val = (long long)(*worker->env.mesh->mods.mod[modstack]->get_mem)(&worker->env, modstack);
|
|
||||||
}
|
|
||||||
modstack = modstack_find(&worker->env.mesh->mods, "iterator");
|
|
||||||
if(modstack != -1) {
|
|
||||||
fptr_ok(fptr_whitelist_mod_get_mem(worker->env.mesh->mods.mod[modstack]->get_mem));
|
|
||||||
shm_stat->mem.iter = (long long)(*worker->env.mesh->mods.mod[modstack]->get_mem)(&worker->env, modstack);
|
|
||||||
}
|
|
||||||
/* subnet mem value is available in shm, also when not enabled,
|
/* subnet mem value is available in shm, also when not enabled,
|
||||||
* to make the struct easier to memmap by other applications,
|
* to make the struct easier to memmap by other applications,
|
||||||
* independent of the configuration of unbound */
|
* independent of the configuration of unbound */
|
||||||
shm_stat->mem.subnet = 0;
|
shm_stat->mem.subnet = 0;
|
||||||
#ifdef CLIENT_SUBNET
|
#ifdef CLIENT_SUBNET
|
||||||
modstack = modstack_find(&worker->env.mesh->mods, "subnet");
|
shm_stat->mem.subnet = (long long)mod_get_mem(&worker->env,
|
||||||
if(modstack != -1) {
|
"subnet");
|
||||||
fptr_ok(fptr_whitelist_mod_get_mem(worker->env.mesh->mods.mod[modstack]->get_mem));
|
|
||||||
shm_stat->mem.subnet = (long long)(*worker->env.mesh->mods.mod[modstack]->get_mem)(&worker->env, modstack);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
/* ipsecmod mem value is available in shm, also when not enabled,
|
/* ipsecmod mem value is available in shm, also when not enabled,
|
||||||
* to make the struct easier to memmap by other applications,
|
* to make the struct easier to memmap by other applications,
|
||||||
* independent of the configuration of unbound */
|
* independent of the configuration of unbound */
|
||||||
shm_stat->mem.ipsecmod = 0;
|
shm_stat->mem.ipsecmod = 0;
|
||||||
#ifdef USE_IPSECMOD
|
#ifdef USE_IPSECMOD
|
||||||
modstack = modstack_find(&worker->env.mesh->mods, "ipsecmod");
|
shm_stat->mem.ipsecmod = (long long)mod_get_mem(&worker->env,
|
||||||
if(modstack != -1) {
|
"ipsecmod");
|
||||||
fptr_ok(fptr_whitelist_mod_get_mem(worker->env.mesh->mods.mod[modstack]->get_mem));
|
|
||||||
shm_stat->mem.ipsecmod = (*worker->env.mesh->mods.mod[modstack]->get_mem)(&worker->env, modstack);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue