Kea: isc::perfmon::MonitoredDuration Class Reference

| Kea 3.2.0-git

isc::perfmon::MonitoredDuration Class Reference

`#include <monitored_duration.h>`

Inheritance diagram for isc::perfmon::MonitoredDuration:
[legend]

## Public Member Functions
| MonitoredDuration (const DurationKey &key, const Duration &interval_duration)
| Constructor.
| MonitoredDuration (const MonitoredDuration &rhs)
| Copy Constructor.
| MonitoredDuration (uint16_t family, uint8_t query_type, uint8_t response_type, const std::string &start_event_label, const std::string &stop_event_label, dhcp::SubnetID subnet_id, const Duration &interval_duration)
| Constructor.
virtual | ~MonitoredDuration ()=default
| Destructor.
bool | addSample (const Duration &sample)
| Add a sample to the duration's current interval.
void | clear ()
| Deletes the current and previous intervals.
void | expireCurrentInterval ()
| Concludes the current interval.
DurationDataIntervalPtr | getCurrentInterval () const
| Get the current interval.
Timestamp | getCurrentIntervalStart () const
| Get the current interval start time.
Duration | getIntervalDuration () const
| Get the interval duration.
DurationDataIntervalPtr | getPreviousInterval () const
| Get the previous interval.
virtual data::ElementPtr | toElement () const
| Renders the the duration as an Element.
data::ElementPtr | toValueRow () const
| Renders the the duration as an Element::list of values.
Public Member Functions inherited from isc::perfmon::DurationKey
| DurationKey (uint16_t family, uint8_t query_type, uint8_t response_type, const std::string &start_event_label, const std::string &stop_event_label, dhcp::SubnetID subnet_id)
| Constructor.
virtual | ~DurationKey ()=default
| Destructor.
uint16_t | getFamily ()
| Get protocol family.
std::string | getLabel () const
| Get a composite label of the member values with text message types.
uint8_t | getQueryType () const
| Get the query packet type.
uint8_t | getResponseType () const
| Get the response packet type.
std::string | getStartEventLabel () const
| Get the start event label.
std::string | getStatName (const std::string &value_name) const
| Get the StatsMgr formatted compatible name.
std::string | getStopEventLabel () const
| Get the end event label.
dhcp::SubnetID | getSubnetId () const
| Get the subnet id.
bool | operator!= (const DurationKey &other) const
| Inequality operator.
bool | operator< (const DurationKey &other) const
| Less than operator.
bool | operator== (const DurationKey &other) const
| Equality operator.
void | setSubnetId (dhcp::SubnetID subnet_id)
| Set the subnet id.
Public Member Functions inherited from isc::data::CfgToElement
virtual | ~CfgToElement ()
| Destructor.

## Static Public Member Functions
static data::ConstElementPtr | valueRowColumns ()
| Fetches an Element::list of value row column names.
Static Public Member Functions inherited from isc::perfmon::DurationKey
static std::string | getMessageTypeLabel (uint16_t family, uint16_t msg_type)
| Get a label for a family-specific message type (e.g.
static void | validateMessagePair (uint16_t family, uint8_t query_type, uint8_t response_type)
| Validates that a query and response message type pair is sane.

## Additional Inherited Members
Protected Attributes inherited from isc::perfmon::DurationKey
uint16_t | family_
| Protocol family AF_INET or AF_INET6.
uint8_t | query_type_
| Query message type (e.g. DHCPDISCOVER, DHCP6_SOLICIT).
uint8_t | response_type_
| Response message type (e.g. DHCPOFFER, DHCP6_ADVERTISE).
std::string | start_event_label_
| Label of the start event which begins the duration.
std::string | stop_event_label_
| Label of the end event which ends the duration.
isc::dhcp::SubnetID | subnet_id_
| Subnet ID of the subnet selected during query fulfillment.

## Detailed Description

Definition at line 323 of file monitored_duration.h.

## Constructor & Destructor Documentation

## ◆ MonitoredDuration() [1/3]

isc::perfmon::MonitoredDuration::MonitoredDuration | ( | uint16_t | family,
|  | uint8_t | query_type,
|  | uint8_t | response_type,
|  | const std::string & | start_event_label,
|  | const std::string & | stop_event_label,
|  | dhcp::SubnetID | subnet_id,
|  | const Duration & | interval_duration )

Constructor.

Parameters

  family | protocol family AF_INET or AF_INET6
  query_type | message type of the query packet
  response_type | message type of the response packet
  start_event_label | label of the start event
  stop_event_label | label of the end event
  subnet_id | id of the selected subnet
  interval_duration | the interval duration

Definition at line 244 of file monitored_duration.cc.

References isc::perfmon::DurationKey::DurationKey(), isc_throw, and isc::perfmon::DurationDataInterval::ZERO_DURATION().

Referenced by MonitoredDuration().

Here is the call graph for this function:

## ◆ MonitoredDuration() [2/3]

isc::perfmon::MonitoredDuration::MonitoredDuration | ( | const DurationKey & | key,
|  | const Duration & | interval_duration )

Constructor.

Parameters

  key | composite key that identifies the alarm
  interval_duration | the interval duration

Definition at line 261 of file monitored_duration.cc.

References isc::perfmon::DurationKey::DurationKey(), isc_throw, and isc::perfmon::DurationDataInterval::ZERO_DURATION().

Here is the call graph for this function:

## ◆ MonitoredDuration() [3/3]

isc::perfmon::MonitoredDuration::MonitoredDuration | ( | const MonitoredDuration & | rhs | ) |

Copy Constructor.

Parameters

  rhs | duration to copy

Definition at line 273 of file monitored_duration.cc.

References isc::perfmon::DurationKey::DurationKey(), MonitoredDuration(), and if().

Here is the call graph for this function:

## ◆ ~MonitoredDuration()

virtual isc::perfmon::MonitoredDuration::~MonitoredDuration | ( |  | ) |
| virtualdefault

Destructor.

## Member Function Documentation

## ◆ addSample()

bool isc::perfmon::MonitoredDuration::addSample | ( | const Duration & | sample | ) |

Add a sample to the duration's current interval.

If there is no current interval start a new one otherwise if the current interval has expired move it to the previous interval, set the return flag to true, then start a new interval. Add the sample to the current interval.

Parameters

  sample | duration value to add

Returns
  True if there is a newly completed (i.e. previous) interval to report.

Definition at line 294 of file monitored_duration.cc.

References isc::dhcp::PktEvent::now().

Here is the call graph for this function:

## ◆ clear()

void isc::perfmon::MonitoredDuration::clear | ( |  | ) |

Deletes the current and previous intervals.

Definition at line 321 of file monitored_duration.cc.

## ◆ expireCurrentInterval()

void isc::perfmon::MonitoredDuration::expireCurrentInterval | ( |  | ) |

Concludes the current interval.

Rotates current interval to previous and resets curent interval to empty.

Exceptions

  InvalidOperation | if there is no current interval.

Definition at line 310 of file monitored_duration.cc.

References isc::perfmon::DurationKey::getLabel(), and isc_throw.

Here is the call graph for this function:

## ◆ getCurrentInterval()

DurationDataIntervalPtr isc::perfmon::MonitoredDuration::getCurrentInterval | ( |  | ) | const
| inline

Get the current interval.

Returns
  Pointer to the current interval if it exists or an empty pointer.

Definition at line 369 of file monitored_duration.h.

## ◆ getCurrentIntervalStart()

Timestamp isc::perfmon::MonitoredDuration::getCurrentIntervalStart | ( |  | ) | const

Get the current interval start time.

Returns
  Current interval's start time or MIN_TIME if there's no current interval.

Definition at line 288 of file monitored_duration.cc.

References isc::dhcp::PktEvent::MIN_TIME().

Here is the call graph for this function:

## ◆ getIntervalDuration()

Duration isc::perfmon::MonitoredDuration::getIntervalDuration | ( |  | ) | const
| inline

Get the interval duration.

Returns
  Duration containing the interval duration.

Definition at line 355 of file monitored_duration.h.

## ◆ getPreviousInterval()

DurationDataIntervalPtr isc::perfmon::MonitoredDuration::getPreviousInterval | ( |  | ) | const
| inline

Get the previous interval.

Returns
  Pointer to the previous interval if it exists or an empty pointer.

Definition at line 362 of file monitored_duration.h.

## ◆ toElement()

ElementPtr isc::perfmon::MonitoredDuration::toElement | ( |  | ) | const
| virtual

Renders the the duration as an Element.

The element includes the duration key and the previous interval content(if one) as follows:

{
"duration-key": {
"query-type": "discover",
"response-type": "offer",
"start-event": "socket_received",
"stop-event": "buffer_read",
"subnet-id": 10
},
"start-time": "2024-01-18 10:11:19.498739",
"occurrences": 105,
"min-duration-usecs": 5300,
"max-duration-usecs": 9000,
"total-duration-usecs": 786500,
"mean-duration-usecs": 7490
}

If there is no previous interval, it will appears as follows:

{
"duration-key": {
"query-type": "discover",
"response-type": "offer",
"start-event": "socket_received",
"stop-event": "buffer_read",
"subnet-id": 10
},
"start-time": "<none>",
"occurrences": 0,
"min-duration-usecs": 0,
"max-duration-usecs": 0,
"total-duration-usecs": 0,
"mean-duration-usecs": 0
}

Returns
  Element::map containing the duration key values.

Reimplemented from isc::perfmon::DurationKey.

Definition at line 327 of file monitored_duration.cc.

References isc::data::Element::create(), isc::data::Element::createMap(), isc::util::ptimeToText(), and isc::perfmon::DurationKey::toElement().

Here is the call graph for this function:

## ◆ toValueRow()

ElementPtr isc::perfmon::MonitoredDuration::toValueRow | ( |  | ) | const

Renders the the duration as an Element::list of values.

The list element includes a value for each member of DurationKey and the previous interval. If there is no previous interval value of of "<none>" will be added for start-time and values of 0 for the remaining data values.

The values in the list will be in the following order and type:

1. query-type Element::string
2. response-type Element::string
3. start-event Element::string
4. stop-event Element::string
5. subnet-id Element::int
6. start-time Element::string ex: "2024-01-18 10:11:19.498739" or "<none>",
7. occurrences Element::int
8. min-duration-usecs Element::int
9. max-duration-usecs Element::int
10. total-duration-usecs Element::int
11. mean-duration-usecs Element::int

Returns
  Element::map containing the duration key values.

Definition at line 378 of file monitored_duration.cc.

References isc::data::Element::create(), isc::data::Element::createList(), isc::perfmon::DurationKey::family_, isc::perfmon::DurationKey::getMessageTypeLabel(), isc::util::ptimeToText(), isc::perfmon::DurationKey::query_type_, isc::perfmon::DurationKey::response_type_, isc::perfmon::DurationKey::start_event_label_, isc::perfmon::DurationKey::stop_event_label_, and isc::perfmon::DurationKey::subnet_id_.

Here is the call graph for this function:

## ◆ valueRowColumns()

ConstElementPtr isc::perfmon::MonitoredDuration::valueRowColumns | ( |  | ) |
| static

Fetches an Element::list of value row column names.

The list element includes the name of each column in a value row, in the order the values are stored in a value row.

The values in the list in order are:

1. "query-type"
2. "response-type"
3. "start-event"
4. "stop-event"
5. "subnet-id"
6. "start-time"
7. "occurrences"
8. "min-duration-usecs"
9. "max-duration-usecs"
10. "total-duration-usecs"
11. "mean-duration-usecs"

Returns
  Element::map containing the duration key values.

Definition at line 350 of file monitored_duration.cc.

References isc::data::Element::create(), and isc::data::Element::createList().

Referenced by isc::perfmon::PerfMonMgr::formatDurationDataAsResultSet().

Here is the call graph for this function:

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

- monitored_duration.h
- monitored_duration.cc