From 8ec1411b49671463e9bd3da478cdd59166ebb1f2 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 30 Jul 2007 14:22:12 +0100 Subject: [PATCH] Add simple EventCollector benchmark --- utils/bench-event-collector.cc | 35 ++++++++++++++++++++++++++++++++++ utils/wscript | 3 +++ 2 files changed, 38 insertions(+) create mode 100644 utils/bench-event-collector.cc diff --git a/utils/bench-event-collector.cc b/utils/bench-event-collector.cc new file mode 100644 index 000000000..2e3110476 --- /dev/null +++ b/utils/bench-event-collector.cc @@ -0,0 +1,35 @@ +#include +#include +#include +#include "ns3/event-collector.h" +#include "ns3/simulator.h" + +using namespace ns3; + +void Foo () +{ + +} + +int main (int argc, char *argv[]) +{ + EventCollector events; + + if (argc < 3) + { + std::cerr << "usage: bench-event-collector NUM_EVENTS NUM_REPETITIONS" << std::endl; + return 1; + } + int numEvents = atoi (argv[1]); + int numRepetitions = atoi (argv[2]); + + for (int repetition = 0; repetition < numRepetitions; ++repetition) + { + for (int n = 0; n < numEvents; ++n) + { + events.Track (Simulator::Schedule (Simulator::Now (), Foo)); + } + Simulator::Run (); + } +} + diff --git a/utils/wscript b/utils/wscript index 27c509c01..739861360 100644 --- a/utils/wscript +++ b/utils/wscript @@ -21,3 +21,6 @@ def build(bld): obj = create_ns_prog('replay-simulation', 'replay-simulation.cc') obj.uselib_local = "ns3-core ns3-common ns3-simulator" + + obj = create_ns_prog('bench-event-collector', 'bench-event-collector.cc') + obj.uselib_local = "ns3-simulator"