Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -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_TRACE_HELPER_H |
| 22 | #define CCNX_TRACE_HELPER_H |
| 23 | |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 24 | #include "ns3/nstime.h" |
| 25 | #include "ns3/event-id.h" |
| 26 | |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 27 | #include <list> |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 28 | |
| 29 | namespace ns3 { |
| 30 | |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 31 | class Node; |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 32 | class CcnxAppTracer; |
| 33 | class CcnxL3Tracer; |
Alexander Afanasyev | 7e71c75 | 2012-01-25 21:40:39 -0800 | [diff] [blame] | 34 | class Ipv4L3Tracer; |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 35 | class Ipv4AppTracer; |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 36 | class WindowTracer; |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 37 | class CcnxPathWeightTracer; |
| 38 | class Application; |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 39 | |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 40 | class CcnxTraceHelper |
| 41 | { |
| 42 | public: |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 43 | CcnxTraceHelper (); |
| 44 | |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 45 | /** |
| 46 | * @brief Destructor that invokes trace output procedures |
| 47 | */ |
| 48 | ~CcnxTraceHelper (); |
| 49 | |
| 50 | /** |
| 51 | * @brief Set filename to output app trace. |
| 52 | * |
| 53 | * By default, trace is output to NS_LOG_INFO stream |
| 54 | * |
| 55 | * @param file File where trace will be written to |
| 56 | */ |
| 57 | void |
| 58 | SetAppTraceFile (const std::string &appTrace = "apps.log"); |
| 59 | |
| 60 | /** |
| 61 | * @brief Set filename to output app trace. |
| 62 | * |
| 63 | * By default, trace is output to NS_LOG_INFO stream |
| 64 | * |
| 65 | * @param file File where trace will be written to |
| 66 | */ |
| 67 | void |
| 68 | SetL3TraceFile (const std::string &l3Trace = "l3.log"); |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 69 | |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 70 | /** |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 71 | * @brief Enable aggregate app-level CCNx tracing on all CCNx applications |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 72 | * |
| 73 | * @param app Class name of the application of interest |
| 74 | */ |
| 75 | void |
| 76 | EnableAggregateAppAll (const std::string &app); |
| 77 | |
| 78 | /** |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 79 | * @brief Enable aggregate network-level CCNx tracing on all CCNx node |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 80 | */ |
| 81 | void |
| 82 | EnableAggregateL3All (); |
| 83 | |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 84 | /** |
Alexander Afanasyev | 3183b5a | 2011-12-23 20:48:20 -0800 | [diff] [blame] | 85 | * @brief Enable network-level CCNx rate tracing on all CCNx nodes |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 86 | */ |
| 87 | void |
| 88 | EnableRateL3All (const std::string &l3RateTrace = "l3-rate.log"); |
| 89 | |
Alexander Afanasyev | 3183b5a | 2011-12-23 20:48:20 -0800 | [diff] [blame] | 90 | /** |
| 91 | * @brief Enable app-level CCNx sequence tracing on all CCNx applications |
| 92 | */ |
| 93 | void |
| 94 | EnableSeqsAppAll (const std::string &app, const std::string &appSeqsTrace = "app-seqs.log"); |
| 95 | |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 96 | /** |
| 97 | * @brief Enable app-level IPv4 sequence tracing on all nodes (BulkSender + PacketSink) |
| 98 | */ |
| 99 | void |
| 100 | EnableIpv4SeqsAppAll (const std::string &appSeqsTrace = "app-seqs.log"); |
Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 101 | |
| 102 | /** |
Alexander Afanasyev | 7e71c75 | 2012-01-25 21:40:39 -0800 | [diff] [blame] | 103 | * @brief Enable network-level IPv4 rate tracing on all IPv4-enabled nodes |
| 104 | */ |
| 105 | void |
| 106 | EnableIpv4RateL3All (const std::string &ipv4RateTrace = "ipv4-rate.log"); |
| 107 | |
| 108 | /** |
Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 109 | * @brief Enable tracing of window changes in CcnxConsumerWindow |
| 110 | */ |
| 111 | void |
| 112 | EnableWindowsAll (const std::string &windowTrace = "windows.log"); |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 113 | |
| 114 | /** |
| 115 | * @brief Enable tracing of congestion window changes in TcpNewReno |
| 116 | */ |
| 117 | void |
| 118 | EnableWindowsTcpAll (const std::string &windowTrace); |
| 119 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 120 | /** |
| 121 | * @brief Should be called with node pointer after TCP application |
| 122 | * |
| 123 | * Workaround because NS-3 needs object to exist before connecting trace |
| 124 | */ |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 125 | void TcpConnect (Ptr<Node> node); |
| 126 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 127 | /** |
| 128 | * @brief Enable tracing of path weights |
| 129 | */ |
| 130 | void |
| 131 | EnablePathWeights (const std::string &pathWeights); |
| 132 | |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 133 | private: |
| 134 | std::string m_appTrace; |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 135 | std::list<Ptr<CcnxAppTracer> > m_apps; |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 136 | |
| 137 | std::string m_l3Trace; |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 138 | std::list<Ptr<CcnxL3Tracer> > m_l3s; |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 139 | |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 140 | std::list<Ptr<CcnxL3Tracer> > m_l3Rates; |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 141 | std::ostream *m_l3RateTrace; |
Alexander Afanasyev | 3183b5a | 2011-12-23 20:48:20 -0800 | [diff] [blame] | 142 | |
| 143 | std::list<Ptr<CcnxAppTracer> > m_appSeqs; |
| 144 | std::ostream *m_appSeqsTrace; |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 145 | |
Alexander Afanasyev | 7e71c75 | 2012-01-25 21:40:39 -0800 | [diff] [blame] | 146 | std::list<Ptr<Ipv4L3Tracer> > m_ipv4Rates; |
| 147 | std::ostream *m_ipv4RateTrace; |
| 148 | |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 149 | std::list<Ptr<Ipv4AppTracer> > m_ipv4AppSeqs; |
| 150 | std::ostream *m_ipv4AppSeqsTrace; |
Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 151 | |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 152 | std::list<Ptr<WindowTracer> > m_windows; |
Alexander Afanasyev | e4c2ece | 2012-01-11 10:44:40 -0800 | [diff] [blame] | 153 | std::ostream *m_windowsTrace; |
Alexander Afanasyev | 06b42ec | 2012-01-11 19:05:36 -0800 | [diff] [blame] | 154 | |
| 155 | std::list<Ptr<WindowTracer> > m_windowsTcp; |
| 156 | std::ostream *m_windowsTcpTrace; |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 157 | |
| 158 | std::list<Ptr<CcnxPathWeightTracer> > m_pathWeights; |
| 159 | std::ostream *m_pathWeightsTrace; |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 160 | }; |
| 161 | |
| 162 | |
| 163 | } // namespace ns3 |
| 164 | |
| 165 | #endif /* CCNX_TRACE_HELPER_H */ |