# 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
;;
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
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],
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
#
# Check availability of benchmark.
#
+BENCHMARK_CPPFLAGS=
BENCHMARK_LDFLAGS=
BENCHMARK_LDADD=
DISTCHECK_BENCHMARK_CONFIGURE_FLAG=
[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 \
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
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)
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
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
# 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
#
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
Google Benchmark:
BENCHMARK_VERSION: ${BENCHMARK_VERSION}
+ BENCHMARK_CPPFLAGS: ${BENCHMARK_CPPFLAGS}
BENCHMARK_INCLUDES: ${BENCHMARK_INCLUDES}
BENCHMARK_LDFLAGS: ${BENCHMARK_LDFLAGS}
BENCHMARK_LDADD: ${BENCHMARK_LDADD}
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)
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)
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:
#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;
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);
hdsptr_ = HostDataSourceFactory::getHostDataSourcePtr();
}
- /// @brief After benchmark clean-up
+ /// @brief Cleans up after the test.
void TearDown(::benchmark::State const&) override {
try {
hdsptr_->rollback();
}
};
-// 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()) {
}
}
-// 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()) {
}
}
-// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
#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);
lmptr_ = &(LeaseMgrFactory::instance());
}
- /// @brief Cleans up after the benchmark.
+ /// @brief Cleans up after the test.
void TearDown(::benchmark::State const&) override {
try {
lmptr_->rollback();
// 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);
#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 {
: 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"));
}
}
- /// @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
}
}
+
/// The following macros define run parameters for previously defined
/// memfile benchmarks.
+// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2017 Deutsche Telekom AG.
//
// Authors: Andrei Pavel <andrei.pavel@qualitance.com>
#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;
/// @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);
+// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2017 Deutsche Telekom AG.
//
// Authors: Andrei Pavel <andrei.pavel@qualitance.com>
}
}
-// 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()) {
// 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);
}
}
+
/// 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);
/// @}
-};
-};
-};
+}
+}
+}
#endif
+// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2017 Deutsche Telekom AG.
//
// Authors: Andrei Pavel <andrei.pavel@qualitance.com>
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);
hdsptr_ = HostDataSourceFactory::getHostDataSourcePtr();
}
+ /// @brief Cleans up after the test.
void TearDown(::benchmark::State const&) override {
try {
hdsptr_->rollback();
}
};
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
}
}
+/// 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()) {
#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.
}
}
+
/// 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)
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
/// a template
leasetype6_.push_back(LEASETYPE6[i]);
}
-
}
GenericLeaseMgrTest::~GenericLeaseMgrTest() {
leases[1]->subnet_id_),
isc::dhcp::MultipleRecords);
-
}
void
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_);
}
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.
" deleted: " << leases[i]->toText();
}
}
+
// Check that the number of leases deleted is correct.
EXPECT_EQ(deleted_num, should_delete_num);
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;
/// 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();
/// @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);
testWipeLeases6();
}
-}; // end of anonymous namespace
+} // namespace