stats_mgr.h 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  1. // Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #ifndef __STATS_MGR_H
  15. #define __STATS_MGR_H
  16. #include <iostream>
  17. #include <map>
  18. #include <boost/noncopyable.hpp>
  19. #include <boost/shared_ptr.hpp>
  20. #include <boost/multi_index_container.hpp>
  21. #include <boost/multi_index/hashed_index.hpp>
  22. #include <boost/multi_index/sequenced_index.hpp>
  23. #include <boost/multi_index/global_fun.hpp>
  24. #include <boost/multi_index/mem_fun.hpp>
  25. #include <boost/date_time/posix_time/posix_time.hpp>
  26. #include <exceptions/exceptions.h>
  27. namespace isc {
  28. namespace perfdhcp {
  29. /// \brief Statistics Manager
  30. ///
  31. /// This class template is a storage for various performance statistics
  32. /// collected during performance tests execution with perfdhcp tool.
  33. ///
  34. /// Statistics Manager holds lists of sent and received packets and
  35. /// groups them into exchanges. For example: DHCPDISCOVER message and
  36. /// corresponding DHCPOFFER messages belong to one exchange, DHCPREQUEST
  37. /// and corresponding DHCPACK message belong to another exchange etc.
  38. /// In order to update statistics for a particular exchange type, client
  39. /// class passes sent and received packets. Internally, Statistics Manager
  40. /// tries to match transaction id of received packet with sent packet
  41. /// stored on the list of sent packets. When packets are matched the
  42. /// round trip time can be calculated.
  43. ///
  44. /// \param T class representing DHCPv4 or DHCPv6 packet.
  45. template <class T = dhcp::Pkt4>
  46. class StatsMgr : public boost::noncopyable {
  47. public:
  48. /// \brief Custom Counter
  49. ///
  50. /// This class represents custom statistics counters. Client class
  51. /// may create unlimited number of counters. Such counters are
  52. /// being stored in map in Statistics Manager and access using
  53. /// unique string key.
  54. class CustomCounter {
  55. public:
  56. /// \brief Constructor.
  57. ///
  58. /// This constructor sets counter name. This name is used in
  59. /// log file to report value of each counter.
  60. ///
  61. /// \param name name of the counter used in log file.
  62. CustomCounter(const std::string& name) :
  63. counter_(0),
  64. name_(name) { };
  65. /// \brief Increment operator.
  66. const CustomCounter& operator++() {
  67. ++counter_;
  68. return(*this);
  69. }
  70. /// \brief Increment operator.
  71. const CustomCounter& operator++(int) {
  72. CustomCounter& this_counter(*this);
  73. operator++();
  74. return(this_counter);
  75. }
  76. /// \brief Return counter value.
  77. ///
  78. /// Method returns counter value.
  79. ///
  80. /// \return counter value.
  81. uint64_t getValue() const { return(counter_); }
  82. /// \brief Return counter name.
  83. ///
  84. /// Method returns counter name.
  85. ///
  86. /// \return counter name.
  87. const std::string& getName() const { return(name_); }
  88. private:
  89. /// \brief Default constructor.
  90. ///
  91. /// Default constrcutor is private because we don't want client
  92. /// class to call it because we want client class to specify
  93. /// counter's name.
  94. CustomCounter() { };
  95. uint64_t counter_; ///< Counter's value.
  96. std::string name_; ///< Counter's name.
  97. };
  98. typedef typename boost::shared_ptr<CustomCounter> CustomCounterPtr;
  99. /// DHCP packet exchange types.
  100. enum ExchangeType {
  101. XCHG_DO, ///< DHCPv4 DISCOVER-OFFER
  102. XCHG_RA, ///< DHCPv4 REQUEST-ACK
  103. XCHG_SA, ///< DHCPv6 SOLICIT-ADVERTISE
  104. XCHG_RR ///< DHCPv6 REQUEST-REPLY
  105. };
  106. /// \brief Exchange Statistics.
  107. ///
  108. /// This class collects statistics for exchanges. Parent class
  109. /// may define number of different packet exchanges like:
  110. /// DHCPv4 DISCOVER-OFFER, DHCPv6 SOLICIT-ADVERTISE etc. Performance
  111. /// statistics will be collected for each of those separately in
  112. /// corresponding instance of ExchangeStats.
  113. class ExchangeStats {
  114. public:
  115. /// \brief Hash transaction id of the packet.
  116. ///
  117. /// Function hashes transaction id of the packet. Hashing is
  118. /// non-unique. Many packets may have the same hash value and thus
  119. /// they belong to the same packet buckets. Packet buckets are
  120. /// used for unordered packets search with multi index container.
  121. ///
  122. /// \param packet packet which transaction id is to be hashed.
  123. /// \throw isc::BadValue if packet is null.
  124. /// \return transaction id hash.
  125. static uint32_t hashTransid(const boost::shared_ptr<T>& packet) {
  126. if (!packet) {
  127. isc_throw(BadValue, "Packet is null");
  128. }
  129. return(packet->getTransid() & 1023);
  130. }
  131. /// \brief List of packets (sent or received).
  132. ///
  133. /// List of packets based on multi index container allows efficient
  134. /// search of packets based on their sequence (order in which they
  135. /// were inserted) as well as based on their hashed transaction id.
  136. /// The first index (sequenced) provides the way to use container
  137. /// as a regular list (including iterators, removal of elements from
  138. /// the middle of the collection etc.). This index is meant to be used
  139. /// more frequently than the latter one and it is based on the
  140. /// assumption that responses from the DHCP server are received in
  141. /// order. In this case, when next packet is received it can be
  142. /// matched with next packet on the list of sent packets. This
  143. /// prevents intensive searches on the list of sent packets every
  144. /// time new packet arrives. In many cases however packets can be
  145. /// dropped by the server or may be sent out of order and we still
  146. /// want to have ability to search packets using transaction id.
  147. /// The second index can be used for this purpose. This index is
  148. /// hashing transaction ids using custom function \ref hashTransid.
  149. /// Note that other possibility would be to simply specify index
  150. /// that uses transaction id directly (instead of hashing with
  151. /// \ref hashTransid). In this case however we have chosen to use
  152. /// hashing function because it shortens the index size to just
  153. /// 1023 values maximum. Search operation on this index generally
  154. /// returns the range of packets that have the same transaction id
  155. /// hash assigned but most often these ranges will be short so further
  156. /// search within a range to find a packet with pacrticular transaction
  157. /// id will not be intensive.
  158. ///
  159. /// Example 1: Add elements to the list
  160. /// \code
  161. /// PktList packets_collection();
  162. /// boost::shared_ptr<Pkt4> pkt1(new Pkt4(...));
  163. /// boost::shared_ptr<Pkt4> pkt2(new Pkt4(...));
  164. /// // Add new packet to the container, it will be available through
  165. /// // both indexes
  166. /// packets_collection.push_back(pkt1);
  167. /// // Here is another way to add packet to the container. The result
  168. /// // is exactly the same as previously.
  169. /// packets_collection.template get<0>().push_back(pkt2);
  170. /// \endcode
  171. ///
  172. /// Example 2: Access elements through sequencial index
  173. /// \code
  174. /// PktList packets_collection();
  175. /// ... # Add elements to the container
  176. /// for (PktListIterator it = packets_collection.begin();
  177. /// it != packets_collection.end();
  178. /// ++it) {
  179. /// boost::shared_ptr<Pkt4> pkt = *it;
  180. /// # Do something with packet;
  181. /// }
  182. /// \endcode
  183. ///
  184. /// Example 3: Access elements through hashed index
  185. /// \code
  186. /// // Get the instance of the second search index.
  187. /// PktListTransidHashIndex& idx = sent_packets_.template get<1>();
  188. /// // Get the range (bucket) of packets sharing the same transaction
  189. /// // id hash.
  190. /// std::pair<PktListTransidHashIterator,PktListTransidHashIterator> p =
  191. /// idx.equal_range(hashTransid(rcvd_packet));
  192. /// // Iterate through the returned bucket.
  193. /// for (PktListTransidHashIterator it = p.first; it != p.second;
  194. /// ++it) {
  195. /// boost::shared_ptr pkt = *it;
  196. /// ... # Do something with the packet (e.g. check transaction id)
  197. /// }
  198. /// \endcode
  199. typedef boost::multi_index_container<
  200. boost::shared_ptr<T>,
  201. boost::multi_index::indexed_by<
  202. boost::multi_index::sequenced<>,
  203. boost::multi_index::hashed_non_unique<
  204. boost::multi_index::global_fun<
  205. const boost::shared_ptr<T>&,
  206. uint32_t,
  207. &ExchangeStats::hashTransid
  208. >
  209. >
  210. >
  211. > PktList;
  212. /// Packet list iterator for sequencial access to elements.
  213. typedef typename PktList::iterator PktListIterator;
  214. /// Packet list index to search packets using transaction id hash.
  215. typedef typename PktList::template nth_index<1>::type
  216. PktListTransidHashIndex;
  217. /// Packet list iterator to access packets using transaction id hash.
  218. typedef typename PktListTransidHashIndex::const_iterator
  219. PktListTransidHashIterator;
  220. /// \brief Constructor
  221. ///
  222. /// \param xchg_type exchange type
  223. /// \param archive_enabled if true packets archive mode is enabled.
  224. /// In this mode all packets are stored throughout the test execution.
  225. ExchangeStats(const ExchangeType xchg_type, const bool archive_enabled)
  226. : xchg_type_(xchg_type),
  227. sent_packets_(),
  228. rcvd_packets_(),
  229. archived_packets_(),
  230. archive_enabled_(archive_enabled),
  231. min_delay_(std::numeric_limits<double>::max()),
  232. max_delay_(0.),
  233. sum_delay_(0.),
  234. sum_delay_squared_(0.),
  235. orphans_(0),
  236. unordered_lookup_size_sum_(0),
  237. unordered_lookups_(0),
  238. ordered_lookups_(0),
  239. sent_packets_num_(0),
  240. rcvd_packets_num_(0)
  241. {
  242. next_sent_ = sent_packets_.begin();
  243. }
  244. /// \brief Add new packet to list of sent packets.
  245. ///
  246. /// Method adds new packet to list of sent packets.
  247. ///
  248. /// \param packet packet object to be added.
  249. /// \throw isc::BadValue if packet is null.
  250. void appendSent(const boost::shared_ptr<T>& packet) {
  251. if (!packet) {
  252. isc_throw(BadValue, "Packet is null");
  253. }
  254. ++sent_packets_num_;
  255. sent_packets_.template get<0>().push_back(packet);
  256. }
  257. /// \brief Add new packet to list of received packets.
  258. ///
  259. /// Method adds new packet to list of received packets.
  260. ///
  261. /// \param packet packet object to be added.
  262. /// \throw isc::BadValue if packet is null.
  263. void appendRcvd(const boost::shared_ptr<T>& packet) {
  264. if (!packet) {
  265. isc_throw(BadValue, "Packet is null");
  266. }
  267. rcvd_packets_.push_back(packet);
  268. }
  269. /// \brief Update delay counters.
  270. ///
  271. /// Method updates delay counters based on timestamps of
  272. /// sent and received packets.
  273. ///
  274. /// \param sent_packet sent packet
  275. /// \param rcvd_packet received packet
  276. /// \throw isc::BadValue if sent or received packet is null.
  277. /// \throw isc::Unexpected if failed to calculate timestamps
  278. void updateDelays(const boost::shared_ptr<T>& sent_packet,
  279. const boost::shared_ptr<T>& rcvd_packet) {
  280. if (!sent_packet) {
  281. isc_throw(BadValue, "Sent packet is null");
  282. }
  283. if (!rcvd_packet) {
  284. isc_throw(BadValue, "Received packet is null");
  285. }
  286. boost::posix_time::ptime sent_time = sent_packet->getTimestamp();
  287. boost::posix_time::ptime rcvd_time = rcvd_packet->getTimestamp();
  288. if (sent_time.is_not_a_date_time() ||
  289. rcvd_time.is_not_a_date_time()) {
  290. isc_throw(Unexpected,
  291. "Timestamp must be set for sent and "
  292. "received packet to measure RTT");
  293. }
  294. boost::posix_time::time_period period(sent_time, rcvd_time);
  295. // We don't bother calculating deltas in nanoseconds. It is much
  296. // more convenient to use seconds instead because we are going to
  297. // sum them up.
  298. double delta =
  299. static_cast<double>(period.length().total_nanoseconds()) / 1e9;
  300. if (delta < 0) {
  301. isc_throw(Unexpected, "Sent packet's timestamp must not be "
  302. "greater than received packet's timestamp");
  303. }
  304. // Record the minimum delay between sent and received packets.
  305. if (delta < min_delay_) {
  306. min_delay_ = delta;
  307. }
  308. // Record the maximum delay between sent and received packets.
  309. if (delta > max_delay_) {
  310. max_delay_ = delta;
  311. }
  312. // Update delay sum and square sum. That will be used to calculate
  313. // mean delays.
  314. sum_delay_ += delta;
  315. sum_delay_squared_ += delta * delta;
  316. }
  317. /// \brief Match received packet with the corresponding sent packet.
  318. ///
  319. /// Method finds packet with specified transaction id on the list
  320. /// of sent packets. It is used to match received packet with
  321. /// corresponding sent packet.
  322. /// Since packets from the server most often come in the same order
  323. /// as they were sent by client, this method will first check if
  324. /// next sent packet matches. If it doesn't, function will search
  325. /// the packet using indexing by transaction id. This reduces
  326. /// packet search time significantly.
  327. ///
  328. /// \param rcvd_packet received packet to be matched with sent packet.
  329. /// \throw isc::BadValue if received packet is null.
  330. /// \return packet having specified transaction or NULL if packet
  331. /// not found
  332. boost::shared_ptr<T>
  333. matchPackets(const boost::shared_ptr<T>& rcvd_packet) {
  334. if (!rcvd_packet) {
  335. isc_throw(BadValue, "Received packet is null");
  336. }
  337. if (sent_packets_.size() == 0) {
  338. // List of sent packets is empty so there is no sense
  339. // to continue looking fo the packet. It also means
  340. // that the received packet we got has no corresponding
  341. // sent packet so orphans counter has to be updated.
  342. ++orphans_;
  343. return(boost::shared_ptr<T>());
  344. } else if (next_sent_ == sent_packets_.end()) {
  345. // Even if there are still many unmatched packets on the
  346. // list we might hit the end of it because of unordered
  347. // lookups. The next logical step is to reset iterator.
  348. next_sent_ = sent_packets_.begin();
  349. }
  350. // With this variable we will be signalling success or failure
  351. // to find the packet.
  352. bool packet_found = false;
  353. // Most likely responses are sent from the server in the same
  354. // order as client's requests to the server. We are caching
  355. // next sent packet and first try to match it with the next
  356. // incoming packet. We are successful if there is no
  357. // packet drop or out of order packets sent. This is actually
  358. // the fastest way to look for packets.
  359. if ((*next_sent_)->getTransid() == rcvd_packet->getTransid()) {
  360. ++ordered_lookups_;
  361. packet_found = true;
  362. } else {
  363. // If we are here, it means that we were unable to match the
  364. // next incoming packet with next sent packet so we need to
  365. // take a little more expensive approach to look packets using
  366. // alternative index (transaction id & 1023).
  367. PktListTransidHashIndex& idx = sent_packets_.template get<1>();
  368. // Packets are grouped using trasaction id masked with value
  369. // of 1023. For instance, packets with transaction id equal to
  370. // 1, 1024 ... will belong to the same group (a.k.a. bucket).
  371. // When using alternative index we don't find the packet but
  372. // bucket of packets and we need to iterate through the bucket
  373. // to find the one that has desired transaction id.
  374. std::pair<PktListTransidHashIterator,PktListTransidHashIterator> p =
  375. idx.equal_range(hashTransid(rcvd_packet));
  376. // We want to keep statistics of unordered lookups to make
  377. // sure that there is a right balance between number of
  378. // unordered lookups and ordered lookups. If number of unordered
  379. // lookups is high it may mean that many packets are lost or
  380. // sent out of order.
  381. ++unordered_lookups_;
  382. // We also want to keep the mean value of the bucket. The lower
  383. // bucket size the better. If bucket sizes appear to big we
  384. // might want to increase number of buckets.
  385. unordered_lookup_size_sum_ += std::distance(p.first, p.second);
  386. for (PktListTransidHashIterator it = p.first; it != p.second;
  387. ++it) {
  388. if ((*it)->getTransid() == rcvd_packet->getTransid()) {
  389. packet_found = true;
  390. next_sent_ =
  391. sent_packets_.template project<0>(it);
  392. break;
  393. }
  394. }
  395. }
  396. if (!packet_found) {
  397. // If we are here, it means that both ordered lookup and
  398. // unordered lookup failed. Searched packet is not on the list.
  399. ++orphans_;
  400. return(boost::shared_ptr<T>());
  401. }
  402. // Packet is matched so we count it. We don't count unmatched packets
  403. // as they are counted as orphans with a separate counter.
  404. ++rcvd_packets_num_;
  405. boost::shared_ptr<T> sent_packet(*next_sent_);
  406. // If packet was found, we assume it will be never searched
  407. // again. We want to delete this packet from the list to
  408. // improve performance of future searches.
  409. next_sent_ = eraseSent(next_sent_);
  410. return(sent_packet);
  411. }
  412. /// \brief Return minumum delay between sent and received packet.
  413. ///
  414. /// Method returns minimum delay between sent and received packet.
  415. ///
  416. /// \return minimum delay between packets.
  417. double getMinDelay() const { return(min_delay_); }
  418. /// \brief Return maxmimum delay between sent and received packet.
  419. ///
  420. /// Method returns maximum delay between sent and received packet.
  421. ///
  422. /// \return maximum delay between packets.
  423. double getMaxDelay() const { return(max_delay_); }
  424. /// \brief Return avarage packet delay.
  425. ///
  426. /// Method returns average packet delay. If no packets have been
  427. /// received for this exchange avg delay can't be calculated and
  428. /// thus method throws exception.
  429. ///
  430. /// \throw isc::InvalidOperation if no packets for this exchange
  431. /// have been received yet.
  432. /// \return average packet delay.
  433. double getAvgDelay() const {
  434. if (rcvd_packets_num_ == 0) {
  435. isc_throw(InvalidOperation, "no packets received");
  436. }
  437. return(sum_delay_ / rcvd_packets_num_);
  438. }
  439. /// \brief Return standard deviation of packet delay.
  440. ///
  441. /// Method returns standard deviation of packet delay. If no
  442. /// packets have been received for this exchange, the standard
  443. /// deviation can't be calculated and thus method throws
  444. /// exception.
  445. ///
  446. /// \throw isc::InvalidOperation if number of received packets
  447. /// for the exchange is equal to zero.
  448. /// \return standard deviation of packet delay.
  449. double getStdDevDelay() const {
  450. if (rcvd_packets_num_ == 0) {
  451. isc_throw(InvalidOperation, "no packets received");
  452. }
  453. return(sqrt(sum_delay_squared_ / rcvd_packets_num_ -
  454. getAvgDelay() * getAvgDelay()));
  455. }
  456. /// \brief Return number of orphant packets.
  457. ///
  458. /// Method returns number of received packets that had no matching
  459. /// sent packet. It is possible that such packet was late or not
  460. /// for us.
  461. ///
  462. /// \return number of orphant received packets.
  463. uint64_t getOrphans() const { return(orphans_); }
  464. /// \brief Return average unordered lookup set size.
  465. ///
  466. /// Method returns average unordered lookup set size.
  467. /// This value changes every time \ref ExchangeStats::matchPackets
  468. /// function performs unordered packet lookup.
  469. ///
  470. /// \throw isc::InvalidOperation if there have been no unordered
  471. /// lookups yet.
  472. /// \return average unordered lookup set size.
  473. double getAvgUnorderedLookupSetSize() const {
  474. if (unordered_lookups_ == 0) {
  475. isc_throw(InvalidOperation, "no unordered lookups");
  476. }
  477. return(static_cast<double>(unordered_lookup_size_sum_) /
  478. static_cast<double>(unordered_lookups_));
  479. }
  480. /// \brief Return number of unordered sent packets lookups
  481. ///
  482. /// Method returns number of unordered sent packet lookups.
  483. /// Unordered lookup is used when received packet was sent
  484. /// out of order by server - transaction id of received
  485. /// packet does not match transaction id of next sent packet.
  486. ///
  487. /// \return number of unordered lookups.
  488. uint64_t getUnorderedLookups() const { return(unordered_lookups_); }
  489. /// \brief Return number of ordered sent packets lookups
  490. ///
  491. /// Method returns number of ordered sent packet lookups.
  492. /// Ordered lookup is used when packets are received in the
  493. /// same order as they were sent to the server.
  494. /// If packets are skipped or received out of order, lookup
  495. /// function will use unordered lookup (with hash table).
  496. ///
  497. /// \return number of ordered lookups.
  498. uint64_t getOrderedLookups() const { return(ordered_lookups_); }
  499. /// \brief Return total number of sent packets
  500. ///
  501. /// Method returns total number of sent packets.
  502. ///
  503. /// \return number of sent packets.
  504. uint64_t getSentPacketsNum() const { return(sent_packets_num_); }
  505. /// \brief Return total number of received packets
  506. ///
  507. /// Method returns total number of received packets.
  508. ///
  509. /// \return number of received packets.
  510. uint64_t getRcvdPacketsNum() const { return(rcvd_packets_num_); }
  511. /// \brief Return number of dropped packets.
  512. ///
  513. /// Method returns number of dropped packets.
  514. ///
  515. /// \return number of dropped packets.
  516. uint64_t getDroppedPacketsNum() const {
  517. uint64_t drops = 0;
  518. if (getSentPacketsNum() > getRcvdPacketsNum()) {
  519. drops = getSentPacketsNum() - getRcvdPacketsNum();
  520. }
  521. return(drops);
  522. }
  523. /// \brief Print main statistics for packet exchange.
  524. ///
  525. /// Method prints main statistics for particular exchange.
  526. /// Statistics includes: number of sent and received packets,
  527. /// number of dropped packets and number of orphans.
  528. void printMainStats() const {
  529. using namespace std;
  530. cout << "sent packets: " << getSentPacketsNum() << endl
  531. << "received packets: " << getRcvdPacketsNum() << endl
  532. << "drops: " << getDroppedPacketsNum() << endl
  533. << "orphans: " << getOrphans() << endl;
  534. }
  535. /// \brief Print round trip time packets statistics.
  536. ///
  537. /// Method prints round trip time packets statistics. Statistics
  538. /// includes minimum packet delay, maximum packet delay, average
  539. /// packet delay and standard deviation of delays. Packet delay
  540. /// is a duration between sending a packet to server and receiving
  541. /// response from server.
  542. void printRTTStats() const {
  543. using namespace std;
  544. try {
  545. cout << fixed << setprecision(3)
  546. << "min delay: " << getMinDelay() * 1e3 << " ms" << endl
  547. << "avg delay: " << getAvgDelay() * 1e3 << " ms" << endl
  548. << "max delay: " << getMaxDelay() * 1e3 << " ms" << endl
  549. << "std deviation: " << getStdDevDelay() * 1e3 << " ms"
  550. << endl;
  551. } catch (const Exception& e) {
  552. cout << "Unavailable! No packets received." << endl;
  553. }
  554. }
  555. //// \brief Print timestamps for sent and received packets.
  556. ///
  557. /// Method prints timestamps for all sent and received packets for
  558. /// packet exchange. In order to run this method the packets
  559. /// archiving mode has to be enabled during object constructions.
  560. /// Otherwise sent packets are not stored during tests execution
  561. /// and this method has no ability to get and print their timestamps.
  562. ///
  563. /// \throw isc::InvalidOperation if found packet with no timestamp or
  564. /// if packets archive mode is disabled.
  565. void printTimestamps() {
  566. // If archive mode is disabled there is no sense to proceed
  567. // because we don't have packets and their timestamps.
  568. if (!archive_enabled_) {
  569. isc_throw(isc::InvalidOperation,
  570. "packets archive mode is disabled");
  571. }
  572. if (rcvd_packets_num_ == 0) {
  573. std::cout << "Unavailable! No packets received." << std::endl;
  574. }
  575. // We will be using boost::posix_time extensivelly here
  576. using namespace boost::posix_time;
  577. // Iterate through all received packets.
  578. for (PktListIterator it = rcvd_packets_.begin();
  579. it != rcvd_packets_.end();
  580. ++it) {
  581. boost::shared_ptr<T> rcvd_packet = *it;
  582. PktListTransidHashIndex& idx =
  583. archived_packets_.template get<1>();
  584. std::pair<PktListTransidHashIterator,
  585. PktListTransidHashIterator> p =
  586. idx.equal_range(hashTransid(rcvd_packet));
  587. for (PktListTransidHashIterator it_archived = p.first;
  588. it_archived != p.second;
  589. ++it) {
  590. if ((*it_archived)->getTransid() ==
  591. rcvd_packet->getTransid()) {
  592. boost::shared_ptr<T> sent_packet = *it_archived;
  593. // Get sent and received packet times.
  594. ptime sent_time = sent_packet->getTimestamp();
  595. ptime rcvd_time = rcvd_packet->getTimestamp();
  596. // All sent and received packets should have timestamps
  597. // set but if there is a bug somewhere and packet does
  598. // not have timestamp we want to catch this here.
  599. if (sent_time.is_not_a_date_time() ||
  600. rcvd_time.is_not_a_date_time()) {
  601. isc_throw(InvalidOperation,
  602. "packet time is not set");
  603. }
  604. // Calculate durations of packets from beginning of epoch.
  605. ptime epoch_time(min_date_time);
  606. time_period sent_period(epoch_time, sent_time);
  607. time_period rcvd_period(epoch_time, rcvd_time);
  608. // Print timestamps for sent and received packet.
  609. std::cout << "sent / received: "
  610. << to_iso_string(sent_period.length())
  611. << " / "
  612. << to_iso_string(rcvd_period.length())
  613. << std::endl;
  614. break;
  615. }
  616. }
  617. }
  618. }
  619. private:
  620. /// \brief Private default constructor.
  621. ///
  622. /// Default constructor is private because we want the client
  623. /// class to specify exchange type explicitely.
  624. ExchangeStats();
  625. /// \brief Erase packet from the list of sent packets.
  626. ///
  627. /// Method erases packet from the list of sent packets.
  628. ///
  629. /// \param it iterator pointing to packet to be erased.
  630. /// \return iterator pointing to packet following erased
  631. /// packet or sent_packets_.end() if packet not found.
  632. PktListIterator eraseSent(const PktListIterator it) {
  633. if (archive_enabled_) {
  634. // We don't want to keep list of all sent packets
  635. // because it will affect packet lookup performance.
  636. // If packet is matched with received packet we
  637. // move it to list of archived packets. List of
  638. // archived packets may be used for diagnostics
  639. // when test is completed.
  640. archived_packets_.push_back(*it);
  641. }
  642. // get<0>() template returns sequencial index to
  643. // container.
  644. return(sent_packets_.template get<0>().erase(it));
  645. }
  646. ExchangeType xchg_type_; ///< Packet exchange type.
  647. PktList sent_packets_; ///< List of sent packets.
  648. /// Iterator pointing to the packet on sent list which will most
  649. /// likely match next received packet. This is based on the
  650. /// assumption that server responds in order to incoming packets.
  651. PktListIterator next_sent_;
  652. PktList rcvd_packets_; ///< List of received packets.
  653. /// List of archived packets. All sent packets that have
  654. /// been matched with received packet are moved to this
  655. /// list for diagnostics purposes.
  656. PktList archived_packets_;
  657. /// Indicates all packets have to be preserved after matching.
  658. /// By default this is disabled which means that when received
  659. /// packet is matched with sent packet both are deleted. This
  660. /// is important when test is executed for extended period of
  661. /// time and high memory usage might be the issue.
  662. /// When timestamps listing is specified from the command line
  663. /// (using diagnostics selector), all packets have to be preserved
  664. /// so as the printing method may read their timestamps and
  665. /// print it to user. In such usage model it will be rare to
  666. /// run test for extended period of time so it should be fine
  667. /// to keep all packets archived throughout the test.
  668. bool archive_enabled_;
  669. double min_delay_; ///< Minimum delay between sent
  670. ///< and received packets.
  671. double max_delay_; ///< Maximum delay between sent
  672. ///< and received packets.
  673. double sum_delay_; ///< Sum of delays between sent
  674. ///< and received packets.
  675. double sum_delay_squared_; ///< Squared sum of delays between
  676. ///< sent and recived packets.
  677. uint64_t orphans_; ///< Number of orphant received packets.
  678. /// Sum of unordered lookup sets. Needed to calculate mean size of
  679. /// lookup set. It is desired that number of unordered lookups is
  680. /// minimal for performance reasons. Tracking number of lookups and
  681. /// mean size of the lookup set should give idea of packets serach
  682. /// complexity.
  683. uint64_t unordered_lookup_size_sum_;
  684. uint64_t unordered_lookups_; ///< Number of unordered sent packets
  685. ///< lookups.
  686. uint64_t ordered_lookups_; ///< Number of ordered sent packets
  687. ///< lookups.
  688. uint64_t sent_packets_num_; ///< Total number of sent packets.
  689. uint64_t rcvd_packets_num_; ///< Total number of received packets.
  690. };
  691. /// Pointer to ExchangeStats.
  692. typedef boost::shared_ptr<ExchangeStats> ExchangeStatsPtr;
  693. /// Map containing all specified exchange types.
  694. typedef typename std::map<ExchangeType, ExchangeStatsPtr> ExchangesMap;
  695. /// Iterator poiting to \ref ExchangesMap
  696. typedef typename ExchangesMap::const_iterator ExchangesMapIterator;
  697. /// Map containing custom counters.
  698. typedef typename std::map<std::string, CustomCounterPtr> CustomCountersMap;
  699. /// Iterator for \ref CustomCountersMap.
  700. typedef typename CustomCountersMap::const_iterator CustomCountersMapIterator;
  701. /// \brief Constructor.
  702. ///
  703. /// This constructor by default disables packets archiving mode.
  704. /// In this mode all packets from the list of sent packets are
  705. /// moved to list of archived packets once they have been matched
  706. /// with received packets. This is required if it has been selected
  707. /// from the command line to print timestamps for all packets after
  708. /// the test. If this is not selected archiving should be disabled
  709. /// for performance reasons and to avoid waste of memory for storing
  710. /// large list of archived packets.
  711. ///
  712. /// \param archive_enabled true indicates that packets
  713. /// archive mode is enabled.
  714. StatsMgr(const bool archive_enabled = false) :
  715. exchanges_(),
  716. custom_counters_(),
  717. archive_enabled_(archive_enabled) {
  718. }
  719. /// \brief Specify new exchange type.
  720. ///
  721. /// This method creates new \ref ExchangeStats object that will
  722. /// collect statistics data from packets exchange of the specified
  723. /// type.
  724. ///
  725. /// \param xchg_type exchange type.
  726. /// \throw isc::BadValue if exchange of specified type exists.
  727. void addExchangeStats(const ExchangeType xchg_type) {
  728. if (exchanges_.find(xchg_type) != exchanges_.end()) {
  729. isc_throw(BadValue, "Exchange of specified type already added.");
  730. }
  731. exchanges_[xchg_type] =
  732. ExchangeStatsPtr(new ExchangeStats(xchg_type, archive_enabled_));
  733. }
  734. /// \brief Add named custom uint64 counter.
  735. ///
  736. /// Method creates new named counter and stores in counter's map under
  737. /// key specified here as short_name.
  738. ///
  739. /// \param short_name key to use to access counter in the map.
  740. /// \param long_name name of the counter presented in the log file.
  741. void addCustomCounter(const std::string& short_name,
  742. const std::string& long_name) {
  743. if (custom_counters_.find(short_name) != custom_counters_.end()) {
  744. isc_throw(BadValue,
  745. "Custom counter " << short_name << " already added.");
  746. }
  747. custom_counters_[short_name] =
  748. CustomCounterPtr(new CustomCounter(long_name));
  749. }
  750. /// \brief Return specified counter.
  751. ///
  752. /// Method returns specified counter.
  753. ///
  754. /// \param counter_key key poiting to the counter in the counters map.
  755. /// The short counter name has to be used to access counter.
  756. /// \return pointer to specified counter object.
  757. CustomCounterPtr getCounter(const std::string& counter_key) {
  758. CustomCountersMapIterator it = custom_counters_.find(counter_key);
  759. if (it == custom_counters_.end()) {
  760. isc_throw(BadValue,
  761. "Custom counter " << counter_key << "does not exist");
  762. }
  763. return(it->second);
  764. }
  765. /// \brief Increment specified counter.
  766. ///
  767. /// Increement counter value by one.
  768. ///
  769. /// \param counter_key key poitinh to the counter in the counters map.
  770. /// \return pointer to specified counter after incrementation.
  771. const CustomCounter& IncrementCounter(const std::string& counter_key) {
  772. CustomCounterPtr counter = getCounter(counter_key);
  773. return(++(*counter));
  774. }
  775. /// \brief Adds new packet to the sent packets list.
  776. ///
  777. /// Method adds new packet to the sent packets list.
  778. /// Packets are added to the list sequentially and
  779. /// most often read sequentially.
  780. ///
  781. /// \param xchg_type exchange type.
  782. /// \param packet packet to be added to the list
  783. /// \throw isc::BadValue if invalid exchange type specified or
  784. /// packet is null.
  785. void passSentPacket(const ExchangeType xchg_type,
  786. const boost::shared_ptr<T>& packet) {
  787. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  788. xchg_stats->appendSent(packet);
  789. }
  790. /// \brief Add new received packet and match with sent packet.
  791. ///
  792. /// Method adds new packet to the list of received packets. It
  793. /// also searches for corresponding packet on the list of sent
  794. /// packets. When packets are matched the statistics counters
  795. /// are updated accordingly for the particular exchange type.
  796. ///
  797. /// \param xchg_type exchange type.
  798. /// \param packet received packet
  799. /// \throw isc::BadValue if invalid exchange type specified
  800. /// or packet is null.
  801. /// \throw isc::Unexpected if corresponding packet was not
  802. /// found on the list of sent packets.
  803. boost::shared_ptr<T>
  804. passRcvdPacket(const ExchangeType xchg_type,
  805. const boost::shared_ptr<T>& packet) {
  806. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  807. boost::shared_ptr<T> sent_packet
  808. = xchg_stats->matchPackets(packet);
  809. if (sent_packet) {
  810. xchg_stats->updateDelays(sent_packet, packet);
  811. if (archive_enabled_) {
  812. xchg_stats->appendRcvd(packet);
  813. }
  814. }
  815. return(sent_packet);
  816. }
  817. /// \brief Return minumum delay between sent and received packet.
  818. ///
  819. /// Method returns minimum delay between sent and received packet
  820. /// for specified exchange type.
  821. ///
  822. /// \param xchg_type exchange type.
  823. /// \throw isc::BadValue if invalid exchange type specified.
  824. /// \return minimum delay between packets.
  825. double getMinDelay(const ExchangeType xchg_type) const {
  826. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  827. return(xchg_stats->getMinDelay());
  828. }
  829. /// \brief Return maxmimum delay between sent and received packet.
  830. ///
  831. /// Method returns maximum delay between sent and received packet
  832. /// for specified exchange type.
  833. ///
  834. /// \param xchg_type exchange type.
  835. /// \throw isc::BadValue if invalid exchange type specified.
  836. /// \return maximum delay between packets.
  837. double getMaxDelay(const ExchangeType xchg_type) const {
  838. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  839. return(xchg_stats->getMaxDelay());
  840. }
  841. /// \brief Return avarage packet delay.
  842. ///
  843. /// Method returns average packet delay for specified
  844. /// exchange type.
  845. ///
  846. /// \return average packet delay.
  847. double getAvgDelay(const ExchangeType xchg_type) const {
  848. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  849. return(xchg_stats->getAvgDelay());
  850. }
  851. /// \brief Return standard deviation of packet delay.
  852. ///
  853. /// Method returns standard deviation of packet delay
  854. /// for specified exchange type.
  855. ///
  856. /// \return standard deviation of packet delay.
  857. double getStdDevDelay(const ExchangeType xchg_type) const {
  858. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  859. return(xchg_stats->getStdDevDelay());
  860. }
  861. /// \brief Return number of orphant packets.
  862. ///
  863. /// Method returns number of orphant packets for specified
  864. /// exchange type.
  865. ///
  866. /// \param xchg_type exchange type.
  867. /// \throw isc::BadValue if invalid exchange type specified.
  868. /// \return number of orphant packets so far.
  869. uint64_t getOrphans(const ExchangeType xchg_type) const {
  870. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  871. return(xchg_stats->getOrphans());
  872. }
  873. /// \brief Return average unordered lookup set size.
  874. ///
  875. /// Method returns average unordered lookup set size.
  876. /// This value changes every time \ref ExchangeStats::matchPackets
  877. /// function performs unordered packet lookup.
  878. ///
  879. /// \param xchg_type exchange type.
  880. /// \throw isc::BadValue if invalid exchange type specified.
  881. /// \return average unordered lookup set size.
  882. double getAvgUnorderedLookupSetSize(const ExchangeType xchg_type) const {
  883. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  884. return(xchg_stats->getAvgUnorderedLookupSetSize());
  885. }
  886. /// \brief Return number of unordered sent packets lookups
  887. ///
  888. /// Method returns number of unordered sent packet lookups.
  889. /// Unordered lookup is used when received packet was sent
  890. /// out of order by server - transaction id of received
  891. /// packet does not match transaction id of next sent packet.
  892. ///
  893. /// \param xchg_type exchange type.
  894. /// \throw isc::BadValue if invalid exchange type specified.
  895. /// \return number of unordered lookups.
  896. uint64_t getUnorderedLookups(const ExchangeType xchg_type) const {
  897. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  898. return(xchg_stats->getUnorderedLookups());
  899. }
  900. /// \brief Return number of ordered sent packets lookups
  901. ///
  902. /// Method returns number of ordered sent packet lookups.
  903. /// Ordered lookup is used when packets are received in the
  904. /// same order as they were sent to the server.
  905. /// If packets are skipped or received out of order, lookup
  906. /// function will use unordered lookup (with hash table).
  907. ///
  908. /// \param xchg_type exchange type.
  909. /// \throw isc::BadValue if invalid exchange type specified.
  910. /// \return number of ordered lookups.
  911. uint64_t getOrderedLookups(const ExchangeType xchg_type) const {
  912. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  913. return(xchg_stats->getOrderedLookups());
  914. }
  915. /// \brief Return total number of sent packets
  916. ///
  917. /// Method returns total number of sent packets for specified
  918. /// exchange type.
  919. ///
  920. /// \param xchg_type exchange type.
  921. /// \throw isc::BadValue if invalid exchange type specified.
  922. /// \return number of sent packets.
  923. uint64_t getSentPacketsNum(const ExchangeType xchg_type) const {
  924. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  925. return(xchg_stats->getSentPacketsNum());
  926. }
  927. /// \brief Return total number of received packets
  928. ///
  929. /// Method returns total number of received packets for specified
  930. /// exchange type.
  931. ///
  932. /// \param xchg_type exchange type.
  933. /// \throw isc::BadValue if invalid exchange type specified.
  934. /// \return number of received packets.
  935. uint64_t getRcvdPacketsNum(const ExchangeType xchg_type) const {
  936. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  937. return(xchg_stats->getRcvdPacketsNum());
  938. }
  939. /// \brief Return total number of dropped packets.
  940. ///
  941. /// Method returns total number of dropped packets for specified
  942. /// exchange type.
  943. ///
  944. /// \param xchg_type exchange type.
  945. /// \throw isc::BadValue if invalid exchange type specified.
  946. /// \return number of dropped packets.
  947. uint64_t getDroppedPacketsNum(const ExchangeType xchg_type) const {
  948. ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
  949. return(xchg_stats->getDroppedPacketsNum());
  950. }
  951. /// \brief Return name of the exchange.
  952. ///
  953. /// Method returns name of the specified exchange type.
  954. /// This function is mainly for logging purposes.
  955. ///
  956. /// \param xchg_type exchange type.
  957. /// \return string representing name of the exchange.
  958. std::string exchangeToString(ExchangeType xchg_type) const {
  959. switch(xchg_type) {
  960. case XCHG_DO:
  961. return("DISCOVER-OFFER");
  962. case XCHG_RA:
  963. return("REQUEST-ACK");
  964. case XCHG_SA:
  965. return("SOLICIT-ADVERTISE");
  966. case XCHG_RR:
  967. return("REQUEST-REPLY");
  968. default:
  969. return("Unknown exchange type");
  970. }
  971. }
  972. /// \brief Print statistics counters for all exchange types.
  973. ///
  974. /// Method prints statistics for all exchange types.
  975. /// Statistics includes:
  976. /// - number of sent and received packets
  977. /// - number of dropped packets and number of orphans
  978. /// - minimum packets delay,
  979. /// - average packets delay,
  980. /// - maximum packets delay,
  981. /// - standard deviation of packets delay.
  982. ///
  983. /// \throw isc::InvalidOperation if no exchange type added to
  984. /// track statistics.
  985. void printStats() const {
  986. if (exchanges_.size() == 0) {
  987. isc_throw(isc::InvalidOperation,
  988. "no exchange type added for tracking");
  989. }
  990. for (ExchangesMapIterator it = exchanges_.begin();
  991. it != exchanges_.end();
  992. ++it) {
  993. ExchangeStatsPtr xchg_stats = it->second;
  994. std::cout << "***Statistics for: " << exchangeToString(it->first)
  995. << "***" << std::endl;
  996. xchg_stats->printMainStats();
  997. std::cout << std::endl;
  998. xchg_stats->printRTTStats();
  999. std::cout << std::endl;
  1000. }
  1001. }
  1002. /// \brief Print timestamps of all packets.
  1003. ///
  1004. /// Method prints timestamps of all sent and received
  1005. /// packets for all defined exchange types.
  1006. ///
  1007. /// \throw isc::InvalidOperation if one of the packets has
  1008. /// no timestamp value set or if packets archive mode is
  1009. /// disabled.
  1010. ///
  1011. /// \throw isc::InvalidOperation if no exchange type added to
  1012. /// track statistics or packets archive mode is disabled.
  1013. void printTimestamps() const {
  1014. if (exchanges_.size() == 0) {
  1015. isc_throw(isc::InvalidOperation,
  1016. "no exchange type added for tracking");
  1017. }
  1018. for (ExchangesMapIterator it = exchanges_.begin();
  1019. it != exchanges_.end();
  1020. ++it) {
  1021. ExchangeStatsPtr xchg_stats = it->second;
  1022. std::cout << "***Timestamps for packets: "
  1023. << exchangeToString(it->first)
  1024. << "***" << std::endl;
  1025. xchg_stats->printTimestamps();
  1026. std::cout << std::endl;
  1027. }
  1028. }
  1029. /// \brief Print names and values of custom counters.
  1030. ///
  1031. /// Method prints names and values of custom counters. Custom counters
  1032. /// are defined by client class for tracking different statistics.
  1033. ///
  1034. /// \throw isc::InvalidOperation if no custom counters added for tracking.
  1035. void printCustomCounters() const {
  1036. if (custom_counters_.size() == 0) {
  1037. isc_throw(isc::InvalidOperation, "no custom counters specified");
  1038. }
  1039. for (CustomCountersMapIterator it = custom_counters_.begin();
  1040. it != custom_counters_.end();
  1041. ++it) {
  1042. CustomCounterPtr counter = it->second;
  1043. std::cout << counter->getName() << ": " << counter->getValue()
  1044. << std::endl;
  1045. }
  1046. }
  1047. private:
  1048. /// \brief Return exchange stats object for given exchange type
  1049. ///
  1050. /// Method returns exchange stats object for given exchange type.
  1051. ///
  1052. /// \param xchg_type exchange type.
  1053. /// \throw isc::BadValue if invalid exchange type specified.
  1054. /// \return exchange stats object.
  1055. ExchangeStatsPtr getExchangeStats(const ExchangeType xchg_type) const {
  1056. ExchangesMapIterator it = exchanges_.find(xchg_type);
  1057. if (it == exchanges_.end()) {
  1058. isc_throw(BadValue, "Packets exchange not specified");
  1059. }
  1060. ExchangeStatsPtr xchg_stats = it->second;
  1061. return(xchg_stats);
  1062. }
  1063. ExchangesMap exchanges_; ///< Map of exchange types.
  1064. CustomCountersMap custom_counters_; ///< Map with custom counters.
  1065. /// Indicates that packets from list of sent packets should be
  1066. /// archived (moved to list of archived packets) once they are
  1067. /// matched with received packets. This is required when it has
  1068. /// been selected from the command line to print packets'
  1069. /// timestamps after test. This may affect performance and
  1070. /// consume large amount of memory when the test is running
  1071. /// for extended period of time and many packets have to be
  1072. /// archived.
  1073. bool archive_enabled_;
  1074. };
  1075. } // namespace perfdhcp
  1076. } // namespace isc
  1077. #endif // __STATS_MGR_H