Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 UCLA |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #ifndef CCNX_RATE_L3_TRACER_H |
| 22 | #define CCNX_RATE_L3_TRACER_H |
| 23 | |
| 24 | #include "ns3/ccnx-l3-tracer.h" |
| 25 | |
| 26 | #include "ns3/nstime.h" |
| 27 | #include "ns3/event-id.h" |
| 28 | |
| 29 | #include <boost/tuple/tuple.hpp> |
| 30 | #include <map> |
| 31 | |
| 32 | namespace ns3 { |
| 33 | |
| 34 | /** |
| 35 | * @ingroup ccnx |
| 36 | * @brief CCNx network-layer rate tracer |
| 37 | */ |
| 38 | class CcnxRateL3Tracer : public CcnxL3Tracer |
| 39 | { |
| 40 | public: |
| 41 | /** |
| 42 | * @brief Network layer tracer constructor |
| 43 | */ |
| 44 | CcnxRateL3Tracer (std::ostream &os, Ptr<Node> node); |
| 45 | CcnxRateL3Tracer (std::ostream &os, const std::string &node); |
| 46 | virtual ~CcnxRateL3Tracer (); |
| 47 | |
| 48 | void |
| 49 | SetAveragingPeriod (const Time &period); |
| 50 | |
| 51 | virtual void |
| 52 | PrintHeader (std::ostream &os) const; |
| 53 | |
| 54 | virtual void |
| 55 | Print (std::ostream &os) const; |
| 56 | |
| 57 | virtual void |
| 58 | OutInterests (std::string context, |
| 59 | Ptr<const CcnxInterestHeader>, Ptr<const CcnxFace>); |
| 60 | |
| 61 | virtual void |
| 62 | InInterests (std::string context, |
| 63 | Ptr<const CcnxInterestHeader>, Ptr<const CcnxFace>); |
| 64 | |
| 65 | virtual void |
| 66 | DropInterests (std::string context, |
| 67 | Ptr<const CcnxInterestHeader>, Ccnx::DropReason, Ptr<const CcnxFace>); |
| 68 | |
| 69 | virtual void |
| 70 | OutNacks (std::string context, |
| 71 | Ptr<const CcnxInterestHeader>, Ptr<const CcnxFace>); |
| 72 | |
| 73 | virtual void |
| 74 | InNacks (std::string context, |
| 75 | Ptr<const CcnxInterestHeader>, Ptr<const CcnxFace>); |
| 76 | |
| 77 | virtual void |
| 78 | DropNacks (std::string context, |
| 79 | Ptr<const CcnxInterestHeader>, Ccnx::DropReason, Ptr<const CcnxFace>); |
| 80 | |
| 81 | virtual void |
| 82 | OutData (std::string context, |
| 83 | Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>, bool fromCache, Ptr<const CcnxFace>); |
| 84 | |
| 85 | virtual void |
| 86 | InData (std::string context, |
| 87 | Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>, Ptr<const CcnxFace>); |
| 88 | |
| 89 | virtual void |
| 90 | DropData (std::string context, |
| 91 | Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>, Ccnx::DropReason, Ptr<const CcnxFace>); |
| 92 | |
| 93 | private: |
| 94 | void |
| 95 | PeriodicPrinter (); |
| 96 | |
| 97 | void |
| 98 | Reset (); |
| 99 | |
| 100 | private: |
| 101 | std::ostream& m_os; |
| 102 | Time m_period; |
| 103 | EventId m_printEvent; |
| 104 | |
| 105 | mutable std::map<Ptr<const CcnxFace>, boost::tuple<Stats, Stats, Stats, Stats> > m_stats; |
| 106 | }; |
| 107 | |
| 108 | } // namespace ns3 |
| 109 | |
| 110 | #endif // CCNX_RATE_L3_TRACER_H |