![]() |
Kea 2.7.3
|
#include <monitored_duration.h>
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. | |
![]() | |
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. | |
![]() | |
virtual | ~CfgToElement () |
Destructor. | |
Static Public Member Functions | |
static data::ConstElementPtr | valueRowColumns () |
Fetches a an Element::list of value row column names. | |
![]() | |
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 | |
![]() | |
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. | |
Definition at line 323 of file monitored_duration.h.
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.
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_throw, and isc::perfmon::DurationDataInterval::ZERO_DURATION().
isc::perfmon::MonitoredDuration::MonitoredDuration | ( | const DurationKey & | key, |
const Duration & | interval_duration ) |
Constructor.
key | composite key that identifies the alarm |
interval_duration | the interval duration |
Definition at line 261 of file monitored_duration.cc.
References isc_throw, and isc::perfmon::DurationDataInterval::ZERO_DURATION().
isc::perfmon::MonitoredDuration::MonitoredDuration | ( | const MonitoredDuration & | rhs | ) |
Copy Constructor.
rhs | duration to copy |
Definition at line 273 of file monitored_duration.cc.
|
virtualdefault |
Destructor.
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.
sample | duration value to add |
Definition at line 294 of file monitored_duration.cc.
References isc::dhcp::PktEvent::now().
void isc::perfmon::MonitoredDuration::clear | ( | ) |
Deletes the current and previous intervals.
Definition at line 321 of file monitored_duration.cc.
void isc::perfmon::MonitoredDuration::expireCurrentInterval | ( | ) |
Concludes the current interval.
Rotates current interval to previous and resets curent interval to empty.
InvalidOperation | if there is no current interval. |
Definition at line 310 of file monitored_duration.cc.
References isc::perfmon::DurationKey::getLabel(), and isc_throw.
|
inline |
Get the current interval.
Definition at line 369 of file monitored_duration.h.
Timestamp isc::perfmon::MonitoredDuration::getCurrentIntervalStart | ( | ) | const |
Get the current interval start time.
Definition at line 288 of file monitored_duration.cc.
References isc::dhcp::PktEvent::MIN_TIME().
|
inline |
Get the interval duration.
Definition at line 355 of file monitored_duration.h.
|
inline |
Get the previous interval.
Definition at line 362 of file monitored_duration.h.
|
virtual |
Renders the the duration as an Element.
The element includes the duration key and the previous interval content(if one) as follows:
If there is no previous interval, it will appears as follows:
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().
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:
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_.
|
static |
Fetches a 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:
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().