From 203c408a6743b7db9aceb4487cd5a697f173191a Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Wed, 15 Oct 2014 07:06:11 -0700 Subject: [PATCH] add TimeProbe class to data collection framework --- CHANGES.html | 5 + RELEASE_NOTES | 2 + doc/tutorial/source/data-collection.rst | 2 + src/stats/doc/data-collection-helpers.rst | 1 + src/stats/doc/scope-and-limitations.rst | 1 + src/stats/examples/time-probe-example.cc | 247 ++++++++++++++++++++++ src/stats/examples/wscript | 3 + src/stats/helper/file-helper.cc | 7 + src/stats/helper/gnuplot-helper.cc | 7 + src/stats/model/time-probe.cc | 111 ++++++++++ src/stats/model/time-probe.h | 110 ++++++++++ src/stats/wscript | 2 + 12 files changed, 498 insertions(+) create mode 100644 src/stats/examples/time-probe-example.cc create mode 100644 src/stats/model/time-probe.cc create mode 100644 src/stats/model/time-probe.h diff --git a/CHANGES.html b/CHANGES.html index e514e6c17..8dfa01ef0 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -57,6 +57,11 @@ us a note on ns-developers mailing list.

  • It is now possible to print the Neighbor Cache (ARP and NDISC) by using the RoutingProtocolHelper
  • +
  • A TimeProbe class has been added to the data collection framework in + the stats module, enabling TracedValues emitting values of type + ns3::Time to be handled by the framework. +
  • +

    Changes to existing API:

    diff --git a/RELEASE_NOTES b/RELEASE_NOTES index e62e447f5..869c388bf 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -25,6 +25,8 @@ New user-visible features the RoutingProtocolHelper - The PrintRoutingTable... and PrintNeighborCache... are now static funtions i.e., it's not anymore needed to instantiate an helper just to use them. +- A new TimeProbe class has been added to hook the data collection framework + to traced values emitting Time objects Bugs fixed ---------- diff --git a/doc/tutorial/source/data-collection.rst b/doc/tutorial/source/data-collection.rst index 79b8d5998..793115db9 100644 --- a/doc/tutorial/source/data-collection.rst +++ b/doc/tutorial/source/data-collection.rst @@ -359,6 +359,8 @@ The following traced values are supported with Probes as of this writing: +------------------+-------------------+------------------------------------+ | bool | BooleanProbe | stats/model/uinteger-16-probe.h | +------------------+-------------------+------------------------------------+ + | ns3::Time | TimeProbe | stats/model/time-probe.h | + +------------------+-------------------+------------------------------------+ The following TraceSource types are supported by Probes as of this writing: diff --git a/src/stats/doc/data-collection-helpers.rst b/src/stats/doc/data-collection-helpers.rst index 1514c5301..3db67ff0e 100644 --- a/src/stats/doc/data-collection-helpers.rst +++ b/src/stats/doc/data-collection-helpers.rst @@ -605,6 +605,7 @@ to the GnuplotHelper and to the FileHelper: - Uinteger8Probe - Uinteger16Probe - Uinteger32Probe +- TimeProbe - PacketProbe - ApplicationPacketProbe - Ipv4PacketProbe diff --git a/src/stats/doc/scope-and-limitations.rst b/src/stats/doc/scope-and-limitations.rst index 5bb3597ae..f01164db4 100644 --- a/src/stats/doc/scope-and-limitations.rst +++ b/src/stats/doc/scope-and-limitations.rst @@ -18,6 +18,7 @@ Currently, only these Probes have been implemented in DCF: - Uinteger8Probe - Uinteger16Probe - Uinteger32Probe +- TimeProbe - PacketProbe - ApplicationPacketProbe - Ipv4PacketProbe diff --git a/src/stats/examples/time-probe-example.cc b/src/stats/examples/time-probe-example.cc new file mode 100644 index 000000000..4d10fc3ed --- /dev/null +++ b/src/stats/examples/time-probe-example.cc @@ -0,0 +1,247 @@ +/* -*- 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: + static TypeId GetTypeId (void); + Emitter (); +private: + void DoInitialize (void); +// void Emit (void); + void Emit (void); + + TracedValue