stats.h File Reference

This file describes the data structure used to collect runtime performance numbers. More...

#include "util/timehist.h"

Data Structures

struct  server_stats
 per worker statistics More...
struct  stats_info
 Statistics to send over the control pipe when asked This struct is made to be memcpied, sent in binary. More...

Defines

#define STATS_QTYPE_NUM   256
 number of qtype that is stored for in array
#define STATS_QCLASS_NUM   256
 number of qclass that is stored for in array
#define STATS_RCODE_NUM   16
 number of rcodes in stats
#define STATS_OPCODE_NUM   16
 number of opcodes in stats

Functions

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
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_compile (struct worker *worker, struct stats_info *s, int reset)
 Compile stats into structure for this thread worker.
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.

Detailed Description

This file describes the data structure used to collect runtime performance numbers.

These 'statistics' may be of interest to the operator.


Function Documentation

void server_stats_init ( struct server_stats stats,
struct config_file cfg 
)

Initialize server stats to 0.

Parameters:
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_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.

Parameters:
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_compile ( struct worker worker,
struct stats_info s,
int  reset 
)
void server_stats_reply ( struct worker worker,
int  reset 
)

Send stats over comm tube in reply to query cmd.

Parameters:
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.

Referenced by worker_handle_control_cmd().

void server_stats_add ( struct stats_info total,
struct stats_info a 
)
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 
)
void server_stats_insrcode ( struct server_stats stats,
ldns_buffer *  buf 
)

Add rcode for this query.

Parameters:
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().

Generated on Thu Apr 22 00:27:06 2010 for unbound by  doxygen 1.6.3