send_ok(ssl);
}
+/** flush statistics */
+static void
+do_flush_stats(SSL* ssl, struct worker* worker)
+{
+ worker_stats_clear(worker);
+ send_ok(ssl);
+}
+
/**
* Local info for deletion functions
*/
} else if(strncmp(p, "load_cache", 10) == 0) {
if(load_cache(ssl, worker)) send_ok(ssl);
return;
+ } else if(strncmp(p, "flush_stats", 11) == 0) {
+ /* must always distribute this cmd */
+ if(rc)
+ distribute_cmd(rc, ssl, cmd);
+ do_flush_stats(ssl, worker);
+ return;
} else if(strncmp(p, "lookup", 6) == 0) {
do_lookup(ssl, worker, skipwhite(p+6));
return;
s->svr.rrset_bogus = get_rrset_bogus(worker);
if(!worker->env.cfg->stat_cumulative) {
- server_stats_init(&worker->stats, worker->env.cfg);
- mesh_stats_clear(worker->env.mesh);
- worker->back->unwanted_replies = 0;
+ worker_stats_clear(worker);
}
}
verbose(VERB_ALGO, "got control cmd stats");
server_stats_reply(worker);
break;
-#ifdef THREADS_DISABLED
case worker_cmd_remote:
verbose(VERB_ALGO, "got control cmd remote");
daemon_remote_exec(worker);
break;
-#endif
default:
log_err("bad command %d", (int)cmd);
break;
mesh_stats(worker->env.mesh, "mesh has");
worker_mem_report(worker, NULL);
if(!worker->daemon->cfg->stat_cumulative) {
- server_stats_init(&worker->stats, worker->env.cfg);
- mesh_stats_clear(worker->env.mesh);
- worker->back->unwanted_replies = 0;
+ worker_stats_clear(worker);
}
/* start next timer */
worker_restart_timer(worker);
slabhash_clear(worker->env.msg_cache);
}
+void worker_stats_clear(struct worker* worker)
+{
+ server_stats_init(&worker->stats, worker->env.cfg);
+ mesh_stats_clear(worker->env.mesh);
+ worker->back->unwanted_replies = 0;
+}
+
/* --- fake callbacks for fptr_wlist to work --- */
int libworker_send_packet(ldns_buffer* ATTR_UNUSED(pkt),
struct sockaddr_storage* ATTR_UNUSED(addr),
/** cleanup the cache to remove all rrset IDs from it, arg is worker */
void worker_alloc_cleanup(void* arg);
+/**
+ * Init worker stats - includes server_stats_init, outside network and mesh.
+ * @param worker: the worker to init
+ */
+void worker_stats_clear(struct worker* worker);
+
/** statistics timer callback handler */
void worker_stat_timer_cb(void* arg);
12 February 2009: Wouter
- call setusercontext if available (on BSD).
+ - small refactor of stats clearing.
+ - #227: flush_stats feature for unbound-control.
10 February 2009: Wouter
- keys with rfc5011 REVOKE flag are skipped and not considered when
o remote control read ssl information while priviledged.
o infra and lame cache: easier size config (in Mb), show usage in graphs.
-o #226: unbound_control dump_requestlist
-o #227: unbound_control flush_stats
o unbound_control get_stats_noreset
o unbound_control forward [addr {addr}] | [off]
o config entry to denote that a zone is to be treated as unsigned (even if
The rrsets and key entries are removed so that new lookups will be performed.
This needs to walk and inspect the entire cache, and is a slow operation.
.TP
+.B flush_stats
+Reset statistics to zero.
+.TP
.B dump_requestlist
Show what is worked on. Prints all queries that the server is currently
working on. Prints the time that users have been waiting. For internal
printf(" flush_type [name] [type] flush name, type from cache\n");
printf(" flush_zone [name] flush everything at or under name\n");
printf(" from rr and dnssec caches\n");
+ printf(" flush_stats flush statistics, make zero\n");
printf(" dump_requestlist show what is worked on\n");
printf("Version %s\n", PACKAGE_VERSION);
printf("BSD licensed, see LICENSE in source package for details.\n");