BIND 10 trac2156, updated. 7859689ac9889fc91b860cde438c2d5c432aa27a [2156] added ioservice counters to auth serveR

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Apr 11 12:24:04 UTC 2013


The branch, trac2156 has been updated
       via  7859689ac9889fc91b860cde438c2d5c432aa27a (commit)
      from  db98c53c020d3e3378c0e88e588aa5b2bb541796 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7859689ac9889fc91b860cde438c2d5c432aa27a
Author: Kazunori Fujiwara <fujiwara at wide.ad.jp>
Date:   Thu Apr 11 12:23:27 2013 +0900

    [2156] added ioservice counters to auth serveR

-----------------------------------------------------------------------

Summary of changes:
 src/bin/auth/auth_srv.cc                      |    2 +-
 src/bin/auth/gen-statisticsitems.py.pre.in    |    9 ++++++---
 src/bin/auth/statistics.cc.pre                |   18 +++++++++++++++---
 src/bin/auth/statistics.h                     |    7 +++++--
 src/bin/auth/statistics_msg_items.def         |   19 +++++++++++++++++++
 src/bin/auth/tests/statistics_unittest.cc.pre |    8 +++++++-
 6 files changed, 53 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc
index 3fe9b9c..4ac1aec 100644
--- a/src/bin/auth/auth_srv.cc
+++ b/src/bin/auth/auth_srv.cc
@@ -317,7 +317,7 @@ AuthSrvImpl::AuthSrvImpl(AbstractXfroutClient& xfrout_client,
                          BaseSocketSessionForwarder& ddns_forwarder) :
     config_session_(NULL),
     xfrin_session_(NULL),
-    counters_(),
+    counters_(io_service_),
     keyring_(NULL),
     ddns_base_forwarder_(ddns_forwarder),
     ddns_forwarder_(NULL),
diff --git a/src/bin/auth/gen-statisticsitems.py.pre.in b/src/bin/auth/gen-statisticsitems.py.pre.in
index ca5e013..1ff80bf 100755
--- a/src/bin/auth/gen-statisticsitems.py.pre.in
+++ b/src/bin/auth/gen-statisticsitems.py.pre.in
@@ -309,9 +309,12 @@ def generate_cxx(itemsfile, ccfile, utfile, def_mtime):
         for item in items:
             item_spec = '    { "' + item['name'] + '", '
             if item['child'] is None:
-                item_spec += 'NULL, ' + item['index']
-                msg_counter_types.append('    ' + item['index'] + ',    ' +
-                                         '///< ' + item['description'])
+                if (item['index'])[0:1] == '*':
+                    item_spec += 'NULL, !!' + (item['index'])[1:]
+                else:
+                    item_spec += 'NULL, !!!' + item['index']
+                    msg_counter_types.append('    ' + item['index'] + ',    ' +
+                                             '///< ' + item['description'])
             else:
                 item_spec += item['index'] + ', NOT_ITEM'
                 child_head = 'const struct CounterSpec ' + \
diff --git a/src/bin/auth/statistics.cc.pre b/src/bin/auth/statistics.cc.pre
index 21141b0..882a8f2 100644
--- a/src/bin/auth/statistics.cc.pre
+++ b/src/bin/auth/statistics.cc.pre
@@ -18,6 +18,9 @@
 
 #include <cc/data.h>
 
+#include <asiolink/io_service.h>
+#include <asiolink/io_service_counter.h>
+
 #include <dns/message.h>
 #include <dns/opcode.h>
 #include <dns/rcode.h>
@@ -30,6 +33,7 @@ using namespace isc::dns;
 using namespace isc::auth;
 using namespace isc::statistics;
 using namespace isc::auth::statistics;
+using namespace isc::asiolink;
 
 namespace {
 
@@ -113,8 +117,9 @@ const int rcode_to_msgcounter[] = {
 const size_t num_rcode_to_msgcounter =
     sizeof(rcode_to_msgcounter) / sizeof(rcode_to_msgcounter[0]);
 
-Counters::Counters() :
-    server_msg_counter_(MSG_COUNTER_TYPES)
+Counters::Counters(asiolink::IOService& io_service) :
+    server_msg_counter_(MSG_COUNTER_TYPES),
+    io_service_(io_service)
 {}
 
 void
@@ -266,9 +271,16 @@ Counters::get() const {
     item_tree->set("zones", zones);
 
     isc::data::ElementPtr server = Element::createMap();
-    fillNodes(server_msg_counter_, msg_counter_tree, server);
     zones->set("_SERVER_", server);
 
+    isc::data::ElementPtr dns = Element::createMap();
+    fillNodes(server_msg_counter_, statistics_dns, dns);
+    server->set("dns", dns);
+
+    isc::data::ElementPtr ioservice = Element::createMap();
+    fillNodes(io_service_.ioservice_counter_, statistics_ioservice, ioservice);
+    server->set("ioservice", dns);
+
     return (item_tree);
 }
 
diff --git a/src/bin/auth/statistics.h b/src/bin/auth/statistics.h
index 52f9bad..c5af54a 100644
--- a/src/bin/auth/statistics.h
+++ b/src/bin/auth/statistics.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
+
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -22,6 +22,8 @@
 
 #include <statistics/counter.h>
 
+#include <asiolink/io_service.h>
+
 #include <boost/noncopyable.hpp>
 #include <boost/optional.hpp>
 
@@ -257,6 +259,7 @@ class Counters : boost::noncopyable {
 private:
     // counter for DNS message attributes
     isc::statistics::Counter server_msg_counter_;
+    isc::asiolink::IOService& io_service_;
     void incRequest(const MessageAttributes& msgattrs);
     void incResponse(const MessageAttributes& msgattrs,
                      const isc::dns::Message& response);
@@ -279,7 +282,7 @@ public:
     ///
     /// This constructor is mostly exception free. But it may still throw
     /// a standard exception if memory allocation fails inside the method.
-    Counters();
+    Counters(asiolink::IOService& io_service);
 
     /// \brief Increment counters according to the parameters.
     ///
diff --git a/src/bin/auth/statistics_msg_items.def b/src/bin/auth/statistics_msg_items.def
index d8d3597..dae98cf 100644
--- a/src/bin/auth/statistics_msg_items.def
+++ b/src/bin/auth/statistics_msg_items.def
@@ -1,3 +1,4 @@
+dns	statistics_dns	DNS statistics	=
 request	msg_counter_request		Request statistics	=
 	v4		MSG_REQUEST_IPV4	Number of IPv4 requests received by the b10-auth server.
 	v6		MSG_REQUEST_IPV6	Number of IPv6 requests received by the b10-auth server.
@@ -46,3 +47,21 @@ rcode		msg_counter_rcode	Rcode statistics	=
 	badvers		MSG_RCODE_BADVERS	Number of requests received by the b10-auth server resulted in RCODE = 16 (BADVERS).
 	other		MSG_RCODE_OTHER		Number of requests received by the b10-auth server resulted in other RCODEs.
 	;
+;
+ioservice	statistics_ioservice	IOService statistics	=
+fd_add_tcp	*IOSERVICE_FD_ADD_TCP	Number of adding a new TCP server
+fd_add_udp	*IOSERVICE_FD_ADD_UDP	Number of adding a new UDP server
+fetch_completed	*IOSERVICE_FETCH_COMPLETED	Number of upstream fetch has now completed
+fetch_stopped	*IOSERVICE_FETCH_STOPPED	Number of upstream fetch has been stopped
+socket_open_error	*IOSERVICE_SOCKET_OPEN_ERROR	Number of errors opening socket
+read_data_error	*IOSERVICE_READ_DATA_ERROR	Number of errors reading data
+read_timeout	*IOSERVICE_READ_TIMEOUT	Number of receive timeouts
+send_data_error	*IOSERVICE_SEND_DATA_ERROR	Number of erroes sending data
+unknown_origin	*IOSERVICE_UNKNOWN_ORIGIN	Number of unknown origin errors for ASIO
+unknown_result	*IOSERVICE_UNKNOWN_RESULT	Number of unknown results
+ipv4_tcp_accept	*IOSERVICE_IPV4_TCP_ACCEPT	Number of IPv4 TCP accepts
+ipv6_tcp_accept	*IOSERVICE_IPV6_TCP_ACCEPT	Number of IPv6 TCP accepts
+ipv4_tcp_acceptfail	*IOSERVICE_IPV4_TCP_ACCEPTFAIL	Number of IPv4 TCP acceptfails
+ipv6_tcp_acceptfail	*IOSERVICE_IPV6_TCP_ACCEPTFAIL	Number of IPv6 TCP acceptfails
+tcp_open	*IOSERVICE_TCP_OPEN	Number of TCP opens
+;
diff --git a/src/bin/auth/tests/statistics_unittest.cc.pre b/src/bin/auth/tests/statistics_unittest.cc.pre
index cf6f29a..d22fb04 100644
--- a/src/bin/auth/tests/statistics_unittest.cc.pre
+++ b/src/bin/auth/tests/statistics_unittest.cc.pre
@@ -24,6 +24,9 @@
 
 #include <cc/data.h>
 
+#include <asiolink/io_service.h>
+#include <asiolink/io_service_counter.h>
+
 #include <auth/statistics.h>
 #include <auth/statistics_items.h>
 
@@ -42,14 +45,17 @@ using namespace isc::dns;
 using namespace isc::data;
 using namespace isc::auth::statistics;
 using namespace isc::auth::unittest;
+using namespace isc::asiolink;
 
 namespace {
 
 // ### STATISTICS ITEMS DEFINITION ###
 
+class IOService io_service_;
+
 class CountersTest : public ::testing::Test {
 protected:
-    CountersTest() : counters() {}
+    CountersTest() : counters(io_service_) {}
     ~CountersTest() {}
     Counters counters;
 };



More information about the bind10-changes mailing list