Kea: isc::perfdhcp::StatsMgr Class Reference

| Kea 3.0.2-git

isc::perfdhcp::StatsMgr Class Reference

Statistics Manager. More...

`#include <stats_mgr.h>`

Inheritance diagram for isc::perfdhcp::StatsMgr:
[legend]

## Public Member Functions
| StatsMgr (CommandOptions &options)
| Constructor.
void | addCustomCounter (const std::string &short_name, const std::string &long_name)
| Add named custom uint64 counter.
void | addExchangeStats (const ExchangeType xchg_type, const double drop_time=-1)
| Specify new exchange type.
bool | droppedPackets () const
| Check if any packet drops occurred.
double | getAvgDelay (const ExchangeType xchg_type) const
| Return average packet delay.
double | getAvgUnorderedLookupSetSize (const ExchangeType xchg_type) const
| Return average unordered lookup set size.
uint64_t | getCollectedNum (const ExchangeType xchg_type) const
| Return number of garbage collected packets.
CustomCounterPtr | getCounter (const std::string &counter_key)
| Return specified counter.
uint64_t | getDroppedPacketsNum (const ExchangeType xchg_type) const
| Return total number of dropped packets.
double | getMaxDelay (const ExchangeType xchg_type) const
| Return maximum delay between sent and received packet.
double | getMinDelay (const ExchangeType xchg_type) const
| Return minimum delay between sent and received packet.
uint64_t | getNonUniqueAddrNum (const ExchangeType xchg_type) const
| Return total number of non unique addresses.
uint64_t | getOrderedLookups (const ExchangeType xchg_type) const
| Return number of ordered sent packets lookups.
uint64_t | getOrphans (const ExchangeType xchg_type) const
| Return number of orphan packets.
uint64_t | getRcvdPacketsNum (const ExchangeType xchg_type) const
| Return total number of received packets.
uint64_t | getRejLeasesNum (const ExchangeType xchg_type) const
| Return total number of rejected leases.
std::tuple< typename ExchangeStats::PktListIterator, typename ExchangeStats::PktListIterator > | getSentPackets (const ExchangeType xchg_type) const
uint64_t | getSentPacketsNum (const ExchangeType xchg_type) const
| Return total number of sent packets.
double | getStdDevDelay (const ExchangeType xchg_type) const
| Return standard deviation of packet delay.
boost::posix_time::time_period | getTestPeriod () const
| Get time period since the start of test.
uint64_t | getUnorderedLookups (const ExchangeType xchg_type) const
| Return number of unordered sent packets lookups.
bool | hasExchangeStats (const ExchangeType xchg_type) const
| Check if the exchange type has been specified.
const CustomCounter & | incrementCounter (const std::string &counter_key, const uint64_t value=1)
| Increment specified counter.
dhcp::PktPtr | passRcvdPacket (const ExchangeType xchg_type, const dhcp::PktPtr &packet)
| Add new received packet and match with sent packet.
void | passSentPacket (const ExchangeType xchg_type, const dhcp::PktPtr &packet)
| Adds new packet to the sent packets list.
void | printCustomCounters () const
| Print names and values of custom counters.
void | printIntermediateStats (bool clean_report, std::string clean_sep) const
| Print intermediate statistics.
void | printLeases () const
| Delegate to all exchanges to print their leases.
void | printStats () const
| Print statistics counters for all exchange types.
void | printTimestamps () const
| Print timestamps of all packets.
void | updateNonUniqueAddrNum (const ExchangeType xchg_type)
| Increase total number of non unique addresses.
void | updateRejLeases (const ExchangeType xchg_type)
| Increase total number of rejected leases.

## Detailed Description

Statistics Manager.

This class template is a storage for various performance statistics collected during performance tests execution with perfdhcp tool.

Statistics Manager holds lists of sent and received packets and groups them into exchanges. For example: DHCPDISCOVER message and corresponding DHCPOFFER messages belong to one exchange, DHCPREQUEST and corresponding DHCPACK message belong to another exchange etc. In order to update statistics for a particular exchange type, client class passes sent and received packets. Internally, Statistics Manager tries to match transaction id of received packet with sent packet stored on the list of sent packets. When packets are matched the round trip time can be calculated.

Definition at line 712 of file bin/perfdhcp/stats_mgr.h.

## Constructor & Destructor Documentation

## ◆ StatsMgr()

isc::perfdhcp::StatsMgr::StatsMgr | ( | CommandOptions & | options | ) |

Constructor.

This constructor by default disables packets archiving mode. In this mode all packets from the list of sent packets are moved to list of archived packets once they have been matched with received packets. This is required if it has been selected from the command line to print timestamps for all packets after the test. If this is not selected archiving should be disabled for performance reasons and to avoid waste of memory for storing large list of archived packets.

Definition at line 353 of file bin/perfdhcp/stats_mgr.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::getReleaseRate(), isc::perfdhcp::CommandOptions::getRenewRate(), if(), and isc::perfdhcp::CommandOptions::testDiags().

Here is the call graph for this function:

## Member Function Documentation

## ◆ addCustomCounter()

void isc::perfdhcp::StatsMgr::addCustomCounter | ( | const std::string & | short_name,
|  | const std::string & | long_name )
| inline

Add named custom uint64 counter.

Method creates new named counter and stores in counter's map under key specified here as short_name.

Parameters

  short_name | key to use to access counter in the map.
  long_name | name of the counter presented in the log file.

Definition at line 769 of file bin/perfdhcp/stats_mgr.h.

References isc_throw.

## ◆ addExchangeStats()

void isc::perfdhcp::StatsMgr::addExchangeStats | ( | const ExchangeType | xchg_type,
|  | const double | drop_time = -1 )
| inline

Specify new exchange type.

This method creates new ExchangeStats object that will collect statistics data from packets exchange of the specified type.

Parameters

  xchg_type | exchange type.
  drop_time | maximum time elapsed before packet is assumed dropped. Negative value disables it.

Exceptions

  isc::BadValue | if exchange of specified type exists.

Definition at line 736 of file bin/perfdhcp/stats_mgr.h.

References isc_throw.

## ◆ droppedPackets()

bool isc::perfdhcp::StatsMgr::droppedPackets | ( |  | ) | const
| inline

Check if any packet drops occurred.

Definition at line 782 of file bin/perfdhcp/stats_mgr.h.

Referenced by isc::perfdhcp::BasicScen::run().

## ◆ getAvgDelay()

double isc::perfdhcp::StatsMgr::getAvgDelay | ( | const ExchangeType | xchg_type | ) | const
| inline

Return average packet delay.

Method returns average packet delay for specified exchange type.

Returns
  average packet delay.

Definition at line 897 of file bin/perfdhcp/stats_mgr.h.

## ◆ getAvgUnorderedLookupSetSize()

double isc::perfdhcp::StatsMgr::getAvgUnorderedLookupSetSize | ( | const ExchangeType | xchg_type | ) | const
| inline

Return average unordered lookup set size.

Method returns average unordered lookup set size. This value changes every time ExchangeStats::matchPackets function performs unordered packet lookup.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  average unordered lookup set size.

Definition at line 935 of file bin/perfdhcp/stats_mgr.h.

## ◆ getCollectedNum()

uint64_t isc::perfdhcp::StatsMgr::getCollectedNum | ( | const ExchangeType | xchg_type | ) | const
| inline

Return number of garbage collected packets.

Method returns number of garbage collected timed out packets. Packet is assumed timed out when duration between sending it to server and receiving server's response is greater than value specified with -d<value> command line argument.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  number of garbage collected packets.

Definition at line 1020 of file bin/perfdhcp/stats_mgr.h.

## ◆ getCounter()

CustomCounterPtr isc::perfdhcp::StatsMgr::getCounter | ( | const std::string & | counter_key | ) |
| inline

Return specified counter.

Method returns specified counter.

Parameters

  counter_key | key pointing to the counter in the counters map. The short counter name has to be used to access counter.

Returns
  pointer to specified counter object.

Definition at line 798 of file bin/perfdhcp/stats_mgr.h.

References isc_throw.

Referenced by incrementCounter().

## ◆ getDroppedPacketsNum()

uint64_t isc::perfdhcp::StatsMgr::getDroppedPacketsNum | ( | const ExchangeType | xchg_type | ) | const
| inline

Return total number of dropped packets.

Method returns total number of dropped packets for specified exchange type.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  number of dropped packets.

Definition at line 1005 of file bin/perfdhcp/stats_mgr.h.

Referenced by isc::perfdhcp::BasicScen::checkExitConditions().

## ◆ getMaxDelay()

double isc::perfdhcp::StatsMgr::getMaxDelay | ( | const ExchangeType | xchg_type | ) | const
| inline

Return maximum delay between sent and received packet.

Method returns maximum delay between sent and received packet for specified exchange type.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  maximum delay between packets.

Definition at line 886 of file bin/perfdhcp/stats_mgr.h.

## ◆ getMinDelay()

double isc::perfdhcp::StatsMgr::getMinDelay | ( | const ExchangeType | xchg_type | ) | const
| inline

Return minimum delay between sent and received packet.

Method returns minimum delay between sent and received packet for specified exchange type.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  minimum delay between packets.

Definition at line 873 of file bin/perfdhcp/stats_mgr.h.

## ◆ getNonUniqueAddrNum()

uint64_t isc::perfdhcp::StatsMgr::getNonUniqueAddrNum | ( | const ExchangeType | xchg_type | ) | const
| inline

Return total number of non unique addresses.

Method returns total number of non unique addresses and/or prefixes for specified exchange type.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  number of non unique addresses.

Definition at line 1064 of file bin/perfdhcp/stats_mgr.h.

## ◆ getOrderedLookups()

uint64_t isc::perfdhcp::StatsMgr::getOrderedLookups | ( | const ExchangeType | xchg_type | ) | const
| inline

Return number of ordered sent packets lookups.

Method returns number of ordered sent packet lookups. Ordered lookup is used when packets are received in the same order as they were sent to the server. If packets are skipped or received out of order, lookup function will use unordered lookup (with hash table).

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  number of ordered lookups.

Definition at line 966 of file bin/perfdhcp/stats_mgr.h.

## ◆ getOrphans()

uint64_t isc::perfdhcp::StatsMgr::getOrphans | ( | const ExchangeType | xchg_type | ) | const
| inline

Return number of orphan packets.

Method returns number of orphan packets for specified exchange type.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  number of orphan packets so far.

Definition at line 921 of file bin/perfdhcp/stats_mgr.h.

## ◆ getRcvdPacketsNum()

uint64_t isc::perfdhcp::StatsMgr::getRcvdPacketsNum | ( | const ExchangeType | xchg_type | ) | const
| inline

Return total number of received packets.

Method returns total number of received packets for specified exchange type.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  number of received packets.

Definition at line 992 of file bin/perfdhcp/stats_mgr.h.

## ◆ getRejLeasesNum()

uint64_t isc::perfdhcp::StatsMgr::getRejLeasesNum | ( | const ExchangeType | xchg_type | ) | const
| inline

Return total number of rejected leases.

Method returns total number of rejected leases for specified exchange type.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  number of rejected leases.

Definition at line 1033 of file bin/perfdhcp/stats_mgr.h.

## ◆ getSentPackets()

std::tuple< typename ExchangeStats::PktListIterator, typename ExchangeStats::PktListIterator > isc::perfdhcp::StatsMgr::getSentPackets | ( | const ExchangeType | xchg_type | ) | const
| inline

Definition at line 1207 of file bin/perfdhcp/stats_mgr.h.

Referenced by isc::perfdhcp::AvalancheScen::resendPackets().

## ◆ getSentPacketsNum()

uint64_t isc::perfdhcp::StatsMgr::getSentPacketsNum | ( | const ExchangeType | xchg_type | ) | const
| inline

Return total number of sent packets.

Method returns total number of sent packets for specified exchange type.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  number of sent packets.

Definition at line 979 of file bin/perfdhcp/stats_mgr.h.

Referenced by isc::perfdhcp::BasicScen::checkExitConditions().

## ◆ getStdDevDelay()

double isc::perfdhcp::StatsMgr::getStdDevDelay | ( | const ExchangeType | xchg_type | ) | const
| inline

Return standard deviation of packet delay.

Method returns standard deviation of packet delay for specified exchange type.

Returns
  standard deviation of packet delay.

Definition at line 908 of file bin/perfdhcp/stats_mgr.h.

## ◆ getTestPeriod()

boost::posix_time::time_period isc::perfdhcp::StatsMgr::getTestPeriod | ( |  | ) | const
| inline

Get time period since the start of test.

Calculate dna return period since the test start. This can be specifically helpful when calculating packet exchange rates.

Returns
  test period so far.

Definition at line 1076 of file bin/perfdhcp/stats_mgr.h.

Referenced by isc::perfdhcp::BasicScen::checkExitConditions().

## ◆ getUnorderedLookups()

uint64_t isc::perfdhcp::StatsMgr::getUnorderedLookups | ( | const ExchangeType | xchg_type | ) | const
| inline

Return number of unordered sent packets lookups.

Method returns number of unordered sent packet lookups. Unordered lookup is used when received packet was sent out of order by server - transaction id of received packet does not match transaction id of next sent packet.

Parameters

  xchg_type | exchange type.

Exceptions

  isc::BadValue | if invalid exchange type specified.

Returns
  number of unordered lookups.

Definition at line 950 of file bin/perfdhcp/stats_mgr.h.

## ◆ hasExchangeStats()

bool isc::perfdhcp::StatsMgr::hasExchangeStats | ( | const ExchangeType | xchg_type | ) | const
| inline

Check if the exchange type has been specified.

This method checks if the ExchangeStats object of a particular type exists (has been added using addExchangeStats function).

Parameters

  xchg_type | A type of the exchange being represented by the ExchangeStats object.

Returns
  true if the ExchangeStats object has been added for a specified exchange type.

Definition at line 758 of file bin/perfdhcp/stats_mgr.h.

## ◆ incrementCounter()

const CustomCounter & isc::perfdhcp::StatsMgr::incrementCounter | ( | const std::string & | counter_key,
|  | const uint64_t | value = 1 )
| inline

Increment specified counter.

Increment counter value by one.

Parameters

  counter_key | key pointing to the counter in the counters map.
  value | value to increment counter by.

Returns
  pointer to specified counter after incrementation.

Definition at line 814 of file bin/perfdhcp/stats_mgr.h.

References getCounter().

Referenced by isc::perfdhcp::BasicScen::run().

Here is the call graph for this function:

## ◆ passRcvdPacket()

dhcp::PktPtr isc::perfdhcp::StatsMgr::passRcvdPacket | ( | const ExchangeType | xchg_type,
|  | const dhcp::PktPtr & | packet )
| inline

Add new received packet and match with sent packet.

Method adds new packet to the list of received packets. It also searches for corresponding packet on the list of sent packets. When packets are matched the statistics counters are updated accordingly for the particular exchange type.

Parameters

  xchg_type | exchange type.
  packet | received packet

Exceptions

  isc::BadValue | if invalid exchange type specified or packet is null.
  isc::Unexpected | if corresponding packet was not found on the list of sent packets.

Definition at line 851 of file bin/perfdhcp/stats_mgr.h.

## ◆ passSentPacket()

void isc::perfdhcp::StatsMgr::passSentPacket | ( | const ExchangeType | xchg_type,
|  | const dhcp::PktPtr & | packet )
| inline

Adds new packet to the sent packets list.

Method adds new packet to the sent packets list. Packets are added to the list sequentially and most often read sequentially.

Parameters

  xchg_type | exchange type.
  packet | packet to be added to the list

Exceptions

  isc::BadValue | if invalid exchange type specified or packet is null.

Definition at line 831 of file bin/perfdhcp/stats_mgr.h.

## ◆ printCustomCounters()

void isc::perfdhcp::StatsMgr::printCustomCounters | ( |  | ) | const
| inline

Print names and values of custom counters.

Method prints names and values of custom counters. Custom counters are defined by client class for tracking different statistics.

Exceptions

  isc::InvalidOperation | if no custom counters added for tracking.

Definition at line 1195 of file bin/perfdhcp/stats_mgr.h.

References isc_throw.

## ◆ printIntermediateStats()

void isc::perfdhcp::StatsMgr::printIntermediateStats | ( | bool | clean_report,
|  | std::string | clean_sep ) const
| inline

Print intermediate statistics.

Method prints intermediate statistics for all exchanges. Statistics includes sent, received and dropped packets counters.

Parameters

  clean_report | value to generate easy to parse report.
  clean_sep | string used as separator if clean_report enabled..

Definition at line 1121 of file bin/perfdhcp/stats_mgr.h.

## ◆ printLeases()

void isc::perfdhcp::StatsMgr::printLeases | ( |  | ) | const

Delegate to all exchanges to print their leases.

Definition at line 457 of file bin/perfdhcp/stats_mgr.cc.

References printLeases().

Referenced by printLeases(), isc::perfdhcp::AvalancheScen::run(), and isc::perfdhcp::BasicScen::run().

Here is the call graph for this function:

## ◆ printStats()

void isc::perfdhcp::StatsMgr::printStats | ( |  | ) | const
| inline

Print statistics counters for all exchange types.

Method prints statistics for all exchange types. Statistics includes:

- number of sent and received packets
- number of dropped packets and number of orphans
- minimum packets delay,
- average packets delay,
- maximum packets delay,
- standard deviation of packets delay.

Exceptions

  isc::InvalidOperation | if no exchange type added to track statistics.

Definition at line 1096 of file bin/perfdhcp/stats_mgr.h.

References isc_throw.

## ◆ printTimestamps()

void isc::perfdhcp::StatsMgr::printTimestamps | ( |  | ) | const
| inline

Print timestamps of all packets.

Method prints timestamps of all sent and received packets for all defined exchange types.

Exceptions

  isc::InvalidOperation | if one of the packets has no timestamp value set or if packets archive mode is disabled.
  isc::InvalidOperation | if no exchange type added to track statistics or packets archive mode is disabled.

Definition at line 1171 of file bin/perfdhcp/stats_mgr.h.

References isc_throw.

Referenced by isc::perfdhcp::AvalancheScen::run(), and isc::perfdhcp::BasicScen::run().

## ◆ updateNonUniqueAddrNum()

void isc::perfdhcp::StatsMgr::updateNonUniqueAddrNum | ( | const ExchangeType | xchg_type | ) |
| inline

Increase total number of non unique addresses.

Method increases total number of non unique addresses or prefixes by one for specified exchange type.

Definition at line 1051 of file bin/perfdhcp/stats_mgr.h.

## ◆ updateRejLeases()

void isc::perfdhcp::StatsMgr::updateRejLeases | ( | const ExchangeType | xchg_type | ) |
| inline

Increase total number of rejected leases.

Method increases total number of rejected leases by one for specified exchange type.

Definition at line 1042 of file bin/perfdhcp/stats_mgr.h.

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

- bin/perfdhcp/stats_mgr.h
- bin/perfdhcp/stats_mgr.cc