]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
minor changes - updated comments for google benchmarks
authorRazvan Becheriu <razvan.becheriu@qualitance.com>
Fri, 16 Feb 2018 09:51:51 +0000 (11:51 +0200)
committerRazvan Becheriu <razvan.becheriu@qualitance.com>
Fri, 16 Feb 2018 09:51:51 +0000 (11:51 +0200)
14 files changed:
configure.ac
src/lib/dhcpsrv/benchmarks/Makefile.am
src/lib/dhcpsrv/benchmarks/benchmarks.dox
src/lib/dhcpsrv/benchmarks/cql_host_data_source_benchmark.cc
src/lib/dhcpsrv/benchmarks/cql_lease_mgr_benchmark.cc
src/lib/dhcpsrv/benchmarks/memfile_lease_mgr_benchmark.cc
src/lib/dhcpsrv/benchmarks/mysql_host_data_source_benchmark.cc
src/lib/dhcpsrv/benchmarks/mysql_lease_mgr_benchmark.cc
src/lib/dhcpsrv/benchmarks/parameters.h
src/lib/dhcpsrv/benchmarks/pgsql_host_data_source_benchmark.cc
src/lib/dhcpsrv/benchmarks/pgsql_lease_mgr_benchmark.cc
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc

index eaf735b84dc4eeb7a591ad415bce67017c3e0f5e..3e94d69f4510264191434da9d690fe62e30a4c9c 100644 (file)
@@ -133,15 +133,15 @@ AX_ISC_CPP11
 # Check for std::is_base_of support
 AC_MSG_CHECKING([for std::is_base_of])
 AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-               [#include <type_traits>
-                class A {};
-                class B : A {};]
-               [static_assert(std::is_base_of<A, B>::value, "");])],
-       [AC_MSG_RESULT(yes)
-        AC_DEFINE([HAVE_IS_BASE_OF], [1],
-        [Define to 1 if std::is_base_of is available])],
-       [AC_MSG_RESULT(no)])
+    [AC_LANG_PROGRAM(
+        [#include <type_traits>
+        class A {};
+        class B : A {};]
+        [static_assert(std::is_base_of<A, B>::value, "");])],
+    [AC_MSG_RESULT(yes)
+    AC_DEFINE([HAVE_IS_BASE_OF], [1],
+    [Define to 1 if std::is_base_of is available])],
+    [AC_MSG_RESULT(no)])
 
 dnl Determine if we are using GNU sed
 GNU_SED=no
@@ -408,7 +408,6 @@ case "$host" in
         ;;
 esac
 
-
 # Kea-shell is written in python. It can work with python 2.7 or any 3.x.
 # It may likely work with earlier versions, but 2.7 was the oldest one we tested
 # it with. We require python only if kea-shell was enabled. It is disabled
@@ -906,9 +905,9 @@ if test "x$enable_gtest" = "xyes" ; then
                 AC_MSG_ERROR([no gtest source but it was selected])
             fi
         else
-           if test ! -d $GTEST_SOURCE/src -a -d $GTEST_SOURCE/googletest; then
-               GTEST_SOURCE=$GTEST_SOURCE/googletest
-           fi
+            if test ! -d $GTEST_SOURCE/src -a -d $GTEST_SOURCE/googletest; then
+                GTEST_SOURCE=$GTEST_SOURCE/googletest
+            fi
             AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
                 [$GTEST_SOURCE/src/gtest_main.cc],
                 [have_gtest_source=yes],
@@ -918,7 +917,7 @@ if test "x$enable_gtest" = "xyes" ; then
         GTEST_LDADD="\$(top_builddir)/ext/gtest/libgtest.a"
         DISTCHECK_GTEST_CONFIGURE_FLAG="--with-gtest-source=$GTEST_SOURCE"
         GTEST_INCLUDES="-I$GTEST_SOURCE -I$GTEST_SOURCE/include"
-       GTEST_VERSION="`basename $GTEST_SOURCE`"
+        GTEST_VERSION="`basename $GTEST_SOURCE`"
     fi
 
     if test "$gtest_path" != "no" ; then
@@ -977,6 +976,7 @@ AC_SUBST(GTEST_SOURCE)
 #
 # Check availability of benchmark.
 #
+BENCHMARK_CPPFLAGS=
 BENCHMARK_LDFLAGS=
 BENCHMARK_LDADD=
 DISTCHECK_BENCHMARK_CONFIGURE_FLAG=
@@ -1012,7 +1012,8 @@ if test "x$enable_benchmark" = "xyes" ; then
                 [AC_MSG_ERROR([no benchmark source at $BENCHMARK_SOURCE])])
         fi
         have_benchmark_source=yes
-        BENCHMARK_LDADD="\$(top_builddir)/ext/benchmark/libbenchmark.a"
+        BENCHMARK_CPPFLAGS=`cat \${BENCHMARK_SOURCE}/build/src/CMakeFiles/benchmark.dir/flags.make | grep CXX_DEFINES | cut -d "=" -f 2`
+        BENCHMARK_LDADD="\$(BENCHMARK_SOURCE)/build/src/libbenchmark.a"
         DISTCHECK_BENCHMARK_CONFIGURE_FLAG="--with-benchmark-source=$BENCHMARK_SOURCE"
         BENCHMARK_INCLUDES="-I$BENCHMARK_SOURCE \
                             -I$BENCHMARK_SOURCE/src \
@@ -1024,42 +1025,24 @@ if test "x$enable_benchmark" = "xyes" ; then
     if test "$benchmark_path" != "no" ; then
         if test "$benchmark_path" != "yes"; then
             BENCHMARK_PATHS=$benchmark_path
-            if test -x "${benchmark_path}/bin/benchmark-config" ; then
-                BENCHMARK_CONFIG="${benchmark_path}/bin/benchmark-config"
-            fi
-        else
-            AC_PATH_PROG([BENCHMARK_CONFIG], [benchmark-config])
         fi
-        if test -x "${BENCHMARK_CONFIG}" ; then :
-            # using cppflags instead of cxxflags
-            BENCHMARK_INCLUDES=$(${BENCHMARK_CONFIG} --cppflags)
-            BENCHMARK_LDFLAGS=$(${BENCHMARK_CONFIG} --ldflags)
-            BENCHMARK_LDADD=$(${BENCHMARK_CONFIG} --libs)
-            BENCHMARK_VERSION=$(${BENCHMARK_CONFIG} --version)
-            BENCHMARK_FOUND="true"
-        else
-            AC_MSG_WARN([Unable to locate Google Benchmark benchmark-config.])
-            if test -z "${BENCHMARK_PATHS}" ; then
-                BENCHMARK_PATHS="/usr /usr/local"
-            fi
-            BENCHMARK_FOUND="false"
+        if test -z "${BENCHMARK_PATHS}" ; then
+            BENCHMARK_PATHS="/usr /usr/local"
         fi
-        if test "${BENCHMARK_FOUND}" != "true"; then
-            BENCHMARK_FOUND="false"
-            for dir in ${BENCHMARK_PATHS}; do
-                if test -f "$dir/include/benchmark/benchmark.h"; then
-                    if ! test -f "$dir/lib/libbenchmark.a"; then
-                        AC_MSG_WARN([Found Google Benchmark include but not the library in $dir.])
-                        continue
-                    fi
-                    BENCHMARK_INCLUDES="-I$dir/include"
-                    BENCHMARK_LDFLAGS="-L$dir/lib"
-                    BENCHMARK_LDADD="$dir/lib/libbenchmark.a "
-                    BENCHMARK_FOUND="true"
-                    break
+        BENCHMARK_FOUND="false"
+        for dir in ${BENCHMARK_PATHS}; do
+            if test -f "$dir/include/benchmark/benchmark.h"; then
+                if ! test -f "$dir/lib/libbenchmark.a"; then
+                    AC_MSG_WARN([Found Google Benchmark include but not the library in $dir.])
+                    continue
                 fi
-            done
-        fi
+                BENCHMARK_INCLUDES="-I$dir/include"
+                BENCHMARK_LDFLAGS="-L$dir/lib"
+                BENCHMARK_LDADD="$dir/lib/libbenchmark.a "
+                BENCHMARK_FOUND="true"
+                break
+            fi
+        done
         if test "${BENCHMARK_FOUND}" != "true"; then
             AC_MSG_ERROR([Cannot find benchmark in: $BENCHMARK_PATHS])
         fi
@@ -1069,6 +1052,7 @@ fi
 AM_CONDITIONAL(HAVE_BENCHMARK, test $enable_benchmark != "no")
 AM_CONDITIONAL(HAVE_BENCHMARK_SOURCE, test "X$have_benchmark_source" = "Xyes")
 AC_SUBST(DISTCHECK_BENCHMARK_CONFIGURE_FLAG)
+AC_SUBST(BENCHMARK_CPPFLAGS)
 AC_SUBST(BENCHMARK_INCLUDES)
 AC_SUBST(BENCHMARK_LDFLAGS)
 AC_SUBST(BENCHMARK_LDADD)
@@ -1083,15 +1067,15 @@ if test $enable_gtest != "no"; then
    CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES $GTEST_INCLUDES"
    AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-           [#include <boost/shared_ptr.hpp>
-           #include <gtest/gtest.h>
-           void foo() {
-               boost::shared_ptr<int> bar;
-               ASSERT_TRUE(bar);
+            [#include <boost/shared_ptr.hpp>
+            #include <gtest/gtest.h>
+            void foo() {
+                boost::shared_ptr<int> bar;
+                ASSERT_TRUE(bar);
             }],
-           [return 0;])],
-       [AC_MSG_RESULT(yes)],
-       [AC_MSG_ERROR([XXX_TRUE() Google Test macros won't compile; the most likely reason is that a later version of Google Test is required])])
+            [return 0;])],
+        [AC_MSG_RESULT(yes)],
+        [AC_MSG_ERROR([XXX_TRUE() Google Test macros won't compile; the most likely reason is that a later version of Google Test is required])])
     CPPFLAGS=$CPPFLAGS_SAVED
 fi
 
@@ -1102,21 +1086,21 @@ if test $enable_gtest != "no"; then
    CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES $GTEST_INCLUDES"
    AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-           [#include <boost/algorithm/string.hpp>
-           #include <gtest/gtest.h>
-           #include <string>
-           #include <vector>
-           std::string nodiff(std::string text) {
-               std::vector<std::string> lines;
-               boost::split(lines, text, boost::is_any_of("\n"));
-               using namespace testing::internal;
-               return (edit_distance::CreateUnifiedDiff(lines, lines));
-           }],
-           [return 0;])],
-       [AC_MSG_RESULT(yes)
-        AC_DEFINE([HAVE_CREATE_UNIFIED_DIFF], [1],
-        [Define to 1 if gtest defines edit_distance::CreateUnifiedDiff])],
-       [AC_MSG_RESULT(no)])
+            [#include <boost/algorithm/string.hpp>
+            #include <gtest/gtest.h>
+            #include <string>
+            #include <vector>
+            std::string nodiff(std::string text) {
+                std::vector<std::string> lines;
+                boost::split(lines, text, boost::is_any_of("\n"));
+                using namespace testing::internal;
+                return (edit_distance::CreateUnifiedDiff(lines, lines));
+            }],
+            [return 0;])],
+        [AC_MSG_RESULT(yes)
+        AC_DEFINE([HAVE_CREATE_UNIFIED_DIFF], [1],
+        [Define to 1 if gtest defines edit_distance::CreateUnifiedDiff])],
+        [AC_MSG_RESULT(no)])
     CPPFLAGS=$CPPFLAGS_SAVED
 fi
 
@@ -1152,7 +1136,7 @@ AC_CHECK_FUNCS([pselect])
 # code will be updated by the time we really need it.
 AC_CHECK_HEADERS(sys/devpoll.h, ac_cv_have_devpoll=yes, ac_cv_have_devpoll=no)
 if test "X$ac_cv_have_devpoll" = "Xyes" -a "X$GXX" = "Xyes"; then
-       CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_DISABLE_DEV_POLL=1"
+    CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_DISABLE_DEV_POLL=1"
 fi
 
 #
@@ -1617,9 +1601,9 @@ if test "$CQL_CPPFLAGS" != "" ; then
 cat >> config.report << END
 
 Cassandra CQL:
-  CQL_VERSION:   ${CQL_VERSION}
-  CQL_CPPFLAGS:  ${CQL_CPPFLAGS}
-  CQL_LIBS:      ${CQL_LIBS}
+  CQL_VERSION:                  ${CQL_VERSION}
+  CQL_CPPFLAGS:                 ${CQL_CPPFLAGS}
+  CQL_LIBS:                     ${CQL_LIBS}
 END
 else
 cat >> config.report << END
@@ -1651,6 +1635,7 @@ cat >> config.report << END
 
 Google Benchmark:
   BENCHMARK_VERSION:   ${BENCHMARK_VERSION}
+  BENCHMARK_CPPFLAGS:  ${BENCHMARK_CPPFLAGS}
   BENCHMARK_INCLUDES:  ${BENCHMARK_INCLUDES}
   BENCHMARK_LDFLAGS:   ${BENCHMARK_LDFLAGS}
   BENCHMARK_LDADD:     ${BENCHMARK_LDADD}
index 7f2f05c6cb06196207eb1397a1830bb4823f56d2..c99b884fac97ad3359337559e59de43658dba45e 100644 (file)
@@ -40,7 +40,7 @@ run_benchmarks_SOURCES += cql_lease_mgr_benchmark.cc
 run_benchmarks_SOURCES += cql_host_data_source_benchmark.cc
 endif
 
-run_benchmarks_CPPFLAGS  = $(AM_CPPFLAGS) $(BENCHMARK_INCLUDES) -Wno-error=overloaded-virtual
+run_benchmarks_CPPFLAGS  = $(AM_CPPFLAGS) $(BENCHMARK_INCLUDES) $(BENCHMARK_CPPFLAGS) -Wno-error=overloaded-virtual
 
 if HAVE_MYSQL
 run_benchmarks_CPPFLAGS += $(MYSQL_CPPFLAGS)
@@ -74,7 +74,6 @@ run_benchmarks_LDADD  = $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest
 run_benchmarks_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 run_benchmarks_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 run_benchmarks_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
-run_benchmarks_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
 run_benchmarks_LDADD += $(BENCHMARK_LDADD)
 run_benchmarks_LDADD += $(LOG4CPLUS_LIBS)
 run_benchmarks_LDADD += $(CRYPTO_LIBS)
index cf0ffe41e430e5c2699d520c80f3535dd2eef182..183e3ddde4da929dd865a55080b5008665744bde 100644 (file)
@@ -22,15 +22,14 @@ $ make
 
 The benchmarks are built in @b src/lib/dhcpsrv/benchmarks directory.
 Note that the benchmarks are backend-specific, so please make sure you
-enable the backends you want to measure (See --with-dhcp-mysql,
---with-dhcp-pgsql --with-cql parameters for configure). Once the
-benchmark is built, you can run specific benchmarks. Make sure you
-have the environment ready for use, i.e. the actual database backend
-is set up, the DB or keyspace is created. The setup is the same as for
-running unit-tests. DB name or keyspace should be keatest, and
-username keatest, password keatest should give you full write access
-to the database. Any data present in the DB before the tests will be
-removed.
+enable the backends you want to measure (See --with-mysql, --with-pgsql,
+--with-cql parameters for configure). Once the benchmark is built, you
+can run specific benchmarks. Make sure you have the environment ready
+for use, i.e. the actual database backend is set up, the DB or keyspace
+is created. The setup is the same as for running unit-tests.
+DB name or keyspace should be keatest, and username keatest,
+password keatest should give you full write access to the database.
+Any data present in the DB before the tests will be removed.
 
 To get a list of available benchmarks, use the following command:
 
index ad3dd6286a0466ab1b455c9bbe78a873a309145b..f0223012be639222219cf08f31cd5cb474e9ed1f 100644 (file)
@@ -21,7 +21,6 @@
 #include <dhcpsrv/benchmarks/parameters.h>
 #include <dhcpsrv/host_data_source_factory.h>
 #include <dhcpsrv/testutils/cql_schema.h>
-
 #include <iostream>
 
 using namespace isc::dhcp::bench;
@@ -31,11 +30,13 @@ using namespace std;
 
 namespace {
 
-/// @brief Fixture class for benchmarking Cassandra host backend
+/// @brief This is a fixture class used for benchmarking Cassandra host backend
 class CqlHostDataSourceBenchmark : public GenericHostDataSourceBenchmark {
 public:
 
-    /// @brief Before benchmark setup.
+    /// @brief Setup routine.
+    ///
+    /// It cleans up schema and recreates tables, then instantiates HostMgr
     void SetUp(::benchmark::State const&) override {
         destroyCqlSchema(false, true);
         createCqlSchema(false, true);
@@ -49,7 +50,7 @@ public:
         hdsptr_ = HostDataSourceFactory::getHostDataSourcePtr();
     }
 
-    /// @brief After benchmark clean-up
+    /// @brief Cleans up after the test.
     void TearDown(::benchmark::State const&) override {
         try {
             hdsptr_->rollback();
@@ -63,7 +64,8 @@ public:
     }
 };
 
-// This benchmark measures insertion of new hosts.
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts insertion.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, insertHosts)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -72,7 +74,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, insertHosts)(benchmark::State& st
     }
 }
 
-// This benchmark measures update of existing hosts.
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts update.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, updateHosts)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -81,7 +84,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, updateHosts)(benchmark::State& st
     }
 }
 
-// This benchmark 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by getAll(hw-addr, duid) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, getAllByHWAddrDuid)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -90,6 +94,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, getAllByHWAddrDuid)(benchmark::St
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by getAll4(hw-addr, duid) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, getAll)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -98,6 +104,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, getAll)(benchmark::State& state)
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by getAll(v4-reservation) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, getAllv4Resv)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -106,6 +114,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, getAllv4Resv)(benchmark::State& s
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get4(subnet-id, hw-addr, duid) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -114,6 +124,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)(benchmark
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get4(identifier-type, identifier, subnet-id) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get4IdentifierSubnetId)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -122,6 +134,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get4IdentifierSubnetId)(benchmark
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get4(subnet-id, v4-reservation) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -130,6 +144,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)(benchmark::S
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get6(subnet-id, duid, hw-addr) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -138,6 +154,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)(benchmark
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get6(subnet-id, identifier-type, identifier) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get6IdentifierSubnetId)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -146,6 +164,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get6IdentifierSubnetId)(benchmark
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get6(subnet-id, ip-address) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get6SubnetIdAddr)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -154,6 +174,8 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get6SubnetIdAddr)(benchmark::Stat
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get6(ip-prefix, prefix-len) call.
 BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get6Prefix)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
index 5f21cd85913476c73f56fd1d65f03e5432d942d2..2179f6415faf89a5540e496f676e69f580b998aa 100644 (file)
 #include <dhcpsrv/lease_mgr_factory.h>
 #include <dhcpsrv/testutils/cql_schema.h>
 
-using namespace isc::dhcp;
+using namespace isc::dhcp::bench;
 using namespace isc::dhcp::test;
+using namespace isc::dhcp;
 using namespace std;
-using namespace isc::dhcp::bench;
 
 namespace {
 
 /// @brief This is a fixture class used for benchmarking Cassandra lease backend
 class CqlLeaseMgrBenchmark : public GenericLeaseMgrBenchmark {
 public:
-
-    /// @brief Prepares the benchmark to run
+    /// @brief Setup routine.
     ///
-    /// Destroys and then recreates CQL schema, initializes CQL LeaseMgr.
+    /// It cleans up schema and recreates tables, then instantiates LeaseMgr
     void SetUp(::benchmark::State const&) override {
         destroyCqlSchema(false, true);
         createCqlSchema(false, true);
@@ -49,7 +48,7 @@ public:
         lmptr_ = &(LeaseMgrFactory::instance());
     }
 
-    /// @brief Cleans up after the benchmark.
+    /// @brief Cleans up after the test.
     void TearDown(::benchmark::State const&) override {
         try {
             lmptr_->rollback();
@@ -176,7 +175,7 @@ BENCHMARK_DEFINE_F(CqlLeaseMgrBenchmark, getLease6_type_duid_iaid)(benchmark::St
 // Defines a benchmark that measures IPv6 leases retrieval by lease type, duid, iaid
 // and subnet-id.
 BENCHMARK_DEFINE_F(CqlLeaseMgrBenchmark, getLease6_type_duid_iaid_subnetid)
-    (benchmark::State& state) {
+                  (benchmark::State& state) {
     const size_t lease_count = state.range(0);
     while (state.KeepRunning()) {
         setUpWithInserts6(state, lease_count);
index 11b06555107a32239bb1515ed7215e0901160027..ce6e738af59257158a2fedfbbeb8d873e77c7dc9 100644 (file)
 #include <dhcpsrv/lease_mgr_factory.h>
 #include <dhcpsrv/testutils/lease_file_io.h>
 
-using namespace isc::dhcp;
-using namespace isc::dhcp::test;
 using namespace isc::dhcp::bench;
+using namespace isc::dhcp::test;
+using namespace isc::dhcp;
+using namespace std;
 
 namespace {
 
@@ -29,12 +30,12 @@ public:
         : io4_(""), io6_("") {
     }
 
-    /// @brief Prepares the benchmark to run.
+    /// @brief Setup routine.
     ///
     /// Removes any files left over from earlier test, destroys any existing
-    /// lease manager, and then starts a new memfile mease manager.
+    /// lease manager, and then starts a new memfile lease manager.
     /// The state parameter is ignored.
-    void SetUp(::benchmark::State const& ) override {
+    void SetUp(::benchmark::State const&) override {
 
         io4_ = LeaseFileIO(getLeaseFilePath("leasefile4_0.csv"));
         io6_ = LeaseFileIO(getLeaseFilePath("leasefile6_0.csv"));
@@ -114,7 +115,7 @@ public:
         }
     }
 
-    /// @brief Cleanup after a benchmark
+    /// @brief Cleans up after the test.
     ///
     /// Rolls back any uncommitted operation (really a no-op for memfile as it
     /// does not support transactions), then destroys the lease manager
@@ -271,6 +272,7 @@ BENCHMARK_DEFINE_F(MemfileLeaseMgrBenchmark, getExpiredLeases6)(benchmark::State
     }
 }
 
+
 /// The following macros define run parameters for previously defined
 /// memfile benchmarks.
 
index 4eb39ce621f0cad2d46c3d169e00e05c2b49dc8c..a06e9b788f332d020580b1b1aa7550dfb7a5fd1b 100644 (file)
@@ -1,3 +1,4 @@
+// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
 // Copyright (C) 2017 Deutsche Telekom AG.
 //
 // Authors: Andrei Pavel <andrei.pavel@qualitance.com>
@@ -20,7 +21,6 @@
 #include <dhcpsrv/benchmarks/parameters.h>
 #include <dhcpsrv/host_data_source_factory.h>
 #include <dhcpsrv/testutils/mysql_schema.h>
-
 #include <iostream>
 
 using namespace isc::dhcp::bench;
@@ -36,7 +36,7 @@ public:
 
     /// @brief Setup routine.
     ///
-    /// It cleans up schema and recreates tables, then instantiates LeaseMgr
+    /// It cleans up schema and recreates tables, then instantiates HostMgr
     void SetUp(::benchmark::State const&) override {
         destroyMySQLSchema(false);
         createMySQLSchema(false);
index 0c88e25585e2869de2e648182daa17a826fe00f8..c856a25ac97c3b07e0651096071339a28f9ba7ac 100644 (file)
@@ -1,3 +1,4 @@
+// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
 // Copyright (C) 2017 Deutsche Telekom AG.
 //
 // Authors: Andrei Pavel <andrei.pavel@qualitance.com>
@@ -88,8 +89,7 @@ BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease4_address)(benchmark::State&
     }
 }
 
-// Defines a benchmark that measures IPv4 leases retrieval by hardware address
-// and subnet-id.
+// Defines a benchmark that measures IPv4 leases retrieval by hardware address.
 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease4_hwaddr)(benchmark::State& state) {
     const size_t lease_count = state.range(0);
     while (state.KeepRunning()) {
@@ -175,7 +175,7 @@ BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease6_type_duid_iaid)(benchmark::
 // Defines a benchmark that measures IPv6 leases retrieval by lease type, duid, iaid
 // and subnet-id.
 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease6_type_duid_iaid_subnetid)
-    (benchmark::State& state) {
+                  (benchmark::State& state) {
     const size_t lease_count = state.range(0);
     while (state.KeepRunning()) {
         setUpWithInserts6(state, lease_count);
@@ -192,10 +192,10 @@ BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getExpiredLeases6)(benchmark::State&
     }
 }
 
+
 /// The following macros define run parameters for previously defined
 /// MySQL benchmarks.
 
-
 /// A benchmark that measures IPv4 leases insertion.
 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, insertLeases4)
     ->Range(MIN_LEASE_COUNT, MAX_LEASE_COUNT)->Unit(UNIT);
index 5a321a7264bc9f08ac63f2fb6b05ae7a40ddc1ae..2de54f93ce3059770e91f0a0b972097b92b7fde3 100644 (file)
@@ -36,8 +36,8 @@ constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
 
 /// @}
 
-};
-};
-};
+}
+}
+}
 
 #endif
index 5245e9d6d8c5e74cf4d84fb615fc8e8851a06624..9dfd14299ab43d0667979760ea77bddb05cd06e9 100644 (file)
@@ -1,3 +1,4 @@
+// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
 // Copyright (C) 2017 Deutsche Telekom AG.
 //
 // Authors: Andrei Pavel <andrei.pavel@qualitance.com>
@@ -29,8 +30,13 @@ using namespace std;
 
 namespace {
 
+/// @brief This is a fixture class used for benchmarking PostgreSQL host backend
 class PgSqlHostDataSourceBenchmark : public GenericHostDataSourceBenchmark {
 public:
+
+    /// @brief Setup routine.
+    ///
+    /// It cleans up schema and recreates tables, then instantiates HostMgr
     void SetUp(::benchmark::State const&) override {
         destroyPgSQLSchema(false);
         createPgSQLSchema(false);
@@ -44,6 +50,7 @@ public:
         hdsptr_ = HostDataSourceFactory::getHostDataSourcePtr();
     }
 
+    /// @brief Cleans up after the test.
     void TearDown(::benchmark::State const&) override {
         try {
             hdsptr_->rollback();
@@ -57,6 +64,8 @@ public:
     }
 };
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts insertion.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, insertHosts)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -65,6 +74,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, insertHosts)(benchmark::State&
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts update.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, updateHosts)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -73,6 +84,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, updateHosts)(benchmark::State&
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by getAll(hw-addr, duid) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, getAllByHWAddrDuid)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -81,6 +94,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, getAllByHWAddrDuid)(benchmark::
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by getAll4(hw-addr, duid) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, getAll)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -89,6 +104,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, getAll)(benchmark::State& state
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by getAll(v4-reservation) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, getAllv4Resv)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -97,6 +114,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, getAllv4Resv)(benchmark::State&
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get4(subnet-id, hw-addr, duid) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -105,6 +124,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)(benchma
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get4(identifier-type, identifier, subnet-id) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get4IdentifierSubnetId)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -113,6 +134,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get4IdentifierSubnetId)(benchma
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get4(subnet-id, v4-reservation) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -121,6 +144,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)(benchmark:
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get6(subnet-id, duid, hw-addr) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -129,6 +154,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)(benchma
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get6(subnet-id, identifier-type, identifier) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get6IdentifierSubnetId)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -137,6 +164,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get6IdentifierSubnetId)(benchma
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get6(subnet-id, ip-address) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get6SubnetIdAddr)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
@@ -145,6 +174,8 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get6SubnetIdAddr)(benchmark::St
     }
 }
 
+/// Defines steps necessary for conducting a benchmark that measures
+/// hosts retrieval by get6(ip-prefix, prefix-len) call.
 BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get6Prefix)(benchmark::State& state) {
     const size_t host_count = state.range(0);
     while (state.KeepRunning()) {
index 4080b6a2d93a095e8e24ae7b9904b27b6a088378..cad7acc978bd882484a19947c847836a75a36ffc 100644 (file)
 #include <dhcpsrv/testutils/pgsql_schema.h>
 
 using namespace isc::dhcp::bench;
-using namespace isc::dhcp;
 using namespace isc::dhcp::test;
+using namespace isc::dhcp;
 using namespace std;
 
 namespace {
 
-/// @brief This is a fixture class used for benchmarking Postgres lease backend
+/// @brief This is a fixture class used for benchmarking PostgreSQL lease backend
 class PgSqlLeaseMgrBenchmark : public GenericLeaseMgrBenchmark {
 public:
     /// @brief Setup routine.
@@ -192,8 +192,9 @@ BENCHMARK_DEFINE_F(PgSqlLeaseMgrBenchmark, getExpiredLeases6)(benchmark::State&
     }
 }
 
+
 /// The following macros define run parameters for previously defined
-/// Postgres benchmarks.
+/// PostgreSQL benchmarks.
 
 /// A benchmark that measures IPv4 leases insertion.
 BENCHMARK_REGISTER_F(PgSqlLeaseMgrBenchmark, insertLeases4)
@@ -244,11 +245,13 @@ BENCHMARK_REGISTER_F(PgSqlLeaseMgrBenchmark, getLease6_type_address)
 BENCHMARK_REGISTER_F(PgSqlLeaseMgrBenchmark, getLease6_type_duid_iaid)
     ->Range(MIN_LEASE_COUNT, MAX_LEASE_COUNT)->Unit(UNIT);
 
-/// A benchmark that measures IPv6 lease retrieval by lease type, duid and iaid.
+/// A benchmark that measures IPv6 lease retrieval by lease type, duid, iaid and
+/// subnet-id.
 BENCHMARK_REGISTER_F(PgSqlLeaseMgrBenchmark, getLease6_type_duid_iaid_subnetid)
     ->Range(MIN_LEASE_COUNT, MAX_LEASE_COUNT)->Unit(UNIT);
 
-/// A benchmark that measures expired IPv4 leases retrieval.
+/// A benchmark that measures expired IPv6 leases retrieval.
 BENCHMARK_REGISTER_F(PgSqlLeaseMgrBenchmark, getExpiredLeases6)
     ->Range(MIN_LEASE_COUNT, MAX_LEASE_COUNT)->Unit(UNIT);
+
 }  // namespace
index e9cdcbf94210a2e131e878a632e702fe38a8e2b7..037172f2b1a157509a4acdb8d8361970db55ce0d 100644 (file)
@@ -64,7 +64,6 @@ GenericLeaseMgrTest::GenericLeaseMgrTest()
         /// a template
         leasetype6_.push_back(LEASETYPE6[i]);
     }
-
 }
 
 GenericLeaseMgrTest::~GenericLeaseMgrTest() {
@@ -1083,7 +1082,6 @@ GenericLeaseMgrTest::testGetLease4HWAddrSubnetId() {
                                               leases[1]->subnet_id_),
                  isc::dhcp::MultipleRecords);
 
-
 }
 
 void
@@ -1175,7 +1173,7 @@ GenericLeaseMgrTest::testGetLease4ClientIdSize() {
         leases[1]->client_id_.reset(new ClientId(clientid_vec));
         EXPECT_TRUE(lmptr_->addLease(leases[1]));
         Lease4Collection returned = lmptr_->getLease4(*leases[1]->client_id_);
-        ASSERT_TRUE(returned.size() == 1);
+        ASSERT_EQ(returned.size(), 1u);
         detailCompareLease(leases[1], *returned.begin());
         (void) lmptr_->deleteLease(leases[1]->addr_);
     }
@@ -1973,7 +1971,6 @@ GenericLeaseMgrTest::testDeleteExpiredReclaimedLeases4() {
             EXPECT_FALSE(lease) << "The following lease should have been"
                 " deleted: " << leases[i]->toText();
             ++should_delete_num;
-
         } else {
             // If the lease is not reclaimed or it has expired less than
             // 15 seconds ago, the lease should still be there.
@@ -1981,6 +1978,7 @@ GenericLeaseMgrTest::testDeleteExpiredReclaimedLeases4() {
                 " deleted: " << leases[i]->toText();
         }
     }
+
     // Check that the number of leases deleted is correct.
     EXPECT_EQ(deleted_num, should_delete_num);
 
index 29694760bf0039b5bacd9540377fd6770f272685..5f4eaea9528df9d1182010bd2d839ab2679565a4 100644 (file)
@@ -15,7 +15,6 @@ namespace isc {
 namespace dhcp {
 namespace test {
 
-
 /// @brief typedefs to simplify lease statistic testing
 typedef std::map<std::string, int64_t> StatValMap;
 typedef std::pair<std::string, int64_t> StatValPair;
@@ -27,12 +26,8 @@ typedef std::vector<StatValMap> StatValMapList;
 /// All concrete LeaseMgr test classes should be derived from it.
 class GenericLeaseMgrTest : public ::testing::Test {
 public:
-
     /// @brief Universe (V4 or V6).
-    enum Universe {
-        V4,
-        V6
-    };
+    enum Universe { V4, V6 };
 
     /// @brief Default constructor.
     GenericLeaseMgrTest();
index 9ac60d1cac11e3bacbbf5d53a90a70e46a5731b8..8d23f2699353638e32aafef2d60b9f40972dee85 100644 (file)
@@ -873,7 +873,7 @@ TEST_F(MemfileLeaseMgrTest, getLease4ClientIdHWAddrSubnetId) {
 /// @brief Basic Lease4 Checks
 ///
 /// Checks that the addLease, getLease4(by address), getLease4(hwaddr,subnet_id),
-/// updateLease4() and deleteLease (IPv4 address) can handle NULL client-id.
+/// updateLease4() and deleteLease can handle NULL client-id.
 /// (client-id is optional and may not be present)
 TEST_F(MemfileLeaseMgrTest, lease4NullClientId) {
     startBackend(V4);
@@ -1922,4 +1922,4 @@ TEST_F(MemfileLeaseMgrTest, wipeLeases6) {
     testWipeLeases6();
 }
 
-}; // end of anonymous namespace
+}  // namespace