Kea  1.5.0
isc::dhcp::bench::GenericHostDataSourceBenchmark Class Reference

Base fixture class for benchmarking host backends. More...

#include <generic_host_data_source_benchmark.h>

+ Inheritance diagram for isc::dhcp::bench::GenericHostDataSourceBenchmark:

Public Types

enum  AddedOptions { DHCP4_ONLY, DHCP6_ONLY, DHCP4_AND_DHCP6 }
 Defines what kind of options should be added for a host. More...
 
enum  Universe { V4, V6 }
 Defines universe (IPv4 or IPv6) More...
 

Public Member Functions

 GenericHostDataSourceBenchmark ()
 Constructor. More...
 
virtual ~GenericHostDataSourceBenchmark ()
 Destructor. More...
 
void addTestOptions (const HostPtr &host, const bool formatted, const AddedOptions &added_options) const
 Adds several v4 and/or v6 options to the host. More...
 
void benchGet4BySubnetHWAddrDuid ()
 Essential steps requires to benchmark host reservation retrieval using getAll(hw-addr, duid) call. More...
 
void benchGet4IdentifierSubnetId ()
 Essential steps requires to benchmark host reservation retrieval using getAll(identifier-type, identifier, subnet-id) call. More...
 
void benchGet4SubnetIdv4Resrv ()
 Essential steps requires to benchmark host reservation retrieval using getAll(v4-reservation) call. More...
 
void benchGet6IdentifierSubnetId ()
 Essential steps requires to benchmark host reservation retrieval using get6(identifier-type, identifier, subnet-id) call. More...
 
void benchGet6Prefix ()
 Essential steps requires to benchmark host reservation retrieval using get6(prefix, len) call. More...
 
void benchGet6SubnetIdAddr ()
 Essential steps requires to benchmark host reservation retrieval using get6(ip-addr, subnet-id) call. More...
 
void benchGet6SubnetIdDuidHWAddr ()
 Essential steps requires to benchmark host reservation retrieval using get6(subnet-id, duid, hw-addr) call. More...
 
void benchGetAll ()
 Essential steps required to benchmark the getAll(identifier-type, identifier) call. More...
 
void benchGetAllByHWAddrDuid ()
 
template<typename OptionType >
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. More...
 
OptionDescriptor createEmptyOption (const Option::Universe &universe, const uint16_t option_type, const bool persist) const
 Creates a generic option with specific parameters. More...
 
template<typename OptionType , typename DataType >
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. More...
 
OptionDescriptor createVendorOption (const Option::Universe &universe, const bool persist, const bool formatted, const uint32_t vendor_id) const
 creates a vendor-option More...
 
void getAllv4Resv ()
 Essential steps required to benchmark host reservation retrieval using getAll(ipv4-reservation) call. More...
 
void insertHosts ()
 Inserts all hosts stored in hosts_ into the benchmarked host backend. More...
 
void prepareHosts (size_t const &host_count)
 Creates specified number of hosts and stores them in hosts_. More...
 
void setUp (::benchmark::State &state, size_t const &host_count)
 Sets up timers, creates and inserts hosts. More...
 
void setUpWithInserts (::benchmark::State &state, size_t const &host_count)
 Sets up the benchmark with specified number of hosts. More...
 
void updateHosts ()
 Updates all hosts stored in hosts_ in the benchmarked host backend. More...
 

Public Attributes

HostDataSourcePtr hdsptr_
 Pointer to the host backend being benchmarked. More...
 
HostCollection hosts_
 Store hosts being used during benchmark. More...
 

Detailed Description

Base fixture class for benchmarking host backends.

Definition at line 31 of file generic_host_data_source_benchmark.h.

Member Enumeration Documentation

◆ AddedOptions

Defines what kind of options should be added for a host.

Enumerator
DHCP4_ONLY 

DHCPv4-only options.

DHCP6_ONLY 

DHCPv6-only options.

DHCP4_AND_DHCP6 

Both DHCPv4 and DHCPv6 options.

Definition at line 38 of file generic_host_data_source_benchmark.h.

◆ Universe

Defines universe (IPv4 or IPv6)

Enumerator
V4 
V6 

Definition at line 35 of file generic_host_data_source_benchmark.h.

Constructor & Destructor Documentation

◆ GenericHostDataSourceBenchmark()

isc::dhcp::bench::GenericHostDataSourceBenchmark::GenericHostDataSourceBenchmark ( )

Constructor.

Clears runtime option definitions.

Definition at line 43 of file generic_host_data_source_benchmark.cc.

References isc::dhcp::LibDHCP::clearRuntimeOptionDefs().

+ Here is the call graph for this function:

◆ ~GenericHostDataSourceBenchmark()

isc::dhcp::bench::GenericHostDataSourceBenchmark::~GenericHostDataSourceBenchmark ( )
virtual

Destructor.

Clears runtime option definitions and clears hdsptr_ pointer.

Definition at line 48 of file generic_host_data_source_benchmark.cc.

References isc::dhcp::LibDHCP::clearRuntimeOptionDefs(), and hdsptr_.

+ Here is the call graph for this function:

Member Function Documentation

◆ addTestOptions()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::addTestOptions ( const HostPtr host,
const bool  formatted,
const AddedOptions added_options 
) const

Adds several v4 and/or v6 options to the host.

Parameters
hosthost reservation to be extended with options
formattedwhether to generate text representation
added_optionsv4, v6 or both

Definition at line 100 of file generic_host_data_source_benchmark.cc.

References isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::addItem(), createEmptyOption(), createVendorOption(), D6O_BOOTFILE_URL, D6O_INFORMATION_REFRESH_TIME, DHCP4_AND_DHCP6, DHCP4_ONLY, DHCP4_OPTION_SPACE, DHCP6_ONLY, DHCP6_OPTION_SPACE, isc::dhcp::DHO_BOOT_FILE_NAME, isc::dhcp::DHO_DEFAULT_IP_TTL, isc::dhcp::LibDHCP::setRuntimeOptionDefs(), isc::dhcp::Option::V4, and isc::dhcp::Option::V6.

Referenced by prepareHosts().

+ Here is the call graph for this function:

◆ benchGet4BySubnetHWAddrDuid()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::benchGet4BySubnetHWAddrDuid ( )

Essential steps requires to benchmark host reservation retrieval using getAll(hw-addr, duid) call.

Definition at line 216 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ benchGet4IdentifierSubnetId()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::benchGet4IdentifierSubnetId ( )

Essential steps requires to benchmark host reservation retrieval using getAll(identifier-type, identifier, subnet-id) call.

Definition at line 225 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ benchGet4SubnetIdv4Resrv()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::benchGet4SubnetIdv4Resrv ( )

Essential steps requires to benchmark host reservation retrieval using getAll(v4-reservation) call.

Definition at line 234 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ benchGet6IdentifierSubnetId()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::benchGet6IdentifierSubnetId ( )

Essential steps requires to benchmark host reservation retrieval using get6(identifier-type, identifier, subnet-id) call.

Definition at line 249 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ benchGet6Prefix()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::benchGet6Prefix ( )

Essential steps requires to benchmark host reservation retrieval using get6(prefix, len) call.

Definition at line 266 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ benchGet6SubnetIdAddr()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::benchGet6SubnetIdAddr ( )

Essential steps requires to benchmark host reservation retrieval using get6(ip-addr, subnet-id) call.

Definition at line 258 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ benchGet6SubnetIdDuidHWAddr()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::benchGet6SubnetIdDuidHWAddr ( )

Essential steps requires to benchmark host reservation retrieval using get6(subnet-id, duid, hw-addr) call.

Definition at line 241 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ benchGetAll()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::benchGetAll ( )

Essential steps required to benchmark the getAll(identifier-type, identifier) call.

Definition at line 201 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ benchGetAllByHWAddrDuid()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::benchGetAllByHWAddrDuid ( )

Definition at line 193 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ createAddressOption()

template<typename OptionType >
OptionDescriptor isc::dhcp::bench::GenericHostDataSourceBenchmark::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
inline

Creates an option with addresses.

Template Parameters
OptionTypespecifies a class to be instantiated
Parameters
option_typecode of the option
persistwhether the option should always be included (yes) or not (no)
formattedwhether the value passed to description should be converted to text
address1first address to be used (optional)
address2second address to be used (optional)
address3third address to be used (optional)
Returns
the option created wrapped in an option descriptor structure

Definition at line 103 of file generic_host_data_source_benchmark.h.

◆ createEmptyOption()

OptionDescriptor isc::dhcp::bench::GenericHostDataSourceBenchmark::createEmptyOption ( const Option::Universe universe,
const uint16_t  option_type,
const bool  persist 
) const

Creates a generic option with specific parameters.

Parameters
universe(v4 or v6)
option_typecode of the option
persistwhether the option should always be included (yes) or not (no)
Returns
the option created wrapped in an option descriptor structure

Definition at line 73 of file generic_host_data_source_benchmark.cc.

Referenced by addTestOptions().

◆ createOption()

template<typename OptionType , typename DataType >
OptionDescriptor isc::dhcp::bench::GenericHostDataSourceBenchmark::createOption ( const Option::Universe universe,
const uint16_t  option_type,
const bool  persist,
const bool  formatted,
const DataType &  value 
) const
inline

Creates an option of specified type and value.

Template Parameters
OptionTypeOption class to be instantiated
DataTypetype of parameter to be passed to OptionType constructor
Parameters
universe(v4 or v6)
option_typecode of the option
persistwhether the option should always be included (yes) or not (no)
formattedwhether the value passed to description should be converted to text
valueoption value
Returns
the option created wrapped in an option descriptor structure

Definition at line 75 of file generic_host_data_source_benchmark.h.

◆ createVendorOption()

OptionDescriptor isc::dhcp::bench::GenericHostDataSourceBenchmark::createVendorOption ( const Option::Universe universe,
const bool  persist,
const bool  formatted,
const uint32_t  vendor_id 
) const

creates a vendor-option

Parameters
universe(v4 or v6)
persistwhether the option should always be included
formattedwhether the value passed to description should be converted to text
vendor_id32-unsigned bit enterprise-id
Returns
the option created wrapped in an option descriptor structure

Definition at line 82 of file generic_host_data_source_benchmark.cc.

Referenced by addTestOptions().

◆ getAllv4Resv()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::getAllv4Resv ( )

Essential steps required to benchmark host reservation retrieval using getAll(ipv4-reservation) call.

Definition at line 209 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

◆ insertHosts()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::insertHosts ( )

Inserts all hosts stored in hosts_ into the benchmarked host backend.

Definition at line 179 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

Referenced by setUpWithInserts().

◆ prepareHosts()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::prepareHosts ( size_t const &  host_count)

Creates specified number of hosts and stores them in hosts_.

Parameters
host_countnumber of hosts to be created

Definition at line 158 of file generic_host_data_source_benchmark.cc.

References addTestOptions(), DHCP4_AND_DHCP6, hosts_, and isc::dhcp::Host::IDENT_HWADDR.

Referenced by setUp(), and setUpWithInserts().

+ Here is the call graph for this function:

◆ setUp()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::setUp ( ::benchmark::State &  state,
size_t const &  host_count 
)

Sets up timers, creates and inserts hosts.

Parameters
statereference to the state of the benchmark
host_countnumber of hosts to be created

Definition at line 54 of file generic_host_data_source_benchmark.cc.

References prepareHosts().

+ Here is the call graph for this function:

◆ setUpWithInserts()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::setUpWithInserts ( ::benchmark::State &  state,
size_t const &  host_count 
)

Sets up the benchmark with specified number of hosts.

Parameters
statereference to the state of the benchmark
host_countnumber of hosts to be created

Definition at line 63 of file generic_host_data_source_benchmark.cc.

References insertHosts(), and prepareHosts().

+ Here is the call graph for this function:

◆ updateHosts()

void isc::dhcp::bench::GenericHostDataSourceBenchmark::updateHosts ( )

Updates all hosts stored in hosts_ in the benchmarked host backend.

Definition at line 186 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

Member Data Documentation

◆ hdsptr_

◆ hosts_


The documentation for this class was generated from the following files: