OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 // DARPA NMS Campus Network Model |
| 3 // |
| 4 // - This topology replicates the original NMS Campus Network model |
| 5 // with the exception of chord links (which were never utilized in the |
| 6 // original model) |
| 7 // - Link Bandwidths and Delays may not be the same as the original |
| 8 // specifications· |
| 9 // |
| 10 // (c)2009, GTech Systems, Inc. - Alfred Park <park@gtech-systems.com> |
| 11 |
| 12 // for timing functions |
| 13 #include <cstdlib> |
| 14 #include <sys/time.h> |
| 15 #include <fstream> |
| 16 |
| 17 #include "ns3/core-module.h" |
| 18 #include "ns3/simulator-module.h" |
| 19 #include "ns3/node-module.h" |
| 20 #include "ns3/helper-module.h" |
| 21 #include "ns3/global-routing-module.h" |
| 22 #include "ns3/onoff-application.h" |
| 23 #include "ns3/packet-sink.h" |
| 24 #include "ns3/point-to-point-net-device.h" |
| 25 #include "ns3/simulator.h" |
| 26 |
| 27 using namespace std; |
| 28 using namespace ns3; |
| 29 |
| 30 typedef struct timeval TIMER_TYPE; |
| 31 #define TIMER_NOW(_t) gettimeofday(&_t,NULL); |
| 32 #define TIMER_SECONDS(_t) ((double)(_t).tv_sec + (_t).tv_usec*1e-6) |
| 33 #define TIMER_DIFF(_t1, _t2) (TIMER_SECONDS(_t1)-TIMER_SECONDS(_t2)) |
| 34 |
| 35 NS_LOG_COMPONENT_DEFINE ("CampusNetworkModel"); |
| 36 |
| 37 void Progress () |
| 38 { |
| 39 Time now = Simulator::Now (); |
| 40 Simulator::Schedule (Seconds (0.1), Progress); |
| 41 } |
| 42 |
| 43 int |
| 44 main (int argc, char *argv[]) |
| 45 { |
| 46 //Config::SetDefault ("ns3::Simulator::SchedulerType", StringValue ("ns3::Cale
ndarScheduler")); |
| 47 TIMER_TYPE t0, t1, t2; |
| 48 TIMER_NOW(t0); |
| 49 cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << endl; |
| 50 LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO); |
| 51 |
| 52 //RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8); |
| 53 |
| 54 int nCN = 2, nLANClients = 42; |
| 55 bool nix = true; |
| 56 |
| 57 CommandLine cmd; |
| 58 cmd.AddValue ("CN", "Number of total CNs [2]", nCN); |
| 59 cmd.AddValue ("LAN", "Number of nodes per LAN [42]", nLANClients); |
| 60 cmd.AddValue ("NIX", "Toggle nix-vector routing", nix); |
| 61 cmd.Parse (argc,argv); |
| 62 |
| 63 if (nCN < 2)· |
| 64 { |
| 65 cout << "Number of total CNs (" << nCN << ") lower than minimum of 2" |
| 66 << endl; |
| 67 return 1; |
| 68 } |
| 69 |
| 70 cout << "Number of CNs: " << nCN << ", LAN nodes: " << nLANClients << endl; |
| 71 |
| 72 NodeContainer nodes_net0[nCN][3], nodes_net1[nCN][6], nodes_netLR[nCN], |
| 73 nodes_net2[nCN][14], nodes_net2LAN[nCN][7][nLANClients], |
| 74 nodes_net3[nCN][9], nodes_net3LAN[nCN][5][nLANClients]; |
| 75 PointToPointHelper p2p_2gb200ms, p2p_1gb5ms, p2p_100mb1ms; |
| 76 InternetStackHelper stack; |
| 77 Ipv4InterfaceContainer ifs, ifs0[nCN][3], ifs1[nCN][6], ifs2[nCN][14], |
| 78 ifs3[nCN][9], ifs2LAN[nCN][7][nLANClients], |
| 79 ifs3LAN[nCN][5][nLANClients]; |
| 80 Ipv4AddressHelper address; |
| 81 std::ostringstream oss; |
| 82 p2p_1gb5ms.SetDeviceAttribute ("DataRate", StringValue ("1Gbps")); |
| 83 p2p_1gb5ms.SetChannelAttribute ("Delay", StringValue ("5ms")); |
| 84 p2p_2gb200ms.SetDeviceAttribute ("DataRate", StringValue ("2Gbps")); |
| 85 p2p_2gb200ms.SetChannelAttribute ("Delay", StringValue ("200ms")); |
| 86 p2p_100mb1ms.SetDeviceAttribute ("DataRate", StringValue ("100Mbps")); |
| 87 p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms")); |
| 88 |
| 89 // Setup NixVector Routing |
| 90 Ipv4NixVectorHelper nixRouting; |
| 91 Ipv4StaticRoutingHelper staticRouting; |
| 92 |
| 93 Ipv4ListRoutingHelper list; |
| 94 list.Add (staticRouting, 0); |
| 95 list.Add (nixRouting, 10); |
| 96 |
| 97 if (nix) |
| 98 { |
| 99 stack.SetRoutingHelper (list); |
| 100 } |
| 101 |
| 102 // Create Campus Networks |
| 103 for (int z = 0; z < nCN; ++z)· |
| 104 { |
| 105 cout << "Creating Campus Network " << z << ":" << endl; |
| 106 // Create Net0 |
| 107 cout << " SubNet [ 0"; |
| 108 for (int i = 0; i < 3; ++i)· |
| 109 { |
| 110 nodes_net0[z][i].Create (1); |
| 111 stack.Install (nodes_net0[z][i]); |
| 112 } |
| 113 nodes_net0[z][0].Add (nodes_net0[z][1].Get (0)); |
| 114 nodes_net0[z][1].Add (nodes_net0[z][2].Get (0)); |
| 115 nodes_net0[z][2].Add (nodes_net0[z][0].Get (0)); |
| 116 NetDeviceContainer ndc0[3]; |
| 117 for (int i = 0; i < 3; ++i)· |
| 118 { |
| 119 ndc0[i] = p2p_1gb5ms.Install (nodes_net0[z][i]); |
| 120 } |
| 121 // Create Net1 |
| 122 cout << " 1"; |
| 123 for (int i = 0; i < 6; ++i)· |
| 124 { |
| 125 nodes_net1[z][i].Create (1); |
| 126 stack.Install (nodes_net1[z][i]); |
| 127 } |
| 128 nodes_net1[z][0].Add (nodes_net1[z][1].Get (0)); |
| 129 nodes_net1[z][2].Add (nodes_net1[z][0].Get (0)); |
| 130 nodes_net1[z][3].Add (nodes_net1[z][0].Get (0)); |
| 131 nodes_net1[z][4].Add (nodes_net1[z][1].Get (0)); |
| 132 nodes_net1[z][5].Add (nodes_net1[z][1].Get (0)); |
| 133 NetDeviceContainer ndc1[6]; |
| 134 for (int i = 0; i < 6; ++i)· |
| 135 { |
| 136 if (i == 1) |
| 137 { |
| 138 continue; |
| 139 } |
| 140 ndc1[i] = p2p_1gb5ms.Install (nodes_net1[z][i]); |
| 141 } |
| 142 // Connect Net0 <-> Net1 |
| 143 NodeContainer net0_1; |
| 144 net0_1.Add (nodes_net0[z][2].Get (0)); |
| 145 net0_1.Add (nodes_net1[z][0].Get (0)); |
| 146 NetDeviceContainer ndc0_1; |
| 147 ndc0_1 = p2p_1gb5ms.Install (net0_1); |
| 148 oss.str(""); |
| 149 oss << 10 + z << ".1.252.0"; |
| 150 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 151 ifs = address.Assign (ndc0_1); |
| 152 // Create Net2 |
| 153 cout << " 2"; |
| 154 for (int i = 0; i < 14; ++i)· |
| 155 { |
| 156 nodes_net2[z][i].Create (1); |
| 157 stack.Install (nodes_net2[z][i]); |
| 158 } |
| 159 nodes_net2[z][0].Add (nodes_net2[z][1].Get (0)); |
| 160 nodes_net2[z][2].Add (nodes_net2[z][0].Get (0)); |
| 161 nodes_net2[z][1].Add (nodes_net2[z][3].Get (0)); |
| 162 nodes_net2[z][3].Add (nodes_net2[z][2].Get (0)); |
| 163 nodes_net2[z][4].Add (nodes_net2[z][2].Get (0)); |
| 164 nodes_net2[z][5].Add (nodes_net2[z][3].Get (0)); |
| 165 nodes_net2[z][6].Add (nodes_net2[z][5].Get (0)); |
| 166 nodes_net2[z][7].Add (nodes_net2[z][2].Get (0)); |
| 167 nodes_net2[z][8].Add (nodes_net2[z][3].Get (0)); |
| 168 nodes_net2[z][9].Add (nodes_net2[z][4].Get (0)); |
| 169 nodes_net2[z][10].Add (nodes_net2[z][5].Get (0)); |
| 170 nodes_net2[z][11].Add (nodes_net2[z][6].Get (0)); |
| 171 nodes_net2[z][12].Add (nodes_net2[z][6].Get (0)); |
| 172 nodes_net2[z][13].Add (nodes_net2[z][6].Get (0)); |
| 173 NetDeviceContainer ndc2[14]; |
| 174 for (int i = 0; i < 14; ++i)· |
| 175 { |
| 176 ndc2[i] = p2p_1gb5ms.Install (nodes_net2[z][i]); |
| 177 } |
| 178 NetDeviceContainer ndc2LAN[7][nLANClients]; |
| 179 for (int i = 0; i < 7; ++i)· |
| 180 { |
| 181 oss.str (""); |
| 182 oss << 10 + z << ".4." << 15 + i << ".0"; |
| 183 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 184 for (int j = 0; j < nLANClients; ++j)· |
| 185 { |
| 186 nodes_net2LAN[z][i][j].Create (1); |
| 187 stack.Install (nodes_net2LAN[z][i][j]); |
| 188 nodes_net2LAN[z][i][j].Add (nodes_net2[z][i+7].Get (0)); |
| 189 ndc2LAN[i][j] = p2p_100mb1ms.Install (nodes_net2LAN[z][i][j]); |
| 190 ifs2LAN[z][i][j] = address.Assign (ndc2LAN[i][j]); |
| 191 } |
| 192 } |
| 193 // Create Net3 |
| 194 cout << " 3 ]" << endl; |
| 195 for (int i = 0; i < 9; ++i)· |
| 196 { |
| 197 nodes_net3[z][i].Create (1); |
| 198 stack.Install(nodes_net3[z][i]); |
| 199 } |
| 200 nodes_net3[z][0].Add (nodes_net3[z][1].Get (0)); |
| 201 nodes_net3[z][1].Add (nodes_net3[z][2].Get (0)); |
| 202 nodes_net3[z][2].Add (nodes_net3[z][3].Get (0)); |
| 203 nodes_net3[z][3].Add (nodes_net3[z][1].Get (0)); |
| 204 nodes_net3[z][4].Add (nodes_net3[z][0].Get (0)); |
| 205 nodes_net3[z][5].Add (nodes_net3[z][0].Get (0)); |
| 206 nodes_net3[z][6].Add (nodes_net3[z][2].Get (0)); |
| 207 nodes_net3[z][7].Add (nodes_net3[z][3].Get (0)); |
| 208 nodes_net3[z][8].Add (nodes_net3[z][3].Get (0)); |
| 209 NetDeviceContainer ndc3[9]; |
| 210 for (int i = 0; i < 9; ++i)· |
| 211 { |
| 212 ndc3[i] = p2p_1gb5ms.Install (nodes_net3[z][i]); |
| 213 } |
| 214 NetDeviceContainer ndc3LAN[5][nLANClients]; |
| 215 for (int i = 0; i < 5; ++i)· |
| 216 { |
| 217 oss.str (""); |
| 218 oss << 10 + z << ".5." << 10 + i << ".0"; |
| 219 address.SetBase (oss.str ().c_str (), "255.255.255.255"); |
| 220 for (int j = 0; j < nLANClients; ++j)· |
| 221 { |
| 222 nodes_net3LAN[z][i][j].Create (1); |
| 223 stack.Install (nodes_net3LAN[z][i][j]); |
| 224 nodes_net3LAN[z][i][j].Add (nodes_net3[z][i+4].Get (0)); |
| 225 ndc3LAN[i][j] = p2p_100mb1ms.Install (nodes_net3LAN[z][i][j]); |
| 226 ifs3LAN[z][i][j] = address.Assign (ndc3LAN[i][j]); |
| 227 } |
| 228 } |
| 229 cout << " Connecting Subnets..." << endl; |
| 230 // Create Lone Routers (Node 4 & 5)· |
| 231 nodes_netLR[z].Create (2); |
| 232 stack.Install (nodes_netLR[z]); |
| 233 NetDeviceContainer ndcLR; |
| 234 ndcLR = p2p_1gb5ms.Install (nodes_netLR[z]); |
| 235 // Connect Net2/Net3 through Lone Routers to Net0 |
| 236 NodeContainer net0_4, net0_5, net2_4a, net2_4b, net3_5a, net3_5b; |
| 237 net0_4.Add (nodes_netLR[z].Get (0)); |
| 238 net0_4.Add (nodes_net0[z][0].Get (0)); |
| 239 net0_5.Add (nodes_netLR[z].Get (1)); |
| 240 net0_5.Add (nodes_net0[z][1].Get (0)); |
| 241 net2_4a.Add (nodes_netLR[z].Get (0)); |
| 242 net2_4a.Add (nodes_net2[z][0].Get (0)); |
| 243 net2_4b.Add (nodes_netLR[z].Get (1)); |
| 244 net2_4b.Add (nodes_net2[z][1].Get (0)); |
| 245 net3_5a.Add (nodes_netLR[z].Get (1)); |
| 246 net3_5a.Add (nodes_net3[z][0].Get (0)); |
| 247 net3_5b.Add (nodes_netLR[z].Get (1)); |
| 248 net3_5b.Add (nodes_net3[z][1].Get (0)); |
| 249 NetDeviceContainer ndc0_4, ndc0_5, ndc2_4a, ndc2_4b, ndc3_5a, ndc3_5b; |
| 250 ndc0_4 = p2p_1gb5ms.Install (net0_4); |
| 251 oss.str (""); |
| 252 oss << 10 + z << ".1.253.0"; |
| 253 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 254 ifs = address.Assign (ndc0_4); |
| 255 ndc0_5 = p2p_1gb5ms.Install (net0_5); |
| 256 oss.str (""); |
| 257 oss << 10 + z << ".1.254.0"; |
| 258 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 259 ifs = address.Assign (ndc0_5); |
| 260 ndc2_4a = p2p_1gb5ms.Install (net2_4a); |
| 261 oss.str (""); |
| 262 oss << 10 + z << ".4.253.0"; |
| 263 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 264 ifs = address.Assign (ndc2_4a); |
| 265 ndc2_4b = p2p_1gb5ms.Install (net2_4b); |
| 266 oss.str (""); |
| 267 oss << 10 + z << ".4.254.0"; |
| 268 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 269 ifs = address.Assign (ndc2_4b); |
| 270 ndc3_5a = p2p_1gb5ms.Install (net3_5a); |
| 271 oss.str (""); |
| 272 oss << 10 + z << ".5.253.0"; |
| 273 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 274 ifs = address.Assign (ndc3_5a); |
| 275 ndc3_5b = p2p_1gb5ms.Install (net3_5b); |
| 276 oss.str (""); |
| 277 oss << 10 + z << ".5.254.0"; |
| 278 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 279 ifs = address.Assign (ndc3_5b); |
| 280 // Assign IP addresses |
| 281 cout << " Assigning IP addresses..." << endl; |
| 282 for (int i = 0; i < 3; ++i)· |
| 283 { |
| 284 oss.str (""); |
| 285 oss << 10 + z << ".1." << 1 + i << ".0"; |
| 286 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 287 ifs0[z][i] = address.Assign (ndc0[i]); |
| 288 } |
| 289 for (int i = 0; i < 6; ++i)· |
| 290 { |
| 291 if (i == 1)· |
| 292 { |
| 293 continue; |
| 294 } |
| 295 oss.str (""); |
| 296 oss << 10 + z << ".2." << 1 + i << ".0"; |
| 297 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 298 ifs1[z][i] = address.Assign (ndc1[i]); |
| 299 } |
| 300 oss.str (""); |
| 301 oss << 10 + z << ".3.1.0"; |
| 302 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 303 ifs = address.Assign (ndcLR); |
| 304 for (int i = 0; i < 14; ++i)· |
| 305 { |
| 306 oss.str (""); |
| 307 oss << 10 + z << ".4." << 1 + i << ".0"; |
| 308 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 309 ifs2[z][i] = address.Assign (ndc2[i]); |
| 310 } |
| 311 for (int i = 0; i < 9; ++i)· |
| 312 { |
| 313 oss.str (""); |
| 314 oss << 10 + z << ".5." << 1 + i << ".0"; |
| 315 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 316 ifs3[z][i] = address.Assign (ndc3[i]); |
| 317 } |
| 318 } |
| 319 // Create Ring Links |
| 320 if (nCN > 1)· |
| 321 { |
| 322 cout << "Forming Ring Topology..." << endl; |
| 323 NodeContainer nodes_ring[nCN]; |
| 324 for (int z = 0; z < nCN-1; ++z)· |
| 325 { |
| 326 nodes_ring[z].Add (nodes_net0[z][0].Get (0)); |
| 327 nodes_ring[z].Add (nodes_net0[z+1][0].Get (0)); |
| 328 } |
| 329 nodes_ring[nCN-1].Add (nodes_net0[nCN-1][0].Get (0)); |
| 330 nodes_ring[nCN-1].Add (nodes_net0[0][0].Get (0)); |
| 331 NetDeviceContainer ndc_ring[nCN]; |
| 332 for (int z = 0; z < nCN; ++z)· |
| 333 { |
| 334 ndc_ring[z] = p2p_2gb200ms.Install (nodes_ring[z]); |
| 335 oss.str (""); |
| 336 oss << "254.1." << z + 1 << ".0"; |
| 337 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
| 338 ifs = address.Assign (ndc_ring[z]); |
| 339 } |
| 340 } |
| 341 |
| 342 // Create Traffic Flows |
| 343 cout << "Creating TCP Traffic Flows:" << endl; |
| 344 Config::SetDefault ("ns3::OnOffApplication::MaxBytes", UintegerValue (500000))
; |
| 345 Config::SetDefault ("ns3::OnOffApplication::OnTime", |
| 346 RandomVariableValue (ConstantVariable (1))); |
| 347 Config::SetDefault ("ns3::OnOffApplication::OffTime", |
| 348 RandomVariableValue (ConstantVariable (0))); |
| 349 Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (512)); |
| 350 ·· |
| 351 UniformVariable urng; |
| 352 int r1; |
| 353 double r2; |
| 354 for (int z = 0; z < nCN; ++z)· |
| 355 { |
| 356 int x = z + 1; |
| 357 if (z == nCN - 1)· |
| 358 { |
| 359 x = 0; |
| 360 } |
| 361 // Subnet 2 LANs |
| 362 cout << " Campus Network " << z << " Flows [ Net2 "; |
| 363 for (int i = 0; i < 7; ++i)· |
| 364 { |
| 365 for (int j = 0; j < nLANClients; ++j)· |
| 366 { |
| 367 // Sinks |
| 368 PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", |
| 369 InetSocketAddress (Ipv4Address::GetAny (), 9999)); |
| 370 ApplicationContainer sinkApp = sinkHelper.Install ( |
| 371 nodes_net2LAN[z][i][j].Get (0)); |
| 372 sinkApp.Start (Seconds (100.0)); |
| 373 // Sources |
| 374 r1 = 2 + (int)(4 * urng.GetValue ()); |
| 375 r2 = 100 + (10 * urng.GetValue ());; |
| 376 OnOffHelper client ("ns3::TcpSocketFactory", Address ()); |
| 377 AddressValue remoteAddress(InetSocketAddress ( |
| 378 ifs2LAN[z][i][j].GetAddress (0), 9999)); |
| 379 client.SetAttribute ("Remote", remoteAddress); |
| 380 ApplicationContainer clientApp; |
| 381 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0))); |
| 382 clientApp.Start (Seconds (r2)); |
| 383 } |
| 384 } |
| 385 // Subnet 3 LANs |
| 386 cout << "Net3 ]" << endl; |
| 387 for (int i = 0; i < 5; ++i)· |
| 388 { |
| 389 for (int j = 0; j < nLANClients; ++j)· |
| 390 { |
| 391 // Sinks |
| 392 PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", |
| 393 InetSocketAddress (Ipv4Address::GetAny (), 9999)); |
| 394 ApplicationContainer sinkApp = sinkHelper.Install ( |
| 395 nodes_net3LAN[z][i][j].Get (0)); |
| 396 sinkApp.Start (Seconds (100.0)); |
| 397 // Sources |
| 398 r1 = 2 + (int)(4 * urng.GetValue ()); |
| 399 r2 = 100 + (10 * urng.GetValue ());; |
| 400 OnOffHelper client ("ns3::TcpSocketFactory", Address ()); |
| 401 AddressValue remoteAddress (InetSocketAddress ( |
| 402 ifs2LAN[z][i][j].GetAddress (0), 9999)); |
| 403 client.SetAttribute ("Remote", remoteAddress); |
| 404 ApplicationContainer clientApp; |
| 405 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0))); |
| 406 clientApp.Start (Seconds (r2)); |
| 407 } |
| 408 } |
| 409 } |
| 410 |
| 411 cout << "Created " << NodeList::GetNNodes () << " nodes." << endl; |
| 412 TIMER_TYPE routingStart; |
| 413 TIMER_NOW (routingStart); |
| 414 |
| 415 if (nix) |
| 416 { |
| 417 // Calculate routing tables |
| 418 cout << "Using Nix-vectors..." << endl; |
| 419 } |
| 420 else |
| 421 { |
| 422 // Calculate routing tables |
| 423 cout << "Populating Global Static Routing Tables..." << endl; |
| 424 Ipv4GlobalRoutingHelper::PopulateRoutingTables (); |
| 425 } |
| 426 |
| 427 TIMER_TYPE routingEnd; |
| 428 TIMER_NOW (routingEnd); |
| 429 cout << "Routing tables population took "· |
| 430 << TIMER_DIFF (routingEnd, routingStart) << endl; |
| 431 #if 0· |
| 432 std::ofstream ascii; |
| 433 ascii.open("nms_p2p_nix.tr"); |
| 434 PointToPointHelper::EnableAsciiAll(ascii); |
| 435 CsmaHelper::EnableAsciiAll(ascii); |
| 436 #endif |
| 437 |
| 438 #if 0 |
| 439 PointToPointHelper::EnablePcapAll("nms_p2p"); |
| 440 CsmaHelper::EnablePcapAll("nms_csma"); |
| 441 #endif |
| 442 |
| 443 Simulator::ScheduleNow (Progress); |
| 444 cout << "Running simulator..." << endl; |
| 445 TIMER_NOW (t1); |
| 446 Simulator::Stop (Seconds (200.0)); |
| 447 Simulator::Run (); |
| 448 TIMER_NOW (t2); |
| 449 cout << "Simulator finished." << endl; |
| 450 Simulator::Destroy (); |
| 451 |
| 452 double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1); |
| 453 cout << "-----" << endl << "Runtime Stats:" << endl; |
| 454 cout << "Simulator init time: " << d1 << endl; |
| 455 cout << "Simulator run time: " << d2 << endl; |
| 456 cout << "Total elapsed time: " << d1+d2 << endl; |
| 457 return 0; |
| 458 } |
OLD | NEW |