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 | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 31 | class CcnxAppTracer; |
| 32 | class CcnxL3Tracer; |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 33 | class Ipv4AppTracer; |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 34 | |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 35 | class CcnxTraceHelper |
| 36 | { |
| 37 | public: |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 38 | CcnxTraceHelper (); |
| 39 | |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 40 | /** |
| 41 | * @brief Destructor that invokes trace output procedures |
| 42 | */ |
| 43 | ~CcnxTraceHelper (); |
| 44 | |
| 45 | /** |
| 46 | * @brief Set filename to output app trace. |
| 47 | * |
| 48 | * By default, trace is output to NS_LOG_INFO stream |
| 49 | * |
| 50 | * @param file File where trace will be written to |
| 51 | */ |
| 52 | void |
| 53 | SetAppTraceFile (const std::string &appTrace = "apps.log"); |
| 54 | |
| 55 | /** |
| 56 | * @brief Set filename to output app trace. |
| 57 | * |
| 58 | * By default, trace is output to NS_LOG_INFO stream |
| 59 | * |
| 60 | * @param file File where trace will be written to |
| 61 | */ |
| 62 | void |
| 63 | SetL3TraceFile (const std::string &l3Trace = "l3.log"); |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 64 | |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 65 | /** |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 66 | * @brief Enable aggregate app-level CCNx tracing on all CCNx applications |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 67 | * |
| 68 | * @param app Class name of the application of interest |
| 69 | */ |
| 70 | void |
| 71 | EnableAggregateAppAll (const std::string &app); |
| 72 | |
| 73 | /** |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 74 | * @brief Enable aggregate network-level CCNx tracing on all CCNx node |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 75 | */ |
| 76 | void |
| 77 | EnableAggregateL3All (); |
| 78 | |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 79 | /** |
Alexander Afanasyev | 3183b5a | 2011-12-23 20:48:20 -0800 | [diff] [blame] | 80 | * @brief Enable network-level CCNx rate tracing on all CCNx nodes |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 81 | */ |
| 82 | void |
| 83 | EnableRateL3All (const std::string &l3RateTrace = "l3-rate.log"); |
| 84 | |
Alexander Afanasyev | 3183b5a | 2011-12-23 20:48:20 -0800 | [diff] [blame] | 85 | /** |
| 86 | * @brief Enable app-level CCNx sequence tracing on all CCNx applications |
| 87 | */ |
| 88 | void |
| 89 | EnableSeqsAppAll (const std::string &app, const std::string &appSeqsTrace = "app-seqs.log"); |
| 90 | |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 91 | /** |
| 92 | * @brief Enable app-level IPv4 sequence tracing on all nodes (BulkSender + PacketSink) |
| 93 | */ |
| 94 | void |
| 95 | EnableIpv4SeqsAppAll (const std::string &appSeqsTrace = "app-seqs.log"); |
| 96 | |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 97 | private: |
| 98 | std::string m_appTrace; |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 99 | std::list<Ptr<CcnxAppTracer> > m_apps; |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 100 | |
| 101 | std::string m_l3Trace; |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 102 | std::list<Ptr<CcnxL3Tracer> > m_l3s; |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 103 | |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 104 | std::list<Ptr<CcnxL3Tracer> > m_l3Rates; |
Alexander Afanasyev | c86c283 | 2011-12-23 02:56:22 -0800 | [diff] [blame] | 105 | std::ostream *m_l3RateTrace; |
Alexander Afanasyev | 3183b5a | 2011-12-23 20:48:20 -0800 | [diff] [blame] | 106 | |
| 107 | std::list<Ptr<CcnxAppTracer> > m_appSeqs; |
| 108 | std::ostream *m_appSeqsTrace; |
Alexander Afanasyev | c4f8828 | 2012-01-03 11:27:20 -0800 | [diff] [blame] | 109 | |
| 110 | std::list<Ptr<Ipv4AppTracer> > m_ipv4AppSeqs; |
| 111 | std::ostream *m_ipv4AppSeqsTrace; |
Alexander Afanasyev | 141d131 | 2011-12-18 14:58:35 -0800 | [diff] [blame] | 112 | }; |
| 113 | |
| 114 | |
| 115 | } // namespace ns3 |
| 116 | |
| 117 | #endif /* CCNX_TRACE_HELPER_H */ |