unbound
0.1
|
This file describes the data structure used to collect runtime performance numbers. More...
#include "config.h"
#include <ldns/wire2host.h>
#include "daemon/stats.h"
#include "daemon/worker.h"
#include "daemon/daemon.h"
#include "services/mesh.h"
#include "services/outside_network.h"
#include "util/config_file.h"
#include "util/tube.h"
#include "util/timehist.h"
#include "util/net_help.h"
#include "validator/validator.h"
Functions | |
static void | timeval_add (struct timeval *d, const struct timeval *add) |
add timers and the values do not overflow or become negative | |
void | server_stats_init (struct server_stats *stats, struct config_file *cfg) |
Initialize server stats to 0. | |
void | server_stats_querymiss (struct server_stats *stats, struct worker *worker) |
add query if it missed the cache | |
void | server_stats_prefetch (struct server_stats *stats, struct worker *worker) |
add query if was cached and also resulted in a prefetch | |
void | server_stats_log (struct server_stats *stats, struct worker *worker, int threadnum) |
display the stats to the log | |
static size_t | get_rrset_bogus (struct worker *worker) |
get rrsets bogus number from validator | |
void | server_stats_compile (struct worker *worker, struct stats_info *s, int reset) |
Compile stats into structure for this thread worker. | |
void | server_stats_obtain (struct worker *worker, struct worker *who, struct stats_info *s, int reset) |
Obtain the stats info for a given thread. | |
void | server_stats_reply (struct worker *worker, int reset) |
Send stats over comm tube in reply to query cmd. | |
void | server_stats_add (struct stats_info *total, struct stats_info *a) |
Addup stat blocks. | |
void | server_stats_insquery (struct server_stats *stats, struct comm_point *c, uint16_t qtype, uint16_t qclass, struct edns_data *edns, struct comm_reply *repinfo) |
Add stats for this query. | |
void | server_stats_insrcode (struct server_stats *stats, ldns_buffer *buf) |
Add rcode for this query. |
This file describes the data structure used to collect runtime performance numbers.
These 'statistics' may be of interest to the operator.
void server_stats_init | ( | struct server_stats * | stats, |
struct config_file * | cfg | ||
) |
Initialize server stats to 0.
stats,: | what to init (this is alloced by the caller). |
cfg,: | with extended statistics option. |
References server_stats::extended, and config_file::stat_extended.
Referenced by worker_init(), and worker_stats_clear().
void server_stats_compile | ( | struct worker * | worker, |
struct stats_info * | s, | ||
int | reset | ||
) |
Compile stats into structure for this thread worker.
Also clears the statistics counters (if that is set by config file).
worker,: | the worker to compile stats for, also the executing worker. |
s,: | stats block. |
reset,: | if true, depending on config stats are reset. if false, statistics are not reset. |
References mesh_area::all, mesh_area::ans_bogus, server_stats::ans_bogus, mesh_area::ans_nodata, server_stats::ans_rcode, mesh_area::ans_rcode, server_stats::ans_rcode_nodata, mesh_area::ans_secure, server_stats::ans_secure, worker::back, module_env::cfg, rbtree_t::count, worker::env, get_rrset_bogus(), server_stats::hist, mesh_area::histogram, module_env::mesh, stats_info::mesh_dropped, stats_info::mesh_jostled, stats_info::mesh_num_reply_states, stats_info::mesh_num_states, stats_info::mesh_replies_sent, stats_info::mesh_replies_sum_wait, stats_info::mesh_time_median, NUM_BUCKETS_HIST, mesh_area::num_reply_states, mesh_area::replies_sent, mesh_area::replies_sum_wait, server_stats::rrset_bogus, config_file::stat_cumulative, worker::stats, mesh_area::stats_dropped, mesh_area::stats_jostled, stats_info::svr, timehist_export(), timehist_quartile(), outside_network::unwanted_replies, server_stats::unwanted_replies, and worker_stats_clear().
Referenced by server_stats_obtain(), and server_stats_reply().
void server_stats_obtain | ( | struct worker * | worker, |
struct worker * | who, | ||
struct stats_info * | s, | ||
int | reset | ||
) |
Obtain the stats info for a given thread.
Uses pipe to communicate.
worker,: | the worker that is executing (the first worker). |
who,: | on who to get the statistics info. |
s,: | the stats block to fill in. |
reset,: | if stats can be reset. |
References worker::cmd, fatal_exit(), server_stats_compile(), tube_read_msg(), VERB_ALGO, verbose(), worker_cmd_stats, worker_cmd_stats_noreset, and worker_send_cmd().
Referenced by do_stats().
void server_stats_reply | ( | struct worker * | worker, |
int | reset | ||
) |
Send stats over comm tube in reply to query cmd.
worker,: | this worker. |
reset,: | if true, depending on config stats are reset. if false, statistics are not reset. |
References worker::cmd, worker::daemon, fatal_exit(), server_stats_compile(), tube_write_msg(), VERB_ALGO, verbose(), and daemon::workers.
void server_stats_add | ( | struct stats_info * | total, |
struct stats_info * | a | ||
) |
Addup stat blocks.
total,: | sum of the two entries. |
a,: | to add to it. |
References server_stats::ans_bogus, server_stats::ans_rcode, server_stats::ans_rcode_nodata, server_stats::ans_secure, server_stats::extended, server_stats::hist, server_stats::max_query_list_size, stats_info::mesh_dropped, stats_info::mesh_jostled, stats_info::mesh_num_reply_states, stats_info::mesh_num_states, stats_info::mesh_replies_sent, stats_info::mesh_replies_sum_wait, stats_info::mesh_time_median, NUM_BUCKETS_HIST, server_stats::num_queries, server_stats::num_queries_missed_cache, server_stats::num_queries_prefetch, server_stats::qbit_AA, server_stats::qbit_AD, server_stats::qbit_CD, server_stats::qbit_QR, server_stats::qbit_RA, server_stats::qbit_RD, server_stats::qbit_TC, server_stats::qbit_Z, server_stats::qclass, server_stats::qclass_big, server_stats::qEDNS, server_stats::qEDNS_DO, server_stats::qipv6, server_stats::qopcode, server_stats::qtcp, server_stats::qtype, server_stats::qtype_big, server_stats::rrset_bogus, STATS_OPCODE_NUM, STATS_QCLASS_NUM, STATS_QTYPE_NUM, STATS_RCODE_NUM, server_stats::sum_query_list_size, stats_info::svr, timeval_add(), server_stats::unwanted_queries, and server_stats::unwanted_replies.
Referenced by do_stats().
void server_stats_insquery | ( | struct server_stats * | stats, |
struct comm_point * | c, | ||
uint16_t | qtype, | ||
uint16_t | qclass, | ||
struct edns_data * | edns, | ||
struct comm_reply * | repinfo | ||
) |
Add stats for this query.
stats,: | the stats |
c,: | commpoint with type and buffer. |
qtype,: | query type |
qclass,: | query class |
edns,: | edns record |
repinfo,: | reply info with remote address |
References comm_reply::addr, addr_is_ip6(), comm_reply::addrlen, BIT_AA, BIT_AD, BIT_CD, BIT_QR, BIT_RA, BIT_RD, BIT_TC, BIT_Z, edns_data::bits, comm_point::buffer, EDNS_DO, edns_data::edns_present, server_stats::qbit_AA, server_stats::qbit_AD, server_stats::qbit_CD, server_stats::qbit_QR, server_stats::qbit_RA, server_stats::qbit_RD, server_stats::qbit_TC, server_stats::qbit_Z, server_stats::qclass, server_stats::qclass_big, server_stats::qEDNS, server_stats::qEDNS_DO, server_stats::qipv6, server_stats::qopcode, server_stats::qtcp, server_stats::qtype, server_stats::qtype_big, STATS_QCLASS_NUM, STATS_QTYPE_NUM, and comm_point::type.
Referenced by worker_handle_request().
void server_stats_insrcode | ( | struct server_stats * | stats, |
ldns_buffer * | buf | ||
) |
Add rcode for this query.
stats,: | the stats |
buf,: | buffer with rcode. If buffer is length0: not counted. |
References server_stats::ans_rcode, server_stats::ans_rcode_nodata, and server_stats::extended.
Referenced by answer_from_cache(), answer_norec_from_cache(), and worker_handle_request().