NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ndn-app-delay-tracer.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2013 University of California, Los Angeles
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_APP_DELAY_TRACER_H
22 #define CCNX_APP_DELAY_TRACER_H
23 
24 #include "ns3/ptr.h"
25 #include "ns3/simple-ref-count.h"
26 #include <ns3/nstime.h>
27 #include <ns3/event-id.h>
28 #include <ns3/node-container.h>
29 
30 #include <boost/tuple/tuple.hpp>
31 #include <boost/shared_ptr.hpp>
32 #include <list>
33 
34 namespace ns3 {
35 
36 class Node;
37 class Packet;
38 
39 namespace ndn {
40 
41 class App;
42 
47 class AppDelayTracer : public SimpleRefCount<AppDelayTracer>
48 {
49 public:
59  static void
60  InstallAll (const std::string &file);
61 
72  static void
73  Install (const NodeContainer &nodes, const std::string &file);
74 
86  static void
87  Install (Ptr<Node> node, const std::string &file);
88 
99  static Ptr<AppDelayTracer>
100  Install (Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream);
101 
108  static void
109  Destroy ();
110 
116  AppDelayTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
117 
123  AppDelayTracer (boost::shared_ptr<std::ostream> os, const std::string &node);
124 
128  ~AppDelayTracer ();
129 
135  void
136  PrintHeader (std::ostream &os) const;
137 
138 private:
139  void
140  Connect ();
141 
142  void
143  LastRetransmittedInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay, int32_t hopCount);
144 
145  void
146  FirstInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay, uint32_t rextCount, int32_t hopCount);
147 
148 private:
149  std::string m_node;
150  Ptr<Node> m_nodePtr;
151 
152  boost::shared_ptr<std::ostream> m_os;
153 };
154 
155 } // namespace ndn
156 } // namespace ns3
157 
158 #endif // CCNX_CS_TRACER_H
Tracer to obtain application-level delays.
static void InstallAll(const std::string &file)
Helper method to install tracers on all simulation nodes.
void PrintHeader(std::ostream &os) const
Print head of the trace (e.g., for post-processing)
static void Install(const NodeContainer &nodes, const std::string &file)
Helper method to install tracers on the selected simulation nodes.
static void Destroy()
Explicit request to remove all statically created tracers.
AppDelayTracer(boost::shared_ptr< std::ostream > os, Ptr< Node > node)
Trace constructor that attaches to all applications on the node using node's pointer.