/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2014 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // // This example is designed to show the main features of an ns3::TimeProbe. // A test object is used to emit values through a trace source. The // example shows three ways to use a ns3::TimeProbe to hook the output // of this trace source (in addition to hooking the raw trace source). // // It produces two types of output. By default, it will generate a // gnuplot of interarrival times. If the '--verbose=1' argument is passed, // it will also generate debugging output of the form (for example): // // Emitting at 96.5378 seconds // context: raw trace source old 0.293343 new 0.00760254 // context: probe1 old 0.293343 new 0.00760254 // context: probe2 old 0.293343 new 0.00760254 // context: probe3 old 0.293343 new 0.00760254 // // The stopTime defaults to 100 seconds but can be changed by an argument. // #include #include "ns3/core-module.h" #include "ns3/time-probe.h" #include "ns3/gnuplot-helper.h" using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TimeProbeExample"); // // This is our test object, an object that emits values according to // a Poisson arrival process. It emits a traced Time value as a // trace source; this takes the value of interarrival time // class Emitter : public Object { public: /** * Register this type. * \return The TypeId. */ static TypeId GetTypeId (void); Emitter (); private: void DoInitialize (void); // void Emit (void); void Emit (void); TracedValue