Commit d9059b0c authored by Tatuya JINMEI 神明達哉's avatar Tatuya JINMEI 神明達哉
Browse files

2537. [func] Added more statistics counters including those on socket

			I/O events and query RTT histograms.  [RT #18802]
parent 3bed8e99
2537. [func] Added more statistics counters including those on socket
I/O events and query RTT histograms. [RT #18802]
2536. [cleanup] Silence some warnings when -Werror=format-security is
specified. [RT #19083]
......
......@@ -15,7 +15,7 @@
- PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: bind9.xsl,v 1.19 2008/07/17 23:43:26 jinmei Exp $ -->
<!-- $Id: bind9.xsl,v 1.20 2009/01/27 22:29:58 jinmei Exp $ -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
......@@ -248,6 +248,17 @@ div.statcounter br {
<br/>
</xsl:for-each>
<div class="statcounter">
<h2>Socket I/O Statistics</h2>
<xsl:for-each select="server/sockstat">
<dl>
<dt><xsl:value-of select="name"/></dt>
<dd><xsl:value-of select="counter"/></dd>
</dl>
</xsl:for-each>
<br/>
</div>
<br/>
<xsl:for-each select="views/view">
......
/*
* Generated by convertxsl.pl 1.14 2008/07/17 23:43:26 jinmei Exp
* From bind9.xsl 1.19 2008/07/17 23:43:26 jinmei Exp
* From bind9.xsl 1.19.50.1 2008/10/30 05:56:18 jinmei Exp
*/
static char xslmsg[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
......@@ -20,7 +20,7 @@ static char xslmsg[] =
" - PERFORMANCE OF THIS SOFTWARE.\n"
"-->\n"
"\n"
"<!-- \045Id: bind9.xsl,v 1.19 2008/07/17 23:43:26 jinmei Exp \045 -->\n"
"<!-- \045Id: bind9.xsl,v 1.19.50.1 2008/10/30 05:56:18 jinmei Exp \045 -->\n"
"\n"
"<xsl:stylesheet version=\"1.0\"\n"
" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n"
......@@ -253,6 +253,17 @@ static char xslmsg[] =
" <br/>\n"
" </xsl:for-each>\n"
"\n"
" <div class=\"statcounter\">\n"
" <h2>Socket I/O Statistics</h2>\n"
" <xsl:for-each select=\"server/sockstat\">\n"
" <dl>\n"
" <dt><xsl:value-of select=\"name\"/></dt>\n"
" <dd><xsl:value-of select=\"counter\"/></dd>\n"
" </dl>\n"
" </xsl:for-each>\n"
" <br/>\n"
" </div>\n"
"\n"
" <br/>\n"
"\n"
" <xsl:for-each select=\"views/view\">\n"
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: client.c,v 1.261 2009/01/17 23:47:42 tbox Exp $ */
/* $Id: client.c,v 1.262 2009/01/27 22:29:58 jinmei Exp $ */
#include <config.h>
......@@ -24,6 +24,7 @@
#include <isc/once.h>
#include <isc/platform.h>
#include <isc/print.h>
#include <isc/stats.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
......@@ -1018,23 +1019,22 @@ ns_client_send(ns_client_t *client) {
result = client_sendpkg(client, &buffer);
/* update statistics (XXXJT: is it okay to access message->xxxkey?) */
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_response);
isc_stats_increment(ns_g_server->nsstats, dns_nsstatscounter_response);
if (opt_included) {
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_edns0out);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_edns0out);
}
if (client->message->tsigkey != NULL) {
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_tsigout);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_tsigout);
}
if (client->message->sig0key != NULL) {
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_sig0out);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_sig0out);
}
if ((client->message->flags & DNS_MESSAGEFLAG_TC) != 0)
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_truncatedresp);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_truncatedresp);
if (result == ISC_R_SUCCESS)
return;
......@@ -1514,15 +1514,15 @@ client_request(isc_task_t *task, isc_event_t *event) {
* Update some statistics counters. Don't count responses.
*/
if (isc_sockaddr_pf(&client->peeraddr) == PF_INET) {
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_requestv4);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_requestv4);
} else {
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_requestv6);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_requestv6);
}
if (TCP_CLIENT(client))
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_tcp);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_tcp);
/*
* It's a request. Parse it.
......@@ -1586,8 +1586,8 @@ client_request(isc_task_t *task, isc_event_t *event) {
*/
client->ednsversion = (opt->ttl & 0x00FF0000) >> 16;
if (client->ednsversion > 0) {
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_badednsver);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_badednsver);
result = client_addopt(client);
if (result == ISC_R_SUCCESS)
result = DNS_R_BADVERS;
......@@ -1612,8 +1612,8 @@ client_request(isc_task_t *task, isc_event_t *event) {
}
}
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_edns0in);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_edns0in);
/*
* Create an OPT for our reply.
......@@ -1762,11 +1762,11 @@ client_request(isc_task_t *task, isc_event_t *event) {
if (result != ISC_R_NOTFOUND) {
signame = NULL;
if (dns_message_gettsig(client->message, &signame) != NULL) {
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_tsigin);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_tsigin);
} else {
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_sig0in);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_sig0in);
}
}
......@@ -1790,8 +1790,8 @@ client_request(isc_task_t *task, isc_event_t *event) {
isc_result_t tresult;
/* There is a signature, but it is bad. */
dns_generalstats_increment(ns_g_server->nsstats,
dns_nsstatscounter_invalidsig);
isc_stats_increment(ns_g_server->nsstats,
dns_nsstatscounter_invalidsig);
signame = NULL;
if (dns_message_gettsig(client->message, &signame) != NULL) {
char namebuf[DNS_NAME_FORMATSIZE];
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.h,v 1.95 2009/01/09 23:47:45 tbox Exp $ */
/* $Id: server.h,v 1.96 2009/01/27 22:29:58 jinmei Exp $ */
#ifndef NAMED_SERVER_H
#define NAMED_SERVER_H 1
......@@ -92,11 +92,12 @@ struct ns_server {
isc_boolean_t log_queries; /*%< For BIND 8 compatibility */
ns_cachelist_t cachelist; /*%< Possibly shared caches */
dns_stats_t * nsstats; /*%< Server statistics */
dns_stats_t * rcvquerystats; /*% Incoming query statistics */
dns_stats_t * opcodestats; /*%< Incoming message statistics */
dns_stats_t * zonestats; /*% Zone management statistics */
dns_stats_t * resolverstats; /*% Resolver statistics */
isc_stats_t * nsstats; /*%< Server stats */
dns_stats_t * rcvquerystats; /*% Incoming query stats */
dns_stats_t * opcodestats; /*%< Incoming message stats */
isc_stats_t * zonestats; /*% Zone management stats */
isc_stats_t * resolverstats; /*% Resolver stats */
isc_stats_t * sockstats; /*%< Socket stats */
ns_controls_t * controls; /*%< Control channels */
unsigned int dispatchgen;
......@@ -111,7 +112,7 @@ struct ns_server {
#define NS_SERVER_VALID(s) ISC_MAGIC_VALID(s, NS_SERVER_MAGIC)
/*%
* Server statistics counters. Used as dns_statscounter_t values.
* Server statistics counters. Used as isc_statscounter_t values.
*/
enum {
dns_nsstatscounter_requestv4 = 0,
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: query.c,v 1.318 2009/01/17 11:20:13 fdupont Exp $ */
/* $Id: query.c,v 1.319 2009/01/27 22:29:58 jinmei Exp $ */
/*! \file */
......@@ -23,9 +23,10 @@
#include <string.h>
#include <isc/hex.h>
#include <isc/mem.h>
#include <isc/stats.h>
#include <isc/util.h>
#include <isc/hex.h>
#include <dns/adb.h>
#include <dns/byaddr.h>
......@@ -141,21 +142,21 @@ log_queryerror(ns_client_t *client, isc_result_t result, int line, int level);
* Increment query statistics counters.
*/
static inline void
inc_stats(ns_client_t *client, dns_statscounter_t counter) {
inc_stats(ns_client_t *client, isc_statscounter_t counter) {
dns_zone_t *zone = client->query.authzone;
dns_generalstats_increment(ns_g_server->nsstats, counter);
isc_stats_increment(ns_g_server->nsstats, counter);
if (zone != NULL) {
dns_stats_t *zonestats = dns_zone_getrequeststats(zone);
isc_stats_t *zonestats = dns_zone_getrequeststats(zone);
if (zonestats != NULL)
dns_generalstats_increment(zonestats, counter);
isc_stats_increment(zonestats, counter);
}
}
static void
query_send(ns_client_t *client) {
dns_statscounter_t counter;
isc_statscounter_t counter;
if ((client->message->flags & DNS_MESSAGEFLAG_AA) == 0)
inc_stats(client, dns_nsstatscounter_nonauthans);
else
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.525 2009/01/17 11:22:01 fdupont Exp $ */
/* $Id: server.c,v 1.526 2009/01/27 22:29:58 jinmei Exp $ */
/*! \file */
......@@ -37,6 +37,7 @@
#include <isc/print.h>
#include <isc/resource.h>
#include <isc/socket.h>
#include <isc/stats.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
......@@ -973,18 +974,18 @@ check_dbtype(dns_zone_t **zonep, unsigned int dbtypec, const char **dbargv,
static isc_result_t
setquerystats(dns_zone_t *zone, isc_mem_t *mctx, isc_boolean_t on) {
isc_result_t result;
dns_stats_t *zoneqrystats;
isc_stats_t *zoneqrystats;
zoneqrystats = NULL;
if (on) {
result = dns_generalstats_create(mctx, &zoneqrystats,
dns_nsstatscounter_max);
result = isc_stats_create(mctx, &zoneqrystats,
dns_nsstatscounter_max);
if (result != ISC_R_SUCCESS)
return (result);
}
dns_zone_setrequeststats(zone, zoneqrystats);
if (zoneqrystats != NULL)
dns_stats_detach(&zoneqrystats);
isc_stats_detach(&zoneqrystats);
return (ISC_R_SUCCESS);
}
......@@ -1104,7 +1105,7 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
isc_boolean_t rfc1918;
isc_boolean_t empty_zones_enable;
const cfg_obj_t *disablelist = NULL;
dns_stats_t *resstats = NULL;
isc_stats_t *resstats = NULL;
dns_stats_t *resquerystats = NULL;
ns_cache_t *nsc;
isc_boolean_t zero_no_soattl;
......@@ -1473,8 +1474,8 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
dispatch4, dispatch6));
if (resstats == NULL) {
CHECK(dns_generalstats_create(mctx, &resstats,
dns_resstatscounter_max));
CHECK(isc_stats_create(mctx, &resstats,
dns_resstatscounter_max));
}
dns_view_setresstats(view, resstats);
if (resquerystats == NULL)
......@@ -2139,7 +2140,7 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
if (dispatch6 != NULL)
dns_dispatch_detach(&dispatch6);
if (resstats != NULL)
dns_stats_detach(&resstats);
isc_stats_detach(&resstats);
if (resquerystats != NULL)
dns_stats_detach(&resquerystats);
if (order != NULL)
......@@ -4098,6 +4099,11 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
server->opcodestats = NULL;
server->zonestats = NULL;
server->resolverstats = NULL;
server->sockstats = NULL;
CHECKFATAL(isc_stats_create(server->mctx, &server->sockstats,
isc_sockstatscounter_max),
"isc_stats_create");
isc_socketmgr_setstats(ns_g_socketmgr, server->sockstats);
server->dumpfile = isc_mem_strdup(server->mctx, "named_dump.db");
CHECKFATAL(server->dumpfile == NULL ? ISC_R_NOMEMORY : ISC_R_SUCCESS,
......@@ -4114,8 +4120,8 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
server->server_usehostname = ISC_FALSE;
server->server_id = NULL;
CHECKFATAL(dns_generalstats_create(ns_g_mctx, &server->nsstats,
dns_nsstatscounter_max),
CHECKFATAL(isc_stats_create(ns_g_mctx, &server->nsstats,
dns_nsstatscounter_max),
"dns_stats_create (server)");
CHECKFATAL(dns_rdatatypestats_create(ns_g_mctx,
......@@ -4125,12 +4131,12 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
CHECKFATAL(dns_opcodestats_create(ns_g_mctx, &server->opcodestats),
"dns_stats_create (opcode)");
CHECKFATAL(dns_generalstats_create(ns_g_mctx, &server->zonestats,
dns_zonestatscounter_max),
CHECKFATAL(isc_stats_create(ns_g_mctx, &server->zonestats,
dns_zonestatscounter_max),
"dns_stats_create (zone)");
CHECKFATAL(dns_generalstats_create(ns_g_mctx, &server->resolverstats,
dns_resstatscounter_max),
CHECKFATAL(isc_stats_create(ns_g_mctx, &server->resolverstats,
dns_resstatscounter_max),
"dns_stats_create (resolver)");
server->flushonshutdown = ISC_FALSE;
......@@ -4157,11 +4163,12 @@ ns_server_destroy(ns_server_t **serverp) {
ns_controls_destroy(&server->controls);
dns_stats_detach(&server->nsstats);
isc_stats_detach(&server->nsstats);
dns_stats_detach(&server->rcvquerystats);
dns_stats_detach(&server->opcodestats);
dns_stats_detach(&server->zonestats);
dns_stats_detach(&server->resolverstats);
isc_stats_detach(&server->zonestats);
isc_stats_detach(&server->resolverstats);
isc_stats_detach(&server->sockstats);
isc_mem_free(server->mctx, server->statsfile);
isc_mem_free(server->mctx, server->dumpfile);
......
This diff is collapsed.
......@@ -15,13 +15,14 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: update.c,v 1.154 2009/01/20 01:40:04 marka Exp $ */
/* $Id: update.c,v 1.155 2009/01/27 22:29:58 jinmei Exp $ */
#include <config.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/serial.h>
#include <isc/stats.h>
#include <isc/string.h>
#include <isc/taskpool.h>
#include <isc/util.h>
......@@ -44,7 +45,6 @@
#include <dns/rdatatype.h>
#include <dns/soa.h>
#include <dns/ssu.h>
#include <dns/stats.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/zt.h>
......@@ -270,13 +270,13 @@ update_log(ns_client_t *client, dns_zone_t *zone,
* Increment updated-related statistics counters.
*/
static inline void
inc_stats(dns_zone_t *zone, dns_statscounter_t counter) {
dns_generalstats_increment(ns_g_server->nsstats, counter);
inc_stats(dns_zone_t *zone, isc_statscounter_t counter) {
isc_stats_increment(ns_g_server->nsstats, counter);
if (zone != NULL) {
dns_stats_t *zonestats = dns_zone_getrequeststats(zone);
isc_stats_t *zonestats = dns_zone_getrequeststats(zone);
if (zonestats != NULL)
dns_generalstats_increment(zonestats, counter);
isc_stats_increment(zonestats, counter);
}
}
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: xfrout.c,v 1.134 2009/01/17 11:35:11 fdupont Exp $ */
/* $Id: xfrout.c,v 1.135 2009/01/27 22:29:58 jinmei Exp $ */
#include <config.h>
......@@ -23,6 +23,7 @@
#include <isc/mem.h>
#include <isc/timer.h>
#include <isc/print.h>
#include <isc/stats.h>
#include <isc/util.h>
#include <dns/db.h>
......@@ -150,12 +151,12 @@ static void
db_rr_iterator_destroy(db_rr_iterator_t *it);
static inline void
inc_stats(dns_zone_t *zone, dns_statscounter_t counter) {
dns_generalstats_increment(ns_g_server->nsstats, counter);
inc_stats(dns_zone_t *zone, isc_statscounter_t counter) {
isc_stats_increment(ns_g_server->nsstats, counter);
if (zone != NULL) {
dns_stats_t *zonestats = dns_zone_getrequeststats(zone);
isc_stats_t *zonestats = dns_zone_getrequeststats(zone);
if (zonestats != NULL)
dns_generalstats_increment(zonestats, counter);
isc_stats_increment(zonestats, counter);
}
}
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.147 2008/09/24 02:46:21 marka Exp $ */
/* $Id: zoneconf.c,v 1.148 2009/01/27 22:29:58 jinmei Exp $ */
/*% */
......@@ -25,6 +25,7 @@
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/stats.h>
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <isc/util.h>
......@@ -431,7 +432,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
isc_boolean_t warn = ISC_FALSE, ignore = ISC_FALSE;
isc_boolean_t ixfrdiff;
dns_masterformat_t masterformat;
dns_stats_t *zoneqrystats;
isc_stats_t *zoneqrystats;
isc_boolean_t zonestats_on;
int seconds;
......@@ -564,12 +565,12 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
zonestats_on = cfg_obj_asboolean(obj);
zoneqrystats = NULL;
if (zonestats_on) {
RETERR(dns_generalstats_create(mctx, &zoneqrystats,
dns_nsstatscounter_max));
RETERR(isc_stats_create(mctx, &zoneqrystats,
dns_nsstatscounter_max));
}
dns_zone_setrequeststats(zone, zoneqrystats);
if (zoneqrystats != NULL)
dns_stats_detach(&zoneqrystats);
isc_stats_detach(&zoneqrystats);
/*
* Configure master functionality. This applies
......
......@@ -18,7 +18,7 @@
- PERFORMANCE OF THIS SOFTWARE.
-->
 
<!-- File: $Id: Bv9ARM-book.xml,v 1.388 2009/01/20 20:06:29 jreed Exp $ -->
<!-- File: $Id: Bv9ARM-book.xml,v 1.389 2009/01/27 22:29:58 jinmei Exp $ -->
<book xmlns:xi="http://www.w3.org/2001/XInclude">
<title>BIND 9 Administrator Reference Manual</title>
 
......@@ -11707,6 +11707,17 @@ HOST-127.EXAMPLE. MX 0 .
</entry>
</row>
 
<row rowsep="0">
<entry colname="1">
<para>Socket I/O Statistics</para>
</entry>
<entry colname="2">
<para>
Statistics counters about network related events.
</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
......@@ -12516,7 +12527,6 @@ HOST-127.EXAMPLE. MX 0 .
</entry>
</row>
 
<row rowsep="0">
<entry colname="1">
<para><command>Queryv4</command></para>
......@@ -12686,6 +12696,48 @@ HOST-127.EXAMPLE. MX 0 .
</para>
</entry>
</row>
<row rowsep="0">
<entry colname="1">
<para><command>QueryAbort</command></para>
</entry>
<entry colname="2">
<para><command></command></para>
</entry>
<entry colname="3">
<para>
Queries aborted due to quota control.
</para>
</entry>
</row>
<row rowsep="0">
<entry colname="1">
<para><command>QuerySockFail</command></para>
</entry>
<entry colname="2">
<para><command></command></para>
</entry>
<entry colname="3">
<para>
Failures in opening query sockets.
One common reason for such failures is a
failure of opening a new socket due to a
limitation on file descriptors.
</para>
</entry>
</row>
<row rowsep="0">
<entry colname="1">
<para><command>QueryTimeout</command></para>
</entry>
<entry colname="2">
<para><command></command></para>
</entry>
<entry colname="3">
<para>
Query timeouts.
</para>
</entry>
</row>
<row rowsep="0">
<entry colname="1">
<para><command>GlueFetchv4</command></para>
......@@ -12790,13 +12842,200 @@ HOST-127.EXAMPLE. MX 0 .
</para>
</entry>
</row>
<row rowsep="0">
<entry colname="1">
<para><command>QryRTTnn</command></para>
</entry>
<entry colname="2">
<para><command></command></para>
</entry>
<entry colname="3">
<para>
Frequency table on round trip times (RTTs) of
queries.
Each <command>nn</command> specifies the corresponding
frequency.
In the sequence of
<command>nn_1</command>,
<command>nn_2</command>,
...,
<command>nn_m</command>,
the value of <command>nn_i</command> is the
number of queries whose RTTs are between
<command>nn_(i-1)</command> (inclusive) and
<command>nn_i</command> (exclusive) milliseconds.
For the sake of convenience we define
<command>nn_0</command> to be 0.
The last entry should be represented as
<command>nn_m+</command>, which means the
number of queries whose RTTs are equal to or over
<command>nn_m</command> milliseconds.
</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
 
</sect3>