Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 UCLA |
| 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 | #include "ndn-l3-rate-tracer.h" |
| 22 | #include "ns3/node.h" |
| 23 | #include "ns3/packet.h" |
| 24 | #include "ns3/config.h" |
| 25 | #include "ns3/callback.h" |
| 26 | #include "ns3/simulator.h" |
| 27 | #include "ns3/log.h" |
| 28 | #include "ns3/node-list.h" |
| 29 | |
| 30 | #include "ns3/ndn-app.h" |
| 31 | #include "ns3/ndn-face.h" |
| 32 | #include "ns3/ndn-interest.h" |
| 33 | #include "ns3/ndn-content-object.h" |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 34 | #include "ns3/ndn-pit-entry.h" |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 35 | |
| 36 | #include <fstream> |
| 37 | #include <boost/lexical_cast.hpp> |
| 38 | |
| 39 | using namespace boost; |
| 40 | using namespace std; |
| 41 | |
| 42 | NS_LOG_COMPONENT_DEFINE ("ndn.L3RateTracer"); |
| 43 | |
| 44 | namespace ns3 { |
| 45 | namespace ndn { |
| 46 | |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 47 | template<class T> |
| 48 | static inline void |
| 49 | NullDeleter (T *ptr) |
| 50 | { |
| 51 | } |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 52 | |
| 53 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<L3RateTracer> > > |
| 54 | L3RateTracer::InstallAll (const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/) |
| 55 | { |
| 56 | std::list<Ptr<L3RateTracer> > tracers; |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 57 | boost::shared_ptr<std::ostream> outputStream; |
| 58 | if (file != "-") |
| 59 | { |
| 60 | boost::shared_ptr<std::ofstream> os (new std::ofstream ()); |
| 61 | os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc); |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 62 | |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 63 | if (!os->is_open ()) |
| 64 | return boost::make_tuple (outputStream, tracers); |
| 65 | |
| 66 | outputStream = os; |
| 67 | } |
| 68 | else |
| 69 | { |
| 70 | outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>); |
| 71 | } |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 72 | |
| 73 | for (NodeList::Iterator node = NodeList::Begin (); |
| 74 | node != NodeList::End (); |
| 75 | node++) |
| 76 | { |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 77 | Ptr<L3RateTracer> trace = Install (*node, outputStream, averagingPeriod); |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 78 | tracers.push_back (trace); |
| 79 | } |
| 80 | |
| 81 | if (tracers.size () > 0) |
| 82 | { |
| 83 | // *m_l3RateTrace << "# "; // not necessary for R's read.table |
| 84 | tracers.front ()->PrintHeader (*outputStream); |
| 85 | *outputStream << "\n"; |
| 86 | } |
| 87 | |
| 88 | return boost::make_tuple (outputStream, tracers); |
| 89 | } |
| 90 | |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 91 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<L3RateTracer> > > |
| 92 | L3RateTracer::Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/) |
| 93 | { |
| 94 | using namespace boost; |
| 95 | using namespace std; |
| 96 | |
| 97 | std::list<Ptr<L3RateTracer> > tracers; |
| 98 | boost::shared_ptr<std::ostream> outputStream; |
| 99 | if (file != "-") |
| 100 | { |
| 101 | boost::shared_ptr<std::ofstream> os (new std::ofstream ()); |
| 102 | os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc); |
| 103 | |
| 104 | if (!os->is_open ()) |
| 105 | return boost::make_tuple (outputStream, tracers); |
| 106 | |
| 107 | outputStream = os; |
| 108 | } |
| 109 | else |
| 110 | { |
| 111 | outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>); |
| 112 | } |
| 113 | |
| 114 | for (NodeContainer::Iterator node = nodes.Begin (); |
| 115 | node != nodes.End (); |
| 116 | node++) |
| 117 | { |
| 118 | Ptr<L3RateTracer> trace = Install (*node, outputStream, averagingPeriod); |
| 119 | tracers.push_back (trace); |
| 120 | } |
| 121 | |
| 122 | if (tracers.size () > 0) |
| 123 | { |
| 124 | // *m_l3RateTrace << "# "; // not necessary for R's read.table |
| 125 | tracers.front ()->PrintHeader (*outputStream); |
| 126 | *outputStream << "\n"; |
| 127 | } |
| 128 | |
| 129 | return boost::make_tuple (outputStream, tracers); |
| 130 | } |
| 131 | |
| 132 | boost::tuple< boost::shared_ptr<std::ostream>, std::list<Ptr<L3RateTracer> > > |
| 133 | L3RateTracer::Install (Ptr<Node> node, const std::string &file, Time averagingPeriod/* = Seconds (0.5)*/) |
| 134 | { |
| 135 | using namespace boost; |
| 136 | using namespace std; |
| 137 | |
| 138 | std::list<Ptr<L3RateTracer> > tracers; |
| 139 | boost::shared_ptr<std::ostream> outputStream; |
| 140 | if (file != "-") |
| 141 | { |
| 142 | boost::shared_ptr<std::ofstream> os (new std::ofstream ()); |
| 143 | os->open (file.c_str (), std::ios_base::out | std::ios_base::trunc); |
| 144 | |
| 145 | if (!os->is_open ()) |
| 146 | return boost::make_tuple (outputStream, tracers); |
| 147 | |
| 148 | outputStream = os; |
| 149 | } |
| 150 | else |
| 151 | { |
| 152 | outputStream = boost::shared_ptr<std::ostream> (&std::cout, NullDeleter<std::ostream>); |
| 153 | } |
| 154 | |
| 155 | Ptr<L3RateTracer> trace = Install (node, outputStream, averagingPeriod); |
| 156 | tracers.push_back (trace); |
| 157 | |
| 158 | if (tracers.size () > 0) |
| 159 | { |
| 160 | // *m_l3RateTrace << "# "; // not necessary for R's read.table |
| 161 | tracers.front ()->PrintHeader (*outputStream); |
| 162 | *outputStream << "\n"; |
| 163 | } |
| 164 | |
| 165 | return boost::make_tuple (outputStream, tracers); |
| 166 | } |
| 167 | |
| 168 | |
| 169 | Ptr<L3RateTracer> |
| 170 | L3RateTracer::Install (Ptr<Node> node, |
| 171 | boost::shared_ptr<std::ostream> outputStream, |
| 172 | Time averagingPeriod/* = Seconds (0.5)*/) |
| 173 | { |
| 174 | NS_LOG_DEBUG ("Node: " << node->GetId ()); |
| 175 | |
| 176 | Ptr<L3RateTracer> trace = Create<L3RateTracer> (outputStream, node); |
| 177 | trace->SetAveragingPeriod (averagingPeriod); |
| 178 | |
| 179 | return trace; |
| 180 | } |
| 181 | |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 182 | |
| 183 | L3RateTracer::L3RateTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node) |
| 184 | : L3Tracer (node) |
| 185 | , m_os (os) |
| 186 | { |
| 187 | SetAveragingPeriod (Seconds (1.0)); |
| 188 | } |
| 189 | |
| 190 | L3RateTracer::L3RateTracer (boost::shared_ptr<std::ostream> os, const std::string &node) |
| 191 | : L3Tracer (node) |
| 192 | , m_os (os) |
| 193 | { |
| 194 | SetAveragingPeriod (Seconds (1.0)); |
| 195 | } |
| 196 | |
| 197 | L3RateTracer::~L3RateTracer () |
| 198 | { |
| 199 | m_printEvent.Cancel (); |
| 200 | } |
| 201 | |
| 202 | void |
| 203 | L3RateTracer::SetAveragingPeriod (const Time &period) |
| 204 | { |
| 205 | m_period = period; |
| 206 | m_printEvent.Cancel (); |
| 207 | m_printEvent = Simulator::Schedule (m_period, &L3RateTracer::PeriodicPrinter, this); |
| 208 | } |
| 209 | |
| 210 | void |
| 211 | L3RateTracer::PeriodicPrinter () |
| 212 | { |
| 213 | Print (*m_os); |
| 214 | Reset (); |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 215 | |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 216 | m_printEvent = Simulator::Schedule (m_period, &L3RateTracer::PeriodicPrinter, this); |
| 217 | } |
| 218 | |
| 219 | void |
| 220 | L3RateTracer::PrintHeader (std::ostream &os) const |
| 221 | { |
| 222 | os << "Time" << "\t" |
| 223 | |
| 224 | << "Node" << "\t" |
| 225 | << "FaceId" << "\t" |
| 226 | << "FaceDescr" << "\t" |
| 227 | |
| 228 | << "Type" << "\t" |
| 229 | << "Packets" << "\t" |
| 230 | << "Kilobytes" << "\t" |
| 231 | << "PacketRaw" << "\t" |
| 232 | << "KilobytesRaw"; |
| 233 | } |
| 234 | |
| 235 | void |
| 236 | L3RateTracer::Reset () |
| 237 | { |
| 238 | for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats> >::iterator stats = m_stats.begin (); |
| 239 | stats != m_stats.end (); |
| 240 | stats++) |
| 241 | { |
| 242 | stats->second.get<0> ().Reset (); |
| 243 | stats->second.get<1> ().Reset (); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | const double alpha = 0.8; |
| 248 | |
| 249 | #define STATS(INDEX) stats->second.get<INDEX> () |
| 250 | #define RATE(INDEX, fieldName) STATS(INDEX).fieldName / m_period.ToDouble (Time::S) |
| 251 | |
| 252 | #define PRINTER(printName, fieldName) \ |
| 253 | STATS(2).fieldName = /*new value*/alpha * RATE(0, fieldName) + /*old value*/(1-alpha) * STATS(2).fieldName; \ |
| 254 | STATS(3).fieldName = /*new value*/alpha * RATE(1, fieldName) / 1024.0 + /*old value*/(1-alpha) * STATS(3).fieldName; \ |
| 255 | \ |
| 256 | os << time.ToDouble (Time::S) << "\t" \ |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 257 | << m_node << "\t"; \ |
| 258 | if (stats->first) \ |
| 259 | { \ |
| 260 | os \ |
| 261 | << stats->first->GetId () << "\t" \ |
| 262 | << *stats->first << "\t"; \ |
| 263 | } \ |
| 264 | else \ |
| 265 | { \ |
| 266 | os << "-1\tall\t"; \ |
| 267 | } \ |
| 268 | os \ |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 269 | << printName << "\t" \ |
| 270 | << STATS(2).fieldName << "\t" \ |
| 271 | << STATS(3).fieldName << "\t" \ |
| 272 | << STATS(0).fieldName << "\t" \ |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 273 | << STATS(1).fieldName / 1024.0 << "\n"; |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 274 | |
| 275 | void |
| 276 | L3RateTracer::Print (std::ostream &os) const |
| 277 | { |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 278 | Time time = Simulator::Now (); |
| 279 | |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 280 | for (std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats> >::iterator stats = m_stats.begin (); |
| 281 | stats != m_stats.end (); |
| 282 | stats++) |
| 283 | { |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 284 | if (!stats->first) |
| 285 | continue; |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 286 | |
| 287 | PRINTER ("InInterests", m_inInterests); |
| 288 | PRINTER ("OutInterests", m_outInterests); |
Alexander Afanasyev | f1a4f1e | 2013-03-18 08:37:49 -0600 | [diff] [blame] | 289 | PRINTER ("DropInterests", m_dropInterests); |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 290 | |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 291 | PRINTER ("InNacks", m_inNacks); |
| 292 | PRINTER ("OutNacks", m_outNacks); |
Alexander Afanasyev | f1a4f1e | 2013-03-18 08:37:49 -0600 | [diff] [blame] | 293 | PRINTER ("DropNacks", m_dropNacks); |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 294 | |
| 295 | PRINTER ("InData", m_inData); |
| 296 | PRINTER ("OutData", m_outData); |
Alexander Afanasyev | f1a4f1e | 2013-03-18 08:37:49 -0600 | [diff] [blame] | 297 | PRINTER ("DropData", m_dropData); |
Alexander Afanasyev | bf93929 | 2013-07-15 10:10:01 -0700 | [diff] [blame] | 298 | |
| 299 | PRINTER ("InSatisfiedInterests", m_satisfiedInterests); |
| 300 | PRINTER ("InTimedOutInterests", m_timedOutInterests); |
| 301 | |
| 302 | PRINTER ("OutSatisfiedInterests", m_outSatisfiedInterests); |
| 303 | PRINTER ("OutTimedOutInterests", m_outTimedOutInterests); |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 304 | } |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 305 | |
| 306 | { |
| 307 | std::map<Ptr<const Face>, boost::tuple<Stats, Stats, Stats, Stats> >::iterator stats = m_stats.find (Ptr<const Face> (0)); |
Alexander Afanasyev | 6692e0b | 2013-05-06 10:38:50 -0700 | [diff] [blame] | 308 | if (stats != m_stats.end ()) |
| 309 | { |
| 310 | PRINTER ("SatisfiedInterests", m_satisfiedInterests); |
| 311 | PRINTER ("TimedOutInterests", m_timedOutInterests); |
| 312 | } |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 313 | } |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | |
| 317 | void |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 318 | L3RateTracer::OutInterests (Ptr<const Interest> header, Ptr<const Face> face) |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 319 | { |
| 320 | m_stats[face].get<0> ().m_outInterests ++; |
| 321 | m_stats[face].get<1> ().m_outInterests += header->GetSerializedSize (); |
| 322 | } |
| 323 | |
| 324 | void |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 325 | L3RateTracer::InInterests (Ptr<const Interest> header, Ptr<const Face> face) |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 326 | { |
| 327 | m_stats[face].get<0> ().m_inInterests ++; |
| 328 | m_stats[face].get<1> ().m_inInterests += header->GetSerializedSize (); |
| 329 | } |
| 330 | |
| 331 | void |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 332 | L3RateTracer::DropInterests (Ptr<const Interest> header, Ptr<const Face> face) |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 333 | { |
| 334 | m_stats[face].get<0> ().m_dropInterests ++; |
| 335 | m_stats[face].get<1> ().m_dropInterests += header->GetSerializedSize (); |
| 336 | } |
| 337 | |
| 338 | void |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 339 | L3RateTracer::OutNacks (Ptr<const Interest> header, Ptr<const Face> face) |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 340 | { |
| 341 | m_stats[face].get<0> ().m_outNacks ++; |
| 342 | m_stats[face].get<1> ().m_outNacks += header->GetSerializedSize (); |
| 343 | } |
| 344 | |
| 345 | void |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 346 | L3RateTracer::InNacks (Ptr<const Interest> header, Ptr<const Face> face) |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 347 | { |
| 348 | m_stats[face].get<0> ().m_inNacks ++; |
| 349 | m_stats[face].get<1> ().m_inNacks += header->GetSerializedSize (); |
| 350 | } |
| 351 | |
| 352 | void |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 353 | L3RateTracer::DropNacks (Ptr<const Interest> header, Ptr<const Face> face) |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 354 | { |
| 355 | m_stats[face].get<0> ().m_dropNacks ++; |
| 356 | m_stats[face].get<1> ().m_dropNacks += header->GetSerializedSize (); |
| 357 | } |
| 358 | |
| 359 | void |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 360 | L3RateTracer::OutData (Ptr<const ContentObject> header, Ptr<const Packet> payload, |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 361 | bool fromCache, Ptr<const Face> face) |
| 362 | { |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 363 | m_stats[face].get<0> ().m_outData ++; |
| 364 | m_stats[face].get<1> ().m_outData += header->GetSerializedSize () + payload->GetSize (); |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | void |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 368 | L3RateTracer::InData (Ptr<const ContentObject> header, Ptr<const Packet> payload, |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 369 | Ptr<const Face> face) |
| 370 | { |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 371 | m_stats[face].get<0> ().m_inData ++; |
| 372 | m_stats[face].get<1> ().m_inData += header->GetSerializedSize () + payload->GetSize (); |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | void |
Alexander Afanasyev | 5352af3 | 2013-07-15 09:51:28 -0700 | [diff] [blame] | 376 | L3RateTracer::DropData (Ptr<const ContentObject> header, Ptr<const Packet> payload, |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 377 | Ptr<const Face> face) |
| 378 | { |
| 379 | m_stats[face].get<0> ().m_dropData ++; |
| 380 | m_stats[face].get<1> ().m_dropData += header->GetSerializedSize () + payload->GetSize (); |
| 381 | } |
| 382 | |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 383 | void |
Alexander Afanasyev | bf93929 | 2013-07-15 10:10:01 -0700 | [diff] [blame] | 384 | L3RateTracer::SatisfiedInterests (Ptr<const pit::Entry> entry) |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 385 | { |
| 386 | m_stats[0].get<0> ().m_satisfiedInterests ++; |
| 387 | // no "size" stats |
Alexander Afanasyev | bf93929 | 2013-07-15 10:10:01 -0700 | [diff] [blame] | 388 | |
| 389 | for (pit::Entry::in_container::const_iterator i = entry->GetIncoming ().begin (); |
| 390 | i != entry->GetIncoming ().end (); |
| 391 | i++) |
| 392 | { |
| 393 | m_stats[i->m_face].get<0> ().m_satisfiedInterests ++; |
| 394 | } |
| 395 | |
| 396 | for (pit::Entry::out_container::const_iterator i = entry->GetOutgoing ().begin (); |
| 397 | i != entry->GetOutgoing ().end (); |
| 398 | i++) |
| 399 | { |
| 400 | m_stats[i->m_face].get<0> ().m_outSatisfiedInterests ++; |
| 401 | } |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 402 | } |
| 403 | |
| 404 | void |
Alexander Afanasyev | bf93929 | 2013-07-15 10:10:01 -0700 | [diff] [blame] | 405 | L3RateTracer::TimedOutInterests (Ptr<const pit::Entry> entry) |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 406 | { |
| 407 | m_stats[0].get<0> ().m_timedOutInterests ++; |
| 408 | // no "size" stats |
Alexander Afanasyev | bf93929 | 2013-07-15 10:10:01 -0700 | [diff] [blame] | 409 | |
| 410 | for (pit::Entry::in_container::const_iterator i = entry->GetIncoming ().begin (); |
| 411 | i != entry->GetIncoming ().end (); |
| 412 | i++) |
| 413 | { |
| 414 | m_stats[i->m_face].get<0> ().m_timedOutInterests ++; |
| 415 | } |
| 416 | |
| 417 | for (pit::Entry::out_container::const_iterator i = entry->GetOutgoing ().begin (); |
| 418 | i != entry->GetOutgoing ().end (); |
| 419 | i++) |
| 420 | { |
| 421 | m_stats[i->m_face].get<0> ().m_outTimedOutInterests ++; |
| 422 | } |
Alexander Afanasyev | 37b84c5 | 2013-04-26 13:38:52 -0700 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | |
Alexander Afanasyev | c9d5c1a | 2012-11-21 18:00:26 -0800 | [diff] [blame] | 426 | } // namespace ndn |
| 427 | } // namespace ns3 |