Compare commits
5 Commits
ns-3.3-RC4
...
ns-3.3-RC6
| Author | SHA1 | Date | |
|---|---|---|---|
| e79dc16688 | |||
| b75c526925 | |||
| 2cc80c1a06 | |||
| 25e04db1a2 | |||
| d803d31330 |
@@ -27,3 +27,5 @@ f33cbf6b051c51d92db41b6fa825437958fbf801 ns-3.3-RC1
|
||||
a84f2ab246e691a88b527a84ce21896b95080070 ns-3.3-RC1
|
||||
654eed5f3ad03c04c2bcfb6852b5b4ae94260bc6 ns-3.3-RC2
|
||||
a66553c56a8f14644af6c229c83bb0a653cb3f32 ns-3.3-RC3
|
||||
dfd0bc16dc991313896f351530a3dc5a25f62e15 ns-3.3-RC4
|
||||
58ae52c5845ff03ba08dc921e13e6cf3604c810a ns-3.3-RC5
|
||||
|
||||
@@ -105,6 +105,13 @@ familiar to you so far.
|
||||
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
|
||||
@end verbatim
|
||||
|
||||
A fixed seed is provided to the random number generators so that they will
|
||||
generate repeatable results.
|
||||
|
||||
@verbatim
|
||||
RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
|
||||
@end verbatim
|
||||
|
||||
Next, you will see some familiar code that will allow you to change the number
|
||||
of devices on the CSMA network via command line argument. We did something
|
||||
similar when we allowed the number of packets sent to be changed in the section
|
||||
@@ -657,6 +664,13 @@ the simulation.
|
||||
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
|
||||
@end verbatim
|
||||
|
||||
A fixed seed is provided to the random number generators so that they will
|
||||
generate repeatable results.
|
||||
|
||||
@verbatim
|
||||
RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
|
||||
@end verbatim
|
||||
|
||||
Next, you will see more familiar code that will allow you to change the number
|
||||
of devices on the CSMA and Wifi networks via command line argument.
|
||||
|
||||
|
||||
@@ -362,6 +362,21 @@ enable on each component. These two lines of code enable debug logging at the
|
||||
INFO level for echo clients and servers. This will result in the application
|
||||
printing out messages as packets are sent and received during the simulation.
|
||||
|
||||
The next line of code is used to give a fixed seed to the random number
|
||||
generators so that they will generate repeatable results. In the example
|
||||
programs, it allows us to thouroughly document the output of the trace files
|
||||
in a consistent way. Having a fixed seed also allows us to use the examples
|
||||
in our regression testing framework.
|
||||
|
||||
@verbatim
|
||||
RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
|
||||
@end verbatim
|
||||
|
||||
Random variables are very important in understanding how to get repeatable
|
||||
results, so you are encouraged to read the Doxygen and manual sections to
|
||||
understand what is going on there. For us, the main concern is in making
|
||||
random backoff algorithms consistent across runs.
|
||||
|
||||
Now we will get directly to the business of creating a topology and running
|
||||
a simulation. We use the topology helper objects to make this job as
|
||||
easy as possible.
|
||||
|
||||
@@ -29,6 +29,8 @@ main (int argc, char *argv[])
|
||||
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
|
||||
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
|
||||
|
||||
RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
|
||||
|
||||
NodeContainer nodes;
|
||||
nodes.Create (2);
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ main (int argc, char *argv[])
|
||||
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
|
||||
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
|
||||
|
||||
RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
|
||||
|
||||
uint32_t nCsma = 3;
|
||||
CommandLine cmd;
|
||||
cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma);
|
||||
|
||||
@@ -43,6 +43,8 @@ main (int argc, char *argv[])
|
||||
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
|
||||
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
|
||||
|
||||
RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
|
||||
|
||||
uint32_t nCsma = 3;
|
||||
uint32_t nWifi = 3;
|
||||
CommandLine cmd;
|
||||
|
||||
@@ -108,6 +108,15 @@ V4Ping::Receive (Ptr<Socket> socket)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
V4Ping::Write32 (uint8_t *buffer, uint32_t data)
|
||||
{
|
||||
buffer[0] = (data >> 0) & 0xff;
|
||||
buffer[1] = (data >> 8) & 0xff;
|
||||
buffer[2] = (data >> 16) & 0xff;
|
||||
buffer[3] = (data >> 24) & 0xff;
|
||||
}
|
||||
|
||||
void
|
||||
V4Ping::StartApplication (void)
|
||||
{
|
||||
@@ -128,13 +137,28 @@ V4Ping::StartApplication (void)
|
||||
echo.SetSequenceNumber (m_seq);
|
||||
m_seq++;
|
||||
echo.SetIdentifier (0);
|
||||
uint32_t data[4];
|
||||
data[0] = GetNode ()->GetId ();
|
||||
data[1] = GetApplicationId ();
|
||||
|
||||
//
|
||||
// We must write quantities out in some form of network order. Since there
|
||||
// isn't an htonl to work with we just follow the convention in pcap traces
|
||||
// (where any difference would show up anyway) and borrow that code. Don't
|
||||
// be too surprised when you see that this is a little endian convention.
|
||||
//
|
||||
uint8_t data[4 * sizeof(uint32_t)];
|
||||
uint32_t tmp = GetNode ()->GetId ();
|
||||
Write32 (&data[0 * sizeof(uint32_t)], tmp);
|
||||
|
||||
tmp = GetApplicationId ();
|
||||
Write32 (&data[1 * sizeof(uint32_t)], tmp);
|
||||
|
||||
int64_t now = Simulator::Now ().GetTimeStep ();
|
||||
data[2] = now & 0xffffffff;
|
||||
tmp = now & 0xffffffff;
|
||||
Write32 (&data[2 * sizeof(uint32_t)], tmp);
|
||||
|
||||
now >>= 32;
|
||||
data[3] = now & 0xffffffff;
|
||||
tmp = now & 0xffffffff;
|
||||
Write32 (&data[3 * sizeof(uint32_t)], tmp);
|
||||
|
||||
Ptr<Packet> dataPacket = Create<Packet> ((uint8_t *) &data, 16);
|
||||
echo.SetData (dataPacket);
|
||||
p->AddHeader (echo);
|
||||
|
||||
@@ -18,6 +18,8 @@ public:
|
||||
virtual ~V4Ping ();
|
||||
|
||||
private:
|
||||
void Write32 (uint8_t *buffer, uint32_t data);
|
||||
|
||||
// inherited from Application base class.
|
||||
virtual void StartApplication (void);
|
||||
virtual void StopApplication (void);
|
||||
|
||||
@@ -492,9 +492,11 @@ def shutdown():
|
||||
if not regression_traces:
|
||||
regression_traces = None
|
||||
try:
|
||||
regression.run_regression(regression_traces)
|
||||
retval = regression.run_regression(regression_traces)
|
||||
finally:
|
||||
os.chdir(_dir)
|
||||
if retval:
|
||||
sys.exit(retval)
|
||||
|
||||
if Params.g_options.lcov_report:
|
||||
lcov_report()
|
||||
|
||||
Reference in New Issue
Block a user