BIND 10 trac2874, updated. 1351e76d7aba24cab1ba23f941d0997e5d24cb3f [2874] Run the threads
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jul 17 13:30:59 UTC 2013
The branch, trac2874 has been updated
via 1351e76d7aba24cab1ba23f941d0997e5d24cb3f (commit)
from aea8bee8d340e7f5b7c0512c0de6e2f4b093310a (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 1351e76d7aba24cab1ba23f941d0997e5d24cb3f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jul 17 15:30:43 2013 +0200
[2874] Run the threads
-----------------------------------------------------------------------
Summary of changes:
src/bin/resolver/bench/coroutine_resolver.cc | 35 ++++++++++++++++++++++++++
src/bin/resolver/bench/coroutine_resolver.h | 8 +++++-
2 files changed, 42 insertions(+), 1 deletion(-)
-----------------------------------------------------------------------
diff --git a/src/bin/resolver/bench/coroutine_resolver.cc b/src/bin/resolver/bench/coroutine_resolver.cc
index 439a774..16c3911 100644
--- a/src/bin/resolver/bench/coroutine_resolver.cc
+++ b/src/bin/resolver/bench/coroutine_resolver.cc
@@ -14,6 +14,13 @@
#include <resolver/bench/coroutine_resolver.h>
+#include <util/threads/thread.h>
+
+#include <boost/foreach.hpp>
+#include <boost/bind.hpp>
+
+using isc::util::thread::Thread;
+
namespace isc {
namespace resolver {
namespace bench {
@@ -29,6 +36,34 @@ CoroutineResolver::CoroutineResolver(size_t count, size_t thread_count) :
}
}
+CoroutineResolver::~CoroutineResolver() {
+ BOOST_FOREACH(FakeInterface* i, interfaces_) {
+ delete i;
+ }
+}
+
+void
+CoroutineResolver::run_instance(FakeInterface*) {
+
+}
+
+size_t
+CoroutineResolver::run() {
+ std::vector<Thread*> threads;
+ // Start a thread for each instance.
+ BOOST_FOREACH(FakeInterface* i, interfaces_) {
+ threads.push_back(
+ new Thread(boost::bind(&CoroutineResolver::run_instance,
+ this, i)));
+ }
+ // Wait for all the threads to finish.
+ BOOST_FOREACH(Thread* t, threads) {
+ t->wait();
+ delete t;
+ }
+ return total_count_;
+}
+
}
}
}
diff --git a/src/bin/resolver/bench/coroutine_resolver.h b/src/bin/resolver/bench/coroutine_resolver.h
index ff7002a..f4b767c 100644
--- a/src/bin/resolver/bench/coroutine_resolver.h
+++ b/src/bin/resolver/bench/coroutine_resolver.h
@@ -17,6 +17,8 @@
#include <resolver/bench/fake_resolution.h>
+#include <boost/noncopyable.hpp>
+
#include <vector>
namespace isc {
@@ -27,15 +29,19 @@ namespace bench {
///
/// Paralelism of waiting for upstream queries is done by executing
/// coroutines. The cache is RCU-based.
-class CoroutineResolver {
+class CoroutineResolver : boost::noncopyable {
public:
/// \brief Constructor.
///
/// Initializes the interfaces and queries in them.
CoroutineResolver(size_t query_count, size_t thread_count);
+ /// \brief Destructor
+ ~CoroutineResolver();
/// \brief Run the benchmark.
size_t run();
private:
+ // Run one thread on given interface.
+ void run_instance(FakeInterface* interface);
std::vector<FakeInterface*> interfaces_;
const size_t thread_count_;
const size_t total_count_;
More information about the bind10-changes
mailing list