BIND 10 trac2874, updated. aea8bee8d340e7f5b7c0512c0de6e2f4b093310a [2874] Initialize the coroutine resolver

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jul 17 13:12:09 UTC 2013


The branch, trac2874 has been updated
       via  aea8bee8d340e7f5b7c0512c0de6e2f4b093310a (commit)
      from  15471a94d7cd89204b1a7de89398255662590458 (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 aea8bee8d340e7f5b7c0512c0de6e2f4b093310a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Jul 17 15:11:15 2013 +0200

    [2874] Initialize the coroutine resolver
    
    Create the interfaces and the queries inside them.

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

Summary of changes:
 src/bin/resolver/bench/Makefile.am                 |    1 +
 .../bench/{dummy_work.cc => coroutine_resolver.cc} |   16 +++++++----
 .../{naive_resolver.h => coroutine_resolver.h}     |   28 +++++++++++---------
 3 files changed, 28 insertions(+), 17 deletions(-)
 copy src/bin/resolver/bench/{dummy_work.cc => coroutine_resolver.cc} (63%)
 copy src/bin/resolver/bench/{naive_resolver.h => coroutine_resolver.h} (61%)

-----------------------------------------------------------------------
diff --git a/src/bin/resolver/bench/Makefile.am b/src/bin/resolver/bench/Makefile.am
index 346e007..c3b2bdd 100644
--- a/src/bin/resolver/bench/Makefile.am
+++ b/src/bin/resolver/bench/Makefile.am
@@ -18,6 +18,7 @@ resolver_bench_SOURCES = main.cc
 resolver_bench_SOURCES += fake_resolution.h fake_resolution.cc
 resolver_bench_SOURCES += dummy_work.h dummy_work.cc
 resolver_bench_SOURCES += naive_resolver.h naive_resolver.cc
+resolver_bench_SOURCES += coroutine_resolver.h coroutine_resolver.cc
 
 resolver_bench_LDADD = $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
 resolver_bench_LDADD += $(top_builddir)/src/lib/asiolink/libb10-asiolink.la
diff --git a/src/bin/resolver/bench/coroutine_resolver.cc b/src/bin/resolver/bench/coroutine_resolver.cc
new file mode 100644
index 0000000..439a774
--- /dev/null
+++ b/src/bin/resolver/bench/coroutine_resolver.cc
@@ -0,0 +1,34 @@
+// Copyright (C) 2013  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.
+
+#include <resolver/bench/coroutine_resolver.h>
+
+namespace isc {
+namespace resolver {
+namespace bench {
+
+CoroutineResolver::CoroutineResolver(size_t count, size_t thread_count) :
+    thread_count_(thread_count),
+    // Due to rounding errors, we may handle slighly less queries. It will
+    // not be significant, but we won't lie about how much we handled.
+    total_count_(count / thread_count_ * thread_count_)
+{
+    for (size_t i = 0; i < thread_count; ++i) {
+        interfaces_.push_back(new FakeInterface(count / thread_count));
+    }
+}
+
+}
+}
+}
diff --git a/src/bin/resolver/bench/coroutine_resolver.h b/src/bin/resolver/bench/coroutine_resolver.h
new file mode 100644
index 0000000..ff7002a
--- /dev/null
+++ b/src/bin/resolver/bench/coroutine_resolver.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2013  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 RESOLVER_BENCH_COROUTINE_H
+#define RESOLVER_BENCH_COROUTINE_H
+
+#include <resolver/bench/fake_resolution.h>
+
+#include <vector>
+
+namespace isc {
+namespace resolver {
+namespace bench {
+
+/// \brief Implementation of the resolver using coroutines.
+///
+/// Paralelism of waiting for upstream queries is done by executing
+/// coroutines. The cache is RCU-based.
+class CoroutineResolver {
+public:
+    /// \brief Constructor.
+    ///
+    /// Initializes the interfaces and queries in them.
+    CoroutineResolver(size_t query_count, size_t thread_count);
+    /// \brief Run the benchmark.
+    size_t run();
+private:
+    std::vector<FakeInterface*> interfaces_;
+    const size_t thread_count_;
+    const size_t total_count_;
+};
+
+}
+}
+}
+
+#endif



More information about the bind10-changes mailing list