Kea 2.6.2
perfmon_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7// Functions accessed by the hooks framework use C linkage to avoid the name
8// mangling that accompanies use of the C++ compiler as well as to avoid
9// issues related to namespaces.
10
11#ifndef PERFMON_MGR_H
12#define PERFMON_MGR_H
13
14#include <perfmon_config.h>
16#include <asiolink/io_service.h>
18#include <dhcpsrv/subnet.h>
19
20namespace isc {
21namespace perfmon {
22
27class PerfMonMgr : public PerfMonConfig {
28public:
32 explicit PerfMonMgr(uint16_t family);
33
35 virtual ~PerfMonMgr() = default;
36
40 void configure(const isc::data::ConstElementPtr& params);
41
45 virtual void init();
46
56 isc::dhcp::PktPtr response,
57 const isc::dhcp::SubnetPtr subnet);
58
71 void addDurationSample(DurationKeyPtr key, const Duration& sample);
72
82
91 void reportAlarm(AlarmPtr alarm, const Duration& average);
92
97 void reportTimerExpired();
98
107
114
121
128
129protected:
132
137
140
146 // dhcp::NetworkStatePtr network_state_;
147
150
153
155 const boost::scoped_ptr<std::mutex> mutex_;
156};
157
159typedef boost::shared_ptr<PerfMonMgr> PerfMonMgrPtr;
160
161} // end of namespace perfmon
162} // end of namespace isc
163
164#endif
PerfMonConfig(uint16_t family)
Constructor.
void processPktEventStack(isc::dhcp::PktPtr query, isc::dhcp::PktPtr response, const isc::dhcp::SubnetPtr subnet)
Processes the event stack of a query packet.
void reportTimerExpired()
Handler invoked when the report timer expires.
Duration interval_duration_
Length of time a MonitoredDuration accumulates samples until reporting.
const boost::scoped_ptr< std::mutex > mutex_
The mutex used to protect internal state.
void setNextReportExpiration()
Updates the report timer.
void addDurationSample(DurationKeyPtr key, const Duration &sample)
Adds a duration sample to a MonitoredDuration.
virtual ~PerfMonMgr()=default
Destructor.
asiolink::IntervalTimerPtr report_timer_
Timer which tracks the next duration due to report.
Duration getIntervalDuration()
Get the interval duration.
PerfMonMgr(uint16_t family)
Constructor.
Duration reportToStatsMgr(MonitoredDurationPtr duration)
Emits an entry to StatsMgr for a given duration.
void configure(const isc::data::ConstElementPtr &params)
Parses the hook library 'parameters' element.
MonitoredDurationStorePtr duration_store_
In-memory store of MonitoredDurations.
asiolink::IOServicePtr io_service_
Tracks whether or not the server is processing DHCP packets.
void reportAlarm(AlarmPtr alarm, const Duration &average)
Emits a report for a given alarm.
Duration alarm_report_interval_
Length of time between raised Alarm reports.
Duration getAlarmReportInterval()
Get the alarm report interval.
virtual void init()
Sets convenience values and (re)creates the duration store.
MonitoredDurationStorePtr getDurationStore()
Get the duration store.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< isc::dhcp::Pkt > PktPtr
A pointer to either Pkt4 or Pkt6 packet.
Definition pkt.h:982
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
Definition subnet.h:449
boost::posix_time::time_duration Duration
boost::shared_ptr< DurationKey > DurationKeyPtr
Defines a pointer to a DurationKey instance.
boost::shared_ptr< MonitoredDurationStore > MonitoredDurationStorePtr
boost::shared_ptr< MonitoredDuration > MonitoredDurationPtr
boost::shared_ptr< Alarm > AlarmPtr
Defines a pointer to an Alarm instance.
Definition alarm.h:168
boost::shared_ptr< PerfMonMgr > PerfMonMgrPtr
Defines a shared pointer to a PerfMonMgr.
Defines the logger used by the top-level component of kea-lfc.
The classes herein parse PerfMon hook library's 'parameters' element depicted below: