OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2013 University of Washington | 3 * Copyright (c) 2013 University of Washington |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // | 115 // |
116 | 116 |
117 // Create the gnuplot helper. | 117 // Create the gnuplot helper. |
118 GnuplotHelper plotHelper; | 118 GnuplotHelper plotHelper; |
119 | 119 |
120 // Configure the plot. Arguments include file prefix, plot title, | 120 // Configure the plot. Arguments include file prefix, plot title, |
121 // x-label, y-label, and output file type | 121 // x-label, y-label, and output file type |
122 plotHelper.ConfigurePlot ("gnuplot-helper-example", | 122 plotHelper.ConfigurePlot ("gnuplot-helper-example", |
123 "Emitter Count vs. Time", | 123 "Emitter Count vs. Time", |
124 "Time (Seconds)", | 124 "Time (Seconds)", |
125 "Emitter Count", | 125 "Emitter Count"); |
126 "png"); | 126 |
| 127 // Set collector type to EventDrivenCollector |
| 128 plotHelper.SetCollectorType("ns3::EventDrivenCollector"); |
127 | 129 |
| 130 // Uncomment the code below to set up a TimeSeriesCollector with a· |
| 131 // data collection period of 3 seconds. |
| 132 // |
| 133 //plotHelper.SetCollectorType("ns3::TimeSeriesCollector"); |
| 134 //plotHelper.SetTimeSeriesCollectorPeriod(Seconds(3)); |
| 135 |
| 136 plotHelper.SetScalingFactor(10); |
| 137 ·· |
128 // Create a probe. Because the trace source we are interested in is· | 138 // Create a probe. Because the trace source we are interested in is· |
129 // of type uint32_t, we specify the type of probe to use by the first | 139 // of type uint32_t, we specify the type of probe to use by the first |
130 // argument specifying its ns3 TypeId. | 140 // argument specifying its ns3 TypeId. |
131 plotHelper.PlotProbe ("ns3::Uinteger32Probe", | 141 plotHelper.AddProbe("ns3::Uinteger32Probe", |
132 "/Names/Emitter/Counter", | 142 "/Names/Emitter/Counter", |
133 "Output", | 143 "Output", |
134 "Emitter Count", | 144 "Emitter Count"); |
135 GnuplotAggregator::KEY_INSIDE); | 145 |
136 | 146 |
137 // The Emitter object is not associated with an ns-3 node, so | 147 // The Emitter object is not associated with an ns-3 node, so |
138 // it won't get started automatically, so we need to do this ourselves | 148 // it won't get started automatically, so we need to do this ourselves |
139 Simulator::Schedule (Seconds (0.0), &Emitter::Initialize, emitter); | 149 Simulator::Schedule (Seconds (0.0), &Emitter::Initialize, emitter); |
140 | 150 |
141 Simulator::Stop (Seconds (100.0)); | 151 Simulator::Stop (Seconds (100.0)); |
142 Simulator::Run (); | 152 Simulator::Run (); |
143 Simulator::Destroy (); | 153 Simulator::Destroy (); |
144 | 154 |
145 return 0; | 155 return 0; |
146 } | 156 } |
OLD | NEW |