 |
Kea
1.5.0
|
Go to the documentation of this file.
18 #ifndef GENERIC_HOST_DATA_SOURCE_UNITTEST_H
19 #define GENERIC_HOST_DATA_SOURCE_UNITTEST_H
21 #include <benchmark/benchmark.h>
61 const uint16_t option_type,
62 const bool persist)
const;
74 template <
typename OptionType,
typename DataType>
76 const uint16_t option_type,
79 const DataType& value)
const {
80 boost::shared_ptr<Option> option(
new OptionType(universe, option_type, value));
101 template <
typename OptionType>
104 const bool formatted,
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;
168 void setUp(::benchmark::State& state,
size_t const& host_count);
HostCollection hosts_
Store hosts being used during benchmark.
@ DHCP6_ONLY
DHCPv6-only options.
void benchGetAllByHWAddrDuid()
The IOAddress class represents an IP addresses (version agnostic)
void benchGet4BySubnetHWAddrDuid()
Essential steps requires to benchmark host reservation retrieval using getAll(hw-addr,...
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.
void benchGet6SubnetIdDuidHWAddr()
Essential steps requires to benchmark host reservation retrieval using get6(subnet-id,...
void benchGetAll()
Essential steps required to benchmark the getAll(identifier-type, identifier) call.
void setUpWithInserts(::benchmark::State &state, size_t const &host_count)
Sets up the benchmark with specified number of hosts.
void benchGet6IdentifierSubnetId()
Essential steps requires to benchmark host reservation retrieval using get6(identifier-type,...
void updateHosts()
Updates all hosts stored in hosts_ in the benchmarked host backend.
void insertHosts()
Inserts all hosts stored in hosts_ into the benchmarked host backend.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
OptionDescriptor createVendorOption(const Option::Universe &universe, const bool persist, const bool formatted, const uint32_t vendor_id) const
creates a vendor-option
Base fixture class for benchmarking host backends.
@ DHCP4_AND_DHCP6
Both DHCPv4 and DHCPv6 options.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void prepareHosts(size_t const &host_count)
Creates specified number of hosts and stores them in hosts_.
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.
void benchGet6SubnetIdAddr()
Essential steps requires to benchmark host reservation retrieval using get6(ip-addr,...
Universe
Defines universe (IPv4 or IPv6)
@ DHCP4_ONLY
DHCPv4-only options.
void getAllv4Resv()
Essential steps required to benchmark host reservation retrieval using getAll(ipv4-reservation) call.
AddedOptions
Defines what kind of options should be added for a host.
HostDataSourcePtr hdsptr_
Pointer to the host backend being benchmarked.
void addTestOptions(const HostPtr &host, const bool formatted, const AddedOptions &added_options) const
Adds several v4 and/or v6 options to the host.
boost::shared_ptr< BaseHostDataSource > HostDataSourcePtr
HostDataSource pointer.
OptionDescriptor createEmptyOption(const Option::Universe &universe, const uint16_t option_type, const bool persist) const
Creates a generic option with specific parameters.
void setUp(::benchmark::State &state, size_t const &host_count)
Sets up timers, creates and inserts hosts.
Universe
defines option universe DHCPv4 or DHCPv6
void benchGet4SubnetIdv4Resrv()
Essential steps requires to benchmark host reservation retrieval using getAll(v4-reservation) call.
void benchGet6Prefix()
Essential steps requires to benchmark host reservation retrieval using get6(prefix,...
void benchGet4IdentifierSubnetId()
Essential steps requires to benchmark host reservation retrieval using getAll(identifier-type,...
virtual ~GenericHostDataSourceBenchmark()
Destructor.
GenericHostDataSourceBenchmark()
Constructor.
std::vector< HostPtr > HostCollection
Collection of the Host objects.