sources:
generator.cpp (709 bytes)
generator.h (417 bytes)
generator_n.cpp (4.0k)
lbs_i.cpp (2.6k)
lbs_i.h (430 bytes)
lbs_i_n.cpp (4.1k)
lbs_ii.cpp (3.3k)
lbs_ii.h (439 bytes)
lbs_ii_n.cpp (4.1k)
minimumselector.cpp (1.7k)
minimumselector.h (359 bytes)
minimumselector_n.cpp (4.1k)
randomselector.cpp (454 bytes)
randomselector.h (266 bytes)
randomselector_n.cpp (4.1k)
server.cpp (1.6k)
server.h (508 bytes)
server_n.cpp (4.0k)
servicenet_n.cpp (13.6k)
sink.cpp (1.3k)
sink.h (495 bytes)
sink_n.cpp (3.9k)


website:
more info here


screenshot:
studies/performance/Performance-Code5/generator.cpp
download file

  1 #include "generator.h"
  2
  3 Define_Module( Generator );
  4
  5 void Generator::activity()
  6 {
  7     // init counting
  8     messageCount = 0;
  9
 10     // get parameters
 11     double rate = par("rate");
 12     double lambda = 1/rate;
 13     int rg = par("random_generator");
 14    
 15     // create messages
 16     for (;;) {
 17         // create message and send it
 18         cMessage *msg = new cMessage("job");
 19         msg->setTimestamp();
 20         send(msg, "out");
 21         messageCount++;
 22
 23         // wait for exponential time (poisson process!)
 24         double waitTime = exponential(lambda, rg);
 25         wait(waitTime);
 26     }
 27 }
 28
 29 void Generator::finish()
 30 {
 31     ev << "Total messages sent: " << messageCount << endl;
 32 }
 33