NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ns3::ndn::CsTracer Class Reference

NDN tracer for cache performance (hits and misses) More...

#include <ndn-cs-tracer.hpp>

Inheritance diagram for ns3::ndn::CsTracer:
Collaboration diagram for ns3::ndn::CsTracer:

Public Member Functions

 CsTracer (shared_ptr< std::ostream > os, Ptr< Node > node)
 Trace constructor that attaches to the node using node pointer. More...
 
 CsTracer (shared_ptr< std::ostream > os, const std::string &node)
 Trace constructor that attaches to the node using node name. More...
 
 ~CsTracer ()
 Destructor. More...
 
void PrintHeader (std::ostream &os) const
 Print head of the trace (e.g., for post-processing) More...
 
void Print (std::ostream &os) const
 Print current trace data. More...
 

Static Public Member Functions

static void InstallAll (const std::string &file, Time averagingPeriod=Seconds(0.5))
 Helper method to install tracers on all simulation nodes. More...
 
static void Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod=Seconds(0.5))
 Helper method to install tracers on the selected simulation nodes. More...
 
static void Install (Ptr< Node > node, const std::string &file, Time averagingPeriod=Seconds(0.5))
 Helper method to install tracers on a specific simulation node. More...
 
static Ptr< CsTracerInstall (Ptr< Node > node, shared_ptr< std::ostream > outputStream, Time averagingPeriod=Seconds(0.5))
 Helper method to install tracers on a specific simulation node. More...
 
static void Destroy ()
 Explicit request to remove all statically created tracers. More...
 

Detailed Description

NDN tracer for cache performance (hits and misses)

Definition at line 62 of file ndn-cs-tracer.hpp.

Constructor & Destructor Documentation

◆ CsTracer() [1/2]

ns3::ndn::CsTracer::CsTracer ( shared_ptr< std::ostream >  os,
Ptr< Node node 
)

Trace constructor that attaches to the node using node pointer.

Parameters
osreference to the output stream
nodepointer to the node

Definition at line 176 of file ndn-cs-tracer.cpp.

◆ CsTracer() [2/2]

ns3::ndn::CsTracer::CsTracer ( shared_ptr< std::ostream >  os,
const std::string &  node 
)

Trace constructor that attaches to the node using node name.

Parameters
osreference to the output stream
nodeNamename of the node registered using Names::Add

Definition at line 190 of file ndn-cs-tracer.cpp.

◆ ~CsTracer()

ns3::ndn::CsTracer::~CsTracer ( )

Destructor.

Definition at line 197 of file ndn-cs-tracer.cpp.

References Print().

Member Function Documentation

◆ InstallAll()

void ns3::ndn::CsTracer::InstallAll ( const std::string &  file,
Time  averagingPeriod = Seconds(0.5) 
)
static

Helper method to install tracers on all simulation nodes.

Parameters
fileFile to which traces will be written. If filename is -, then std::out is used
averagingPeriodHow often data will be written into the trace file (default, every half second)
Returns
a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved for the lifetime of simulation, otherwise SEGFAULTs are inevitable

Definition at line 50 of file ndn-cs-tracer.cpp.

References Install().

◆ Install() [1/3]

void ns3::ndn::CsTracer::Install ( const NodeContainer &  nodes,
const std::string &  file,
Time  averagingPeriod = Seconds(0.5) 
)
static

Helper method to install tracers on the selected simulation nodes.

Parameters
nodesNodes on which to install tracer
fileFile to which traces will be written. If filename is -, then std::out is used
averagingPeriodHow often data will be written into the trace file (default, every half second)
Returns
a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved for the lifetime of simulation, otherwise SEGFAULTs are inevitable

Definition at line 87 of file ndn-cs-tracer.cpp.

Referenced by Install(), and InstallAll().

◆ Install() [2/3]

void ns3::ndn::CsTracer::Install ( Ptr< Node node,
const std::string &  file,
Time  averagingPeriod = Seconds(0.5) 
)
static

Helper method to install tracers on a specific simulation node.

Parameters
nodesNodes on which to install tracer
fileFile to which traces will be written. If filename is -, then std::out is used
averagingPeriodHow often data will be written into the trace file (default, every half second)
Returns
a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved for the lifetime of simulation, otherwise SEGFAULTs are inevitable

Definition at line 125 of file ndn-cs-tracer.cpp.

References Install().

◆ Install() [3/3]

Ptr< CsTracer > ns3::ndn::CsTracer::Install ( Ptr< Node node,
shared_ptr< std::ostream >  outputStream,
Time  averagingPeriod = Seconds(0.5) 
)
static

Helper method to install tracers on a specific simulation node.

Parameters
nodesNodes on which to install tracer
outputStreamSmart pointer to a stream
averagingPeriodHow often data will be written into the trace file (default, every half second)
Returns
a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved for the lifetime of simulation, otherwise SEGFAULTs are inevitable

Definition at line 161 of file ndn-cs-tracer.cpp.

◆ Destroy()

void ns3::ndn::CsTracer::Destroy ( )
static

Explicit request to remove all statically created tracers.

This method can be helpful if simulation scenario contains several independent run, or if it is desired to do a postprocessing of the resulting data

Definition at line 44 of file ndn-cs-tracer.cpp.

◆ PrintHeader()

void ns3::ndn::CsTracer::PrintHeader ( std::ostream &  os) const

Print head of the trace (e.g., for post-processing)

Parameters
osreference to output stream

Definition at line 228 of file ndn-cs-tracer.cpp.

Referenced by ns3::ndn::operator<<().

◆ Print()

void ns3::ndn::CsTracer::Print ( std::ostream &  os) const

Print current trace data.

Parameters
osreference to output stream

Definition at line 253 of file ndn-cs-tracer.cpp.

References PRINTER.

Referenced by ns3::ndn::operator<<(), and ~CsTracer().


The documentation for this class was generated from the following files: