18 #ifndef GENERIC_HOST_DATA_SOURCE_UNITTEST_H
19 #define GENERIC_HOST_DATA_SOURCE_UNITTEST_H
21 #include <benchmark/benchmark.h>
60 const uint16_t option_type,
61 const bool persist)
const;
73 template <
typename OptionType,
typename DataType>
75 const uint16_t option_type,
78 const DataType& value)
const {
79 boost::shared_ptr<Option> option(
new OptionType(universe, option_type, value));
100 template <
typename OptionType>
103 const bool formatted,
104 const std::string& address1 =
"",
105 const std::string& address2 =
"",
106 const std::string& address3 =
"")
const {
108 std::ostringstream s;
110 typename OptionType::AddressContainer addresses;
111 if (!address1.empty()) {
118 if (!address2.empty()) {
121 if (s.tellp() != std::streampos(0)) {
128 if (!address3.empty()) {
131 if (s.tellp() != std::streampos(0)) {
138 boost::shared_ptr<OptionType> option(
new OptionType(option_type, addresses));
153 const bool formatted,
154 const uint32_t vendor_id)
const;
162 const bool formatted,
169 void setUp(::benchmark::State& state,
size_t const& host_count);
OptionDescriptor createAddressOption(const uint16_t option_type, const bool persist, const bool formatted, const std::string &address1="", const std::string &address2="", const std::string &address3="") const
Creates an option with addresses.
OptionDescriptor createOption(const Option::Universe &universe, const uint16_t option_type, const bool persist, const bool formatted, const DataType &value) const
Creates an option of specified type and value.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
void benchGetAll()
Essential steps required to benchmark the getAll(identifier-type, identifier) call.
Universe
defines option universe DHCPv4 or DHCPv6
std::vector< HostPtr > HostCollection
Collection of the Host objects.
void benchGet4SubnetIdv4Resrv()
Essential steps requires to benchmark host reservation retrieval using getAll(v4-reservation) call...
AddedOptions
Defines what kind of options should be added for a host.
boost::shared_ptr< BaseHostDataSource > HostDataSourcePtr
HostDataSource pointer.
HostDataSourcePtr hdsptr_
Pointer to the host backend being benchmarked.
OptionDescriptor createVendorOption(const Option::Universe &universe, const bool persist, const bool formatted, const uint32_t vendor_id) const
creates a vendor-option
void setUpWithInserts(::benchmark::State &state, size_t const &host_count)
Sets up the benchmark with specified number of hosts.
void benchGet4IdentifierSubnetId()
Essential steps requires to benchmark host reservation retrieval using getAll(identifier-type, identifier, subnet-id) call.
OptionDescriptor createEmptyOption(const Option::Universe &universe, const uint16_t option_type, const bool persist) const
Creates a generic option with specific parameters.
void prepareHosts(size_t const &host_count)
Creates specified number of hosts and stores them in hosts_.
void insertHosts()
Inserts all hosts stored in hosts_ into the benchmarked host backend.
void benchGet6IdentifierSubnetId()
Essential steps requires to benchmark host reservation retrieval using get6(identifier-type, identifier, subnet-id) call.
Universe
Defines universe (IPv4 or IPv6)
void addTestOptions(const HostPtr &host, const bool formatted, const AddedOptions &added_options) const
Adds several v4 and/or v6 options to the host.
HostCollection hosts_
Store hosts being used during benchmark.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Both DHCPv4 and DHCPv6 options.
void benchGet6SubnetIdAddr()
Essential steps requires to benchmark host reservation retrieval using get6(ip-addr, subnet-id) call.
GenericHostDataSourceBenchmark()
Constructor.
virtual ~GenericHostDataSourceBenchmark()
Destructor.
Base fixture class for benchmarking host backends.
void getAllv4Resv()
Essential steps required to benchmark host reservation retrieval using getAll(ipv4-reservation) call...
The IOAddress class represents an IP addresses (version agnostic)
void setUp(::benchmark::State &state, size_t const &host_count)
Sets up timers, creates and inserts hosts.
void benchGet6Prefix()
Essential steps requires to benchmark host reservation retrieval using get6(prefix, len) call.