run_benchmarks_SOURCES += generic_lease_mgr_benchmark.cc generic_lease_mgr_benchmark.h
run_benchmarks_SOURCES += generic_host_data_source_benchmark.cc generic_host_data_source_benchmark.h
run_benchmarks_SOURCES += memfile_lease_mgr_benchmark.cc
+run_benchmarks_SOURCES += parameters.h
if HAVE_MYSQL
run_benchmarks_SOURCES += mysql_lease_mgr_benchmark.cc
#include <config.h>
#include <dhcpsrv/benchmarks/generic_host_data_source_benchmark.h>
+#include <dhcpsrv/benchmarks/parameters.h>
#include <dhcpsrv/host_data_source_factory.h>
#include <dhcpsrv/testutils/cql_schema.h>
#include <iostream>
-using isc::dhcp::bench::GenericHostDataSourceBenchmark;
-using isc::dhcp::test::createCqlSchema;
-using isc::dhcp::test::destroyCqlSchema;
-using isc::dhcp::HostDataSourceFactory;
-using isc::dhcp::test::validCqlConnectionString;
-using std::cerr;
-using std::endl;
+using namespace isc::dhcp::bench;
+using namespace isc::dhcp::test;
+using namespace isc::dhcp;
+using namespace std;
namespace {
}
}
-constexpr size_t MIN_HOST_COUNT = 512;
-constexpr size_t MAX_HOST_COUNT = 0xfffd;
-constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
-
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, insertHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, updateHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAllByHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAll)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAllv4Resv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6SubnetIdAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6Prefix)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts insertion.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, insertHosts)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts update.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, updateHosts)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by getAll(hw-addr, duid) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAllByHWAddrDuid)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by getAll4(hw-addr, duid) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAll)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by getAll(v4-reservation) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAllv4Resv)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get4(subnet-id, hw-addr, duid) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get4(identifier-type, identifier, subnet-id) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4IdentifierSubnetId)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get4(subnet-id, v4-reservation) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(subnet-id, duid, hw-addr) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(subnet-id, identifier-type, identifier) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6IdentifierSubnetId)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(subnet-id, ip-address) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6SubnetIdAddr)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(ip-prefix, prefix-len) call.
+BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6Prefix)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
} // namespace
#include <config.h>
#include <dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h>
+#include <dhcpsrv/benchmarks/parameters.h>
#include <dhcpsrv/lease_mgr_factory.h>
#include <dhcpsrv/testutils/cql_schema.h>
// Add DHCPv6 options.
CfgOptionPtr opts = host->getCfgOption6();
opts->add(createOption<OptionString>(Option::V6, D6O_BOOTFILE_URL, true,
- formatted, "my-boot-file"),
- DHCP6_OPTION_SPACE);
- opts->add(createOption<OptionUint32>(Option::V6,
- D6O_INFORMATION_REFRESH_TIME,
- false, formatted, 3600),
- DHCP6_OPTION_SPACE);
- opts->add(createVendorOption(Option::V6, false, formatted, 2495),
- DHCP6_OPTION_SPACE);
- opts->add(createAddressOption<Option6AddrLst>(1024, false, formatted,
- "2001:db8:1::1"),
+ formatted, "my-boot-file"), DHCP6_OPTION_SPACE);
+ opts->add(createOption<OptionUint32>(Option::V6, D6O_INFORMATION_REFRESH_TIME,
+ false, formatted, 3600), DHCP6_OPTION_SPACE);
+ opts->add(createVendorOption(Option::V6, false, formatted, 2495), DHCP6_OPTION_SPACE);
+ opts->add(createAddressOption<Option6AddrLst>(1024, false, formatted, "2001:db8:1::1"),
DHCP6_OPTION_SPACE);
opts->add(createEmptyOption(Option::V6, 1, true), "isc2");
- opts->add(createAddressOption<Option6AddrLst>(
- 2, false, formatted, "3000::1", "3000::2", "3000::3"),
- "isc2");
+ opts->add(createAddressOption<Option6AddrLst>(2, false, formatted, "3000::1", "3000::2",
+ "3000::3"), "isc2");
// Add definitions for DHCPv6 non-standard options.
- defs.addItem(OptionDefinitionPtr(new OptionDefinition(
- "option-1024", 1024, "ipv6-address", true)),
- DHCP6_OPTION_SPACE);
- defs.addItem(
- OptionDefinitionPtr(new OptionDefinition("option-1", 1, "empty")),
- "isc2");
- defs.addItem(OptionDefinitionPtr(new OptionDefinition(
- "option-2", 2, "ipv6-address", true)),
- "isc2");
+ defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-1024", 1024, "ipv6-address",
+ true)), DHCP6_OPTION_SPACE);
+ defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-1", 1, "empty")), "isc2");
+ defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-2", 2, "ipv6-address",
+ true)), "isc2");
}
// Register created "runtime" option definitions. They will be used by a
GenericHostDataSourceBenchmark::benchGet4BySubnetHWAddrDuid() {
for (HostPtr host : hosts_) {
std::vector<uint8_t> hwaddr = host->getIdentifier();
- hdsptr_->get4(host->getIPv4SubnetID(),
- HWAddrPtr(new HWAddr(hwaddr, host->getIdentifierType())),
- host->getDuid());
+ hdsptr_->get4(host->getIPv4SubnetID(), HWAddrPtr(new HWAddr(hwaddr,
+ host->getIdentifierType())), host->getDuid());
}
}
namespace dhcp {
namespace bench {
- /// @brief Base fixture class for benchmarking host bakcends.
+/// @brief Base fixture class for benchmarking host bakcends.
class GenericHostDataSourceBenchmark : public ::benchmark::Fixture {
public:
/// getAll(identifier-type, identifier) call.
void benchGetAll();
- /// @brief Essential stpes requires to benchmark host reservation retrieval
+ /// @brief Essential steps required to benchmark host reservation retrieval
/// using getAll(ipv4-reservation) call.
void getAllv4Resv();
+ /// @brief Essential steps requires to benchmark host reservation retrieval
+ /// using getAll(hw-addr, duid) call.
void benchGet4BySubnetHWAddrDuid();
+ /// @brief Essential steps requires to benchmark host reservation retrieval
+ /// using getAll(identifier-type, identifier, subnet-id) call.
void benchGet4IdentifierSubnetId();
+ /// @brief Essential steps requires to benchmark host reservation retrieval
+ /// using getAll(v4-reservation) call.
void benchGet4SubnetIdv4Resrv();
+ /// @brief Essential steps requires to benchmark host reservation retrieval
+ /// using get6(subnet-id, duid, hw-addr) call.
void benchGet6SubnetIdDuidHWAddr();
+ /// @brief Essential steps requires to benchmark host reservation retrieval
+ /// using get6(identifier-type, identifier, subnet-id) call.
void benchGet6IdentifierSubnetId();
+ /// @brief Essential steps requires to benchmark host reservation retrieval
+ /// using get6(ip-addr, subnet-id) call.
void benchGet6SubnetIdAddr();
+ /// @brief Essential steps requires to benchmark host reservation retrieval
+ /// using get6(prefix, len) call.
void benchGet6Prefix();
/// Pointer to the host backend being benchmarked
namespace dhcp {
namespace bench {
-/// @defgroup memfile_params Benchmark parameters that define boundary values
-/// for benchmarks.
-///
-/// The range is defined as 512..65533. Google benchmark will pick a few specifc
-/// values: 512, 4096, 32768, 65533.
-
-/// @{
-
-/// @brief A minimum number of leases used in a benchmark
-constexpr size_t MIN_LEASE_COUNT = 512;
-/// @brief A maximum number of leases used in a benchmark
-constexpr size_t MAX_LEASE_COUNT = 0xfffd;
-/// @brief A time unit used - all results to be expressed in us (microseconds)
-constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
-
-/// @}
-
/// @brief A base class for a fixture for specific lease manager benchmarks
class GenericLeaseMgrBenchmark : public benchmark::Fixture {
public:
#include <config.h>
#include <dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h>
+#include <dhcpsrv/benchmarks/parameters.h>
#include <dhcpsrv/memfile_lease_mgr.h>
#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 isc::dhcp::LeaseMgrFactory;
-using isc::dhcp::bench::GenericLeaseMgrBenchmark;
namespace {
#include <config.h>
#include <dhcpsrv/benchmarks/generic_host_data_source_benchmark.h>
+#include <dhcpsrv/benchmarks/parameters.h>
#include <dhcpsrv/host_data_source_factory.h>
#include <dhcpsrv/testutils/mysql_schema.h>
#include <iostream>
-using isc::dhcp::bench::GenericHostDataSourceBenchmark;
-using isc::dhcp::test::createMySQLSchema;
-using isc::dhcp::test::destroyMySQLSchema;
-using isc::dhcp::HostDataSourceFactory;
-using isc::dhcp::test::validMySQLConnectionString;
-using std::cerr;
-using std::endl;
+using namespace isc::dhcp::bench;
+using namespace isc::dhcp::test;
+using namespace isc::dhcp;
+using namespace std;
namespace {
+/// @brief This is a fixture class used for benchmarking MySQL host backend
class MySqlHostDataSourceBenchmark : public GenericHostDataSourceBenchmark {
public:
+
+ /// @brief Setup routine.
+ ///
+ /// It cleans up schema and recreates tables, then instantiates LeaseMgr
void SetUp(::benchmark::State const&) override {
destroyMySQLSchema(false);
createMySQLSchema(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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, 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(MySqlHostDataSourceBenchmark, get6Prefix)(benchmark::State& state) {
const size_t host_count = state.range(0);
while (state.KeepRunning()) {
}
}
-constexpr size_t MIN_HOST_COUNT = 512;
-constexpr size_t MAX_HOST_COUNT = 0xfffd;
-constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
-
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, insertHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, updateHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAllByHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAll)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAllv4Resv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6SubnetIdAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6Prefix)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts insertion.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, insertHosts)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts update.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, updateHosts)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by getAll(hw-addr, duid) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAllByHWAddrDuid)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by getAll4(hw-addr, duid) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAll)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by getAll(v4-reservation) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAllv4Resv)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get4(subnet-id, hw-addr, duid) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get4(identifier-type, identifier, subnet-id) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4IdentifierSubnetId)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get4(subnet-id, v4-reservation) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(subnet-id, duid, hw-addr) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(subnet-id, identifier-type, identifier) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6IdentifierSubnetId)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(subnet-id, ip-address) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6SubnetIdAddr)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(ip-prefix, prefix-len) call.
+BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6Prefix)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
} // namespace
#include <config.h>
#include <dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h>
+#include <dhcpsrv/benchmarks/parameters.h>
#include <dhcpsrv/lease_mgr_factory.h>
#include <dhcpsrv/testutils/mysql_schema.h>
using namespace isc::dhcp::bench;
using namespace isc::dhcp::test;
+using namespace isc::dhcp;
using namespace std;
-using isc::dhcp::LeaseMgrFactory;
-//using isc::dhcp::bench::GenericLeaseMgrBenchmark;
namespace {
--- /dev/null
+// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef BENCHMARKS_PARAMETERS_H
+#define BENCHMARKS_PARAMETERS_H
+
+#include <benchmark/benchmark.h>
+
+namespace isc {
+namespace dhcp {
+namespace bench {
+
+/// @defgroup benchmark_params Benchmark parameters that define boundary values
+/// for benchmarks.
+///
+/// The range is defined as 512..65533. Google benchmark will pick a few specifc
+/// values: 512, 4096, 32768, 65533.
+
+/// @{
+
+/// @brief A minimum number of leases used in a benchmark
+constexpr size_t MIN_LEASE_COUNT = 512;
+/// @brief A maximum number of leases used in a benchmark
+constexpr size_t MAX_LEASE_COUNT = 0xfffd;
+
+ /// @brief A minimum number of leases used in a benchmark
+constexpr size_t MIN_HOST_COUNT = 512;
+/// @brief A maximum number of leases used in a benchmark
+constexpr size_t MAX_HOST_COUNT = 0xfffd;
+
+/// @brief A time unit used - all results to be expressed in us (microseconds)
+constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
+
+/// @}
+
+};
+};
+};
+
+#endif
#include <config.h>
#include <dhcpsrv/benchmarks/generic_host_data_source_benchmark.h>
+#include <dhcpsrv/benchmarks/parameters.h>
#include <dhcpsrv/host_data_source_factory.h>
#include <dhcpsrv/testutils/pgsql_schema.h>
-
#include <iostream>
-using isc::dhcp::bench::GenericHostDataSourceBenchmark;
-using isc::dhcp::test::createPgSQLSchema;
-using isc::dhcp::test::destroyPgSQLSchema;
-using isc::dhcp::HostDataSourceFactory;
-using isc::dhcp::test::validPgSQLConnectionString;
-using std::cerr;
-using std::endl;
+using namespace isc::dhcp::bench;
+using namespace isc::dhcp::test;
+using namespace isc::dhcp;
+using namespace std;
namespace {
}
}
-constexpr size_t MIN_HOST_COUNT = 512;
-constexpr size_t MAX_HOST_COUNT = 0xfffd;
-constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
-
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, insertHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, updateHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAllByHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAll)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAllv4Resv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6SubnetIdAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
-BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6Prefix)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts insertion.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, insertHosts)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts update.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, updateHosts)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by getAll(hw-addr, duid) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAllByHWAddrDuid)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by getAll4(hw-addr, duid) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAll)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by getAll(v4-reservation) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAllv4Resv)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get4(subnet-id, hw-addr, duid) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get4(identifier-type, identifier, subnet-id) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4IdentifierSubnetId)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get4(subnet-id, v4-reservation) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(subnet-id, duid, hw-addr) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(subnet-id, identifier-type, identifier) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6IdentifierSubnetId)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(subnet-id, ip-address) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6SubnetIdAddr)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
+
+/// Defines parameters necessary for running a benchmark that measures
+/// hosts retrieval by get6(ip-prefix, prefix-len) call.
+BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6Prefix)
+ ->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
} // namespace
#include <config.h>
#include <dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h>
+#include <dhcpsrv/benchmarks/parameters.h>
#include <dhcpsrv/lease_mgr_factory.h>
#include <dhcpsrv/testutils/pgsql_schema.h>
using namespace isc::dhcp::bench;
-using isc::dhcp::LeaseMgrFactory;
-using isc::dhcp::bench::GenericLeaseMgrBenchmark;
-using isc::dhcp::test::createPgSQLSchema;
-using isc::dhcp::test::destroyPgSQLSchema;
-using isc::dhcp::test::validPgSQLConnectionString;
-using std::cerr;
-using std::endl;
+using namespace isc::dhcp;
+using namespace isc::dhcp::test;
+using namespace std;
namespace {