Kea  1.9.9-git
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 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 benchGetAll ()
 Essential steps required to benchmark the getAll(identifier-type, identifier) call. More...
 
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...
 

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

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 37 of file generic_host_data_source_benchmark.h.

Defines universe (IPv4 or IPv6)

Enumerator
V4 
V6 

Definition at line 34 of file generic_host_data_source_benchmark.h.

Constructor & Destructor Documentation

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:

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

Destructor.

Clears runtime option definitions and clears hdsptr_ pointer.

Definition at line 47 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

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 98 of file generic_host_data_source_benchmark.cc.

References isc::dhcp::OptionDefSpaceContainer::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:

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 207 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

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

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

Definition at line 216 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

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 223 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

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

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

Definition at line 240 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

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

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

Definition at line 232 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

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

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

Definition at line 192 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

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 101 of file generic_host_data_source_benchmark.h.

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 71 of file generic_host_data_source_benchmark.cc.

Referenced by addTestOptions().

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 74 of file generic_host_data_source_benchmark.h.

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 80 of file generic_host_data_source_benchmark.cc.

Referenced by addTestOptions().

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

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

Definition at line 200 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

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

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

Definition at line 185 of file generic_host_data_source_benchmark.cc.

References hdsptr_, and hosts_.

Referenced by setUpWithInserts().

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 164 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:

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 53 of file generic_host_data_source_benchmark.cc.

References prepareHosts().

+ Here is the call graph for this function:

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 61 of file generic_host_data_source_benchmark.cc.

References insertHosts(), and prepareHosts().

+ Here is the call graph for this function:

Member Data Documentation

HostDataSourcePtr isc::dhcp::bench::GenericHostDataSourceBenchmark::hdsptr_
HostCollection isc::dhcp::bench::GenericHostDataSourceBenchmark::hosts_

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