Kea 2.5.9
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
112 return (interval_duration_);
113 }
114
119 return (alarm_report_interval_);
120 }
121
126 return (duration_store_);
127 }
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
Houses the PerfMon configuration parameters for a single scope (e.g.
Singleton which provides overall configuration, control, and state of the PerfMon hook library.
Definition: perfmon_mgr.h:27
void processPktEventStack(isc::dhcp::PktPtr query, isc::dhcp::PktPtr response, const isc::dhcp::SubnetPtr subnet)
Processes the event stack of a query packet.
Definition: perfmon_mgr.cc:68
void reportTimerExpired()
Handler invoked when the report timer expires.
Definition: perfmon_mgr.cc:213
Duration interval_duration_
Length of time a MonitoredDuration accumulates samples until reporting.
Definition: perfmon_mgr.h:131
const boost::scoped_ptr< std::mutex > mutex_
The mutex used to protect internal state.
Definition: perfmon_mgr.h:155
void setNextReportExpiration()
Updates the report timer.
Definition: perfmon_mgr.cc:218
void addDurationSample(DurationKeyPtr key, const Duration &sample)
Adds a duration sample to a MonitoredDuration.
Definition: perfmon_mgr.cc:146
virtual ~PerfMonMgr()=default
Destructor.
asiolink::IntervalTimerPtr report_timer_
Timer which tracks the next duration due to report.
Definition: perfmon_mgr.h:152
Duration getIntervalDuration()
Get the interval duration.
Definition: perfmon_mgr.h:111
Duration reportToStatsMgr(MonitoredDurationPtr duration)
Emits an entry to StatsMgr for a given duration.
Definition: perfmon_mgr.cc:164
void configure(const isc::data::ConstElementPtr &params)
Parses the hook library 'parameters' element.
Definition: perfmon_mgr.cc:44
MonitoredDurationStorePtr duration_store_
In-memory store of MonitoredDurations.
Definition: perfmon_mgr.h:139
asiolink::IOServicePtr io_service_
Tracks whether or not the server is processing DHCP packets.
Definition: perfmon_mgr.h:149
void reportAlarm(AlarmPtr alarm, const Duration &average)
Emits a report for a given alarm.
Definition: perfmon_mgr.cc:186
Duration alarm_report_interval_
Length of time between raised Alarm reports.
Definition: perfmon_mgr.h:136
Duration getAlarmReportInterval()
Get the alarm report interval.
Definition: perfmon_mgr.h:118
virtual void init()
Sets convenience values and (re)creates the duration store.
Definition: perfmon_mgr.cc:34
MonitoredDurationStorePtr getDurationStore()
Get the duration store.
Definition: perfmon_mgr.h:125
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:489
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.
Definition: perfmon_mgr.h:159
Defines the logger used by the top-level component of kea-lfc.
The classes herein parse PerfMon hook library's 'parameters' element depicted below: