utils/bench-event-collector.cc
changeset 1727 064aaa84c103
equal deleted inserted replaced
1726:1aece815a3ba 1727:064aaa84c103
       
     1 #include <iostream>
       
     2 #include <vector>
       
     3 #include <stdlib.h>
       
     4 #include "ns3/event-collector.h"
       
     5 #include "ns3/simulator.h"
       
     6 
       
     7 using namespace ns3;
       
     8 
       
     9 void Foo ()
       
    10 {
       
    11 
       
    12 }
       
    13 
       
    14 int main (int argc, char *argv[])
       
    15 {
       
    16     EventCollector events;
       
    17 
       
    18     if (argc < 3)
       
    19     {
       
    20         std::cerr << "usage: bench-event-collector NUM_EVENTS NUM_REPETITIONS" << std::endl;
       
    21         return 1;
       
    22     }
       
    23     int numEvents = atoi (argv[1]);
       
    24     int numRepetitions = atoi (argv[2]);
       
    25     
       
    26     for (int repetition = 0; repetition < numRepetitions; ++repetition)
       
    27     {
       
    28         for (int n = 0; n < numEvents; ++n)
       
    29         {
       
    30             events.Track (Simulator::Schedule (Simulator::Now (), Foo));
       
    31         }
       
    32         Simulator::Run ();
       
    33     }
       
    34 }
       
    35