BIND 10 trac2156, updated. db98c53c020d3e3378c0e88e588aa5b2bb541796 [2156] fixed editing src/lib/python/isc/acl/Makefile.am

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Apr 10 12:30:30 UTC 2013


The branch, trac2156 has been updated
       via  db98c53c020d3e3378c0e88e588aa5b2bb541796 (commit)
       via  12a4ca01e86575d068904dec9d29ffa8caf8d6fa (commit)
      from  26fd0e62aea9a077c5614a1f4950adca7c41db85 (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 db98c53c020d3e3378c0e88e588aa5b2bb541796
Author: Kazunori Fujiwara <fujiwara at wide.ad.jp>
Date:   Wed Apr 10 12:29:39 2013 +0900

    [2156] fixed editing src/lib/python/isc/acl/Makefile.am

commit 12a4ca01e86575d068904dec9d29ffa8caf8d6fa
Author: Kazunori Fujiwara <fujiwara at wide.ad.jp>
Date:   Wed Apr 10 12:20:06 2013 +0900

    [2156] Added example IOService counters

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

Summary of changes:
 src/lib/asiodns/io_fetch.cc           |   17 +++++++++++
 src/lib/asiodns/sync_udp_server.cc    |    2 ++
 src/lib/asiodns/tcp_server.cc         |    5 +++
 src/lib/asiodns/tcp_server.h          |    1 -
 src/lib/asiodns/udp_server.cc         |    2 ++
 src/lib/asiolink/asiolink.h           |    1 +
 src/lib/asiolink/io_service.cc        |   10 ++++--
 src/lib/asiolink/io_service.h         |    4 +++
 src/lib/asiolink/io_service_counter.h |   54 +++++++++++++++++++++++++++++++++
 src/lib/python/isc/acl/Makefile.am    |    2 +-
 10 files changed, 94 insertions(+), 4 deletions(-)
 create mode 100644 src/lib/asiolink/io_service_counter.h

-----------------------------------------------------------------------
diff --git a/src/lib/asiodns/io_fetch.cc b/src/lib/asiodns/io_fetch.cc
index eed5fdf..e148a46 100644
--- a/src/lib/asiodns/io_fetch.cc
+++ b/src/lib/asiodns/io_fetch.cc
@@ -30,6 +30,7 @@
 #include <asiolink/io_asio_socket.h>
 #include <asiolink/io_endpoint.h>
 #include <asiolink/io_service.h>
+#include <asiolink/io_service_counter.h>
 #include <asiolink/tcp_endpoint.h>
 #include <asiolink/tcp_socket.h>
 #include <asiolink/udp_endpoint.h>
@@ -76,6 +77,7 @@ struct IOFetchData {
     // actually instantiated depends on whether the fetch is over UDP or TCP,
     // which is not known until construction of the IOFetch.  Use of a shared
     // pointer here is merely to ensure deletion when the data object is deleted.
+    asiolink::IOService&        ioservice_;
     boost::scoped_ptr<IOAsioSocket<IOFetch> > socket;
                                              ///< Socket to use for I/O
     boost::scoped_ptr<IOEndpoint> remote_snd;///< Where the fetch is sent
@@ -123,6 +125,7 @@ struct IOFetchData {
         const IOAddress& address, uint16_t port, OutputBufferPtr& buff,
         IOFetch::Callback* cb, int wait)
         :
+        ioservice_(service),
         socket((proto == IOFetch::UDP) ?
             static_cast<IOAsioSocket<IOFetch>*>(
                 new UDPSocket<IOFetch>(service)) :
@@ -280,6 +283,7 @@ IOFetch::operator()(asio::error_code ec, size_t length) {
         data_->origin = ASIODNS_OPEN_SOCKET;
         if (data_->socket->isOpenSynchronous()) {
             data_->socket->open(data_->remote_snd.get(), *this);
+            data_->ioservice_.ioservice_counter_.inc(IOSERVICE_TCP_OPEN);
         } else {
             CORO_YIELD data_->socket->open(data_->remote_snd.get(), *this);
         }
@@ -360,12 +364,14 @@ IOFetch::stop(Result result) {
         data_->stopped = true;
         switch (result) {
             case TIME_OUT:
+                data_->ioservice_.ioservice_counter_.inc(IOSERVICE_READ_TIMEOUT);
                 LOG_DEBUG(logger, DBG_COMMON, ASIODNS_READ_TIMEOUT).
                     arg(data_->remote_snd->getAddress().toText()).
                     arg(data_->remote_snd->getPort());
                 break;
 
             case SUCCESS:
+                data_->ioservice_.ioservice_counter_.inc(IOSERVICE_FETCH_COMPLETED);
                 LOG_DEBUG(logger, DBG_ALL, ASIODNS_FETCH_COMPLETED).
                     arg(data_->remote_rcv->getAddress().toText()).
                     arg(data_->remote_rcv->getPort());
@@ -375,12 +381,14 @@ IOFetch::stop(Result result) {
                 // Fetch has been stopped for some other reason.  This is
                 // allowed but as it is unusual it is logged, but with a lower
                 // debug level than a timeout (which is totally normal).
+                data_->ioservice_.ioservice_counter_.inc(IOSERVICE_FETCH_STOPPED);
                 LOG_DEBUG(logger, DBG_IMPORTANT, ASIODNS_FETCH_STOPPED).
                     arg(data_->remote_snd->getAddress().toText()).
                     arg(data_->remote_snd->getPort());
                 break;
 
             default:
+                data_->ioservice_.ioservice_counter_.inc(IOSERVICE_UNKNOWN_RESULT);
                 LOG_ERROR(logger, ASIODNS_UNKNOWN_RESULT).
                     arg(data_->remote_snd->getAddress().toText()).
                     arg(data_->remote_snd->getPort());
@@ -410,6 +418,15 @@ void IOFetch::logIOFailure(asio::error_code ec) {
            (data_->origin == ASIODNS_READ_DATA) ||
            (data_->origin == ASIODNS_UNKNOWN_ORIGIN));
 
+    if (data_->origin == ASIODNS_OPEN_SOCKET) {
+        data_->ioservice_.ioservice_counter_.inc(IOSERVICE_SOCKET_OPEN_ERROR);
+    } else if (data_->origin == ASIODNS_SEND_DATA) {
+        data_->ioservice_.ioservice_counter_.inc(IOSERVICE_SEND_DATA_ERROR);
+    } else if (data_->origin == ASIODNS_READ_DATA) {
+        data_->ioservice_.ioservice_counter_.inc(IOSERVICE_READ_DATA_ERROR);
+    } else if (data_->origin == ASIODNS_UNKNOWN_ORIGIN) {
+        data_->ioservice_.ioservice_counter_.inc(IOSERVICE_UNKNOWN_ORIGIN);
+    } 
     static const char* PROTOCOL[2] = {"TCP", "UDP"};
     LOG_ERROR(logger, data_->origin).arg(ec.value()).
         arg((data_->remote_snd->getProtocol() == IPPROTO_TCP) ?
diff --git a/src/lib/asiodns/sync_udp_server.cc b/src/lib/asiodns/sync_udp_server.cc
index 76cf11e..45366e5 100644
--- a/src/lib/asiodns/sync_udp_server.cc
+++ b/src/lib/asiodns/sync_udp_server.cc
@@ -23,6 +23,7 @@
 #include <asiolink/dummy_io_cb.h>
 #include <asiolink/udp_endpoint.h>
 #include <asiolink/udp_socket.h>
+#include <asiolink/io_service_counter.h>
 
 #include <boost/bind.hpp>
 
@@ -52,6 +53,7 @@ SyncUDPServer::SyncUDPServer(IOService& io_service, const int fd,
         isc_throw(InvalidParameter, "Address family must be either AF_INET "
                   "or AF_INET6, not " << af);
     }
+    io_service.ioservice_counter_.inc(IOSERVICE_FD_ADD_UDP);
     LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, ASIODNS_FD_ADD_UDP).arg(fd);
     try {
         socket_.reset(new asio::ip::udp::socket(io_service.get_io_service()));
diff --git a/src/lib/asiodns/tcp_server.cc b/src/lib/asiodns/tcp_server.cc
index bd25d7b..8f8354f 100644
--- a/src/lib/asiodns/tcp_server.cc
+++ b/src/lib/asiodns/tcp_server.cc
@@ -59,15 +59,20 @@ TCPServer::TCPServer(IOService& io_service, int fd, int af,
         isc_throw(InvalidParameter, "Address family must be either AF_INET "
                   "or AF_INET6, not " << af);
     }
+    io_.ioservice_counter_.inc(IOSERVICE_FD_ADD_TCP);
     LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, ASIODNS_FD_ADD_TCP).arg(fd);
 
     try {
         acceptor_.reset(new tcp::acceptor(io_service.get_io_service()));
         acceptor_->assign(af == AF_INET6 ? tcp::v6() : tcp::v4(), fd);
+        io_.ioservice_counter_.inc(af == AF_INET6 ? IOSERVICE_IPV6_TCP_ACCEPT:
+                                                   IOSERVICE_IPV4_TCP_ACCEPT);
         acceptor_->listen();
     } catch (const std::exception& exception) {
         // Whatever the thing throws, it is something from ASIO and we convert
         // it
+        io_.ioservice_counter_.inc(af==AF_INET6 ? IOSERVICE_IPV6_TCP_ACCEPTFAIL:
+                                                 IOSERVICE_IPV4_TCP_ACCEPTFAIL);
         isc_throw(IOError, exception.what());
     }
     // Set it to some value. It should be set to the right one
diff --git a/src/lib/asiodns/tcp_server.h b/src/lib/asiodns/tcp_server.h
index ad99446..f2faed3 100644
--- a/src/lib/asiodns/tcp_server.h
+++ b/src/lib/asiodns/tcp_server.h
@@ -23,7 +23,6 @@
 #include <boost/shared_ptr.hpp>
 
 #include <asiolink/asiolink.h>
-#include <asiolink/asiolink.h>
 #include <coroutine.h>
 #include "dns_server.h"
 #include "dns_lookup.h"
diff --git a/src/lib/asiodns/udp_server.cc b/src/lib/asiodns/udp_server.cc
index a564be2..980501d 100644
--- a/src/lib/asiodns/udp_server.cc
+++ b/src/lib/asiodns/udp_server.cc
@@ -28,6 +28,7 @@
 #include <asiolink/dummy_io_cb.h>
 #include <asiolink/udp_endpoint.h>
 #include <asiolink/udp_socket.h>
+#include <asiolink/io_service_counter.h>
 #include "udp_server.h"
 #include "logger.h"
 
@@ -86,6 +87,7 @@ struct UDPServer::Data {
                       "or AF_INET6, not " << af);
         }
         LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, ASIODNS_FD_ADD_UDP).arg(fd);
+        io_.ioservice_counter_.inc(IOSERVICE_FD_ADD_UDP);
         try {
             socket_.reset(new udp::socket(io_service.get_io_service()));
             socket_->assign(af == AF_INET6 ? udp::v6() : udp::v4(), fd);
diff --git a/src/lib/asiolink/asiolink.h b/src/lib/asiolink/asiolink.h
index 708f368..64fa1b6 100644
--- a/src/lib/asiolink/asiolink.h
+++ b/src/lib/asiolink/asiolink.h
@@ -20,6 +20,7 @@
 // See the description of the namespace below.
 
 #include <asiolink/io_service.h>
+#include <asiolink/io_service_counter.h>
 #include <asiolink/simple_callback.h>
 #include <asiolink/interval_timer.h>
 
diff --git a/src/lib/asiolink/io_service.cc b/src/lib/asiolink/io_service.cc
index c605043..c4b6c66 100644
--- a/src/lib/asiolink/io_service.cc
+++ b/src/lib/asiolink/io_service.cc
@@ -20,6 +20,8 @@
 
 #include <asio.hpp>
 #include <asiolink/io_service.h>
+#include <asiolink/io_service_counter.h>
+#include <statistics/counter.h>
 
 namespace isc {
 namespace asiolink {
@@ -71,11 +73,15 @@ private:
     asio::io_service::work* work_;
 };
 
-IOService::IOService(bool alwaysBlock) {
+IOService::IOService(bool alwaysBlock):
+ioservice_counter_(IOSERVICE_COUNTER_TYPES)
+{
     io_impl_ = new IOServiceImpl(alwaysBlock);
 }
 
-IOService::IOService() {
+IOService::IOService():
+ioservice_counter_(IOSERVICE_COUNTER_TYPES)
+{
     io_impl_ = new IOServiceImpl(true);
 }
 
diff --git a/src/lib/asiolink/io_service.h b/src/lib/asiolink/io_service.h
index 116d12f..b27337f 100644
--- a/src/lib/asiolink/io_service.h
+++ b/src/lib/asiolink/io_service.h
@@ -15,6 +15,8 @@
 #ifndef ASIOLINK_IO_SERVICE_H
 #define ASIOLINK_IO_SERVICE_H 1
 
+#include <statistics/counter.h>
+
 namespace asio {
     class io_service;
 }
@@ -75,6 +77,8 @@ public:
     /// generalized.
     asio::io_service& get_io_service();
 
+    isc::statistics::Counter ioservice_counter_;
+
 private:
     IOServiceImpl* io_impl_;
 };
diff --git a/src/lib/asiolink/io_service_counter.h b/src/lib/asiolink/io_service_counter.h
new file mode 100644
index 0000000..ba4ebae
--- /dev/null
+++ b/src/lib/asiolink/io_service_counter.h
@@ -0,0 +1,54 @@
+// Copyright (C) 2011  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
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#ifndef __IOSERVICE_COUNTER_H
+#define __IOSERVICE_COUNTER_H 1
+
+#include <string>
+
+namespace isc {
+namespace asiolink {
+
+// enum for IOService Counters
+enum IOServiceCounterType {
+    // IOService Counters
+    IOSERVICE_FD_ADD_TCP,         ///< adding a new TCP server
+    IOSERVICE_FD_ADD_UDP,         ///< adding a new UDP server
+    IOSERVICE_FETCH_COMPLETED,    ///< upstream fetch has now completed
+    IOSERVICE_FETCH_STOPPED,      ///< upstream fetch has been stopped
+    IOSERVICE_SOCKET_OPEN_ERROR,  ///< error opening socket
+    IOSERVICE_READ_DATA_ERROR,    ///< error reading data
+    IOSERVICE_READ_TIMEOUT,       ///< receive timeout
+    IOSERVICE_SEND_DATA_ERROR,    ///< error sending data
+    IOSERVICE_UNKNOWN_ORIGIN,     ///< unknown origin for ASIO error
+    IOSERVICE_UNKNOWN_RESULT,     ///< unknown result
+    IOSERVICE_IPV4_TCP_ACCEPT,    ///< number of IPv4 TCP accept
+    IOSERVICE_IPV6_TCP_ACCEPT,    ///< number of IPv6 TCP accept
+    IOSERVICE_IPV4_TCP_ACCEPTFAIL, ///< number of IPv4 TCP acceptfail
+    IOSERVICE_IPV6_TCP_ACCEPTFAIL, ///< number of IPv6 TCP acceptfail
+    IOSERVICE_TCP_OPEN,           /// number of TCP OPEN
+    IOSERVICE_COUNTER_TYPES       ///< The number of defined counters
+};
+
+/// This file defines a set of statistics items in Auth module for internal
+/// use. This file is intended to be included in statistics.cc.
+
+}   // namespace asiolink
+}   // namespace isc
+
+#endif // __IOSERVICE_COUNTER_H
+
+// Local Variables:
+// mode: c++
+// End:
diff --git a/src/lib/python/isc/acl/Makefile.am b/src/lib/python/isc/acl/Makefile.am
index 4f2fd73..d32d506 100644
--- a/src/lib/python/isc/acl/Makefile.am
+++ b/src/lib/python/isc/acl/Makefile.am
@@ -28,7 +28,7 @@ _dns_la_CXXFLAGS = $(AM_CXXFLAGS) $(PYTHON_CXXFLAGS)
 # suffix for dynamic objects.  -module is necessary to work this around.
 acl_la_LDFLAGS += -module -avoid-version
 acl_la_LIBADD = $(top_builddir)/src/lib/acl/libb10-acl.la
-acl_la_LIBADD = $(top_builddir)/src/lib/asiolink/libb10-asiolink.la
+acl_la_LIBADD += $(top_builddir)/src/lib/asiolink/libb10-asiolink.la
 acl_la_LIBADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
 acl_la_LIBADD += $(PYTHON_LIB)
 



More information about the bind10-changes mailing list