解决:Failed while installing Dynamic Web Module 2.5.

本文介绍了解决在使用Eclipse IDE for Java Developers (Galileo) 和 JBoss tool 进行 web 开发时遇到的 Failed while installing Dynamic Web Module 2.5 错误的方法。建议安装 JST Server UI, JST Web UI, JST Server Adapters 和 WST Server Adapters 来解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用Eclipse IDE for Java Developers (Galileo) 和JBoos tool进行 web 开发的时候,出现Failed while installing Dynamic Web Module 2.5.错误,解决办法如下:

Install one or all of the following:

JST Server UI
JST Web UI

It's probably a good idea to also install the following:

JST Server Adapters
WST Server Adapters

我给需要修改的代码给你,请你帮我标出使用方法1时该代码的修改方案,代码如下: #include <stdlib.h> #include <chrono> #include <fstream> #include <iostream> #include <string> #include "ns3/applications-module.h" #include "ns3/core-module.h" #include "ns3/internet-module.h" #include "ns3/ipv4-global-routing-helper.h" #include "ns3/network-module.h" #include "ns3/point-to-point-module.h" #include "ns3/traffic-control-module.h" #include "ns3/pfifo-bolt-queue-disc.h" using namespace ns3; #define START_TIME 1.0 #define ONE_WAY_DELAY 4110e-9 #define MTU 1500 NS_LOG_COMPONENT_DEFINE ("BoltFairnessExperiment"); static void DecwinTrace(Ptr<OutputStreamWrapper> stream, Ptr<const Packet> pkt, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport, int txMsgId, uint32_t seqNo, uint16_t flag) { if (flag & ns3::BoltHeader::Flags_t::DECWIN) { // 512 *stream->GetStream () << Simulator::Now().GetNanoSeconds() << " DECWIN " << saddr << ":" << sport << "→" << daddr << ":" << dport << " txMsgId=" << txMsgId << " seq=" << seqNo << std::endl; } } void TraceFlowStats (Ptr<OutputStreamWrapper> stream, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport, int txMsgId, uint32_t cwnd, uint64_t rtt) { Time now = Simulator::Now (); NS_LOG_DEBUG ("stats " << now.GetNanoSeconds () << " " << saddr << ":" << sport << " " << daddr << ":" << dport << " " << txMsgId << " " << cwnd << " " << rtt); *stream->GetStream () << now.GetNanoSeconds () << " " << saddr << ":" << sport << " " << daddr << ":" << dport << " " << txMsgId << " " << cwnd << " " << rtt << std::endl; } static void BytesInQueueDiscTrace (Ptr<OutputStreamWrapper> stream, uint32_t oldval, uint32_t newval) { NS_LOG_INFO (Simulator::Now ().GetNanoSeconds () << " Queue Disc size from " << oldval << " to " << newval); *stream->GetStream () << Simulator::Now ().GetNanoSeconds () << " " << newval << std::endl; } static void calTpt(Ptr<OutputStreamWrapper> stream, uint32_t bytesDequeued) { // 使用静态变量跟踪总流量和时间 static uint64_t totalBytes = 0; static Time lastTime = Simulator::Now(); Time now = Simulator::Now(); totalBytes += bytesDequeued; // 每100微秒计算并记录一次吞吐量 if ((now - lastTime).GetMicroSeconds() >= 3) { // 计算比特每秒(bps)吞吐量 double throughput = (totalBytes * 8.0) / ((now - lastTime).GetSeconds()); // 以Gbps为单位输出 double throughputGbps = throughput / 1000 / 1000 / 1000; *stream->GetStream() << now.GetNanoSeconds() << " " << throughputGbps << std::endl; lastTime = now; totalBytes = 0; } } static void calPru (Ptr<OutputStreamWrapper> stream,double oldval, double newval) { NS_LOG_INFO (Simulator::Now ().GetNanoSeconds () << " Queue Disc size from " << oldval << " to " << newval); //NS_LOG_WARN ("wenzhu"); *stream->GetStream () << Simulator::Now ().GetNanoSeconds () << " " << newval <<std::endl; } void ReceiveLongLivedFlow (Ptr<Socket> socket) { Time now = Simulator::Now (); Ptr<Packet> message; uint32_t messageSize; Address from; Ipv4Header ipv4h; BoltHeader bolth; while ((message = socket->RecvFrom (from))) { messageSize = message->GetSize (); NS_LOG_DEBUG (now.GetNanoSeconds () << " Received " << messageSize << " Bytes from " << InetSocketAddress::ConvertFrom (from).GetIpv4 () << ":" << InetSocketAddress::ConvertFrom (from).GetPort ()); uint32_t hdrSize = bolth.GetSerializedSize () + ipv4h.GetSerializedSize (); uint32_t payloadSize = MTU - hdrSize; uint32_t msgSizePkts = messageSize / payloadSize + (messageSize % payloadSize != 0); messageSize += msgSizePkts * hdrSize; double thp = (double) messageSize * 8.0 / (now.GetSeconds () - ONE_WAY_DELAY - START_TIME) / 1e9; NS_LOG_WARN ("The average thp from " << from << ": " << thp << "Gbps"); } } void SendLongLivedFlow (Ptr<Socket> socket, InetSocketAddress receiverAddr, uint32_t flowSizeBytes) { Ptr<Packet> msg = Create<Packet> (flowSizeBytes); int sentBytes = socket->SendTo (msg, 0, receiverAddr); if (sentBytes > 0) { NS_LOG_DEBUG (Simulator::Now ().GetNanoSeconds () << " Sent " << sentBytes << " Bytes to " << receiverAddr.GetIpv4 () << ":" << receiverAddr.GetPort ()); } } void SetLinkDownToStopFlow (NetDeviceContainer netDevices) { PointToPointNetDevice *p2pNetDevice; for (uint32_t n = 0; n < netDevices.GetN (); n++) { p2pNetDevice = dynamic_cast<PointToPointNetDevice *> (&(*(netDevices.Get (n)))); p2pNetDevice->SetLinkDown (); } } void CalculateTailBottleneckQueueOccupancy (std::string qStreamName, double percentile, uint64_t bottleneckBitRate, double duration) { std::ifstream qSizeTraceFile; qSizeTraceFile.open (qStreamName); NS_LOG_FUNCTION ("Reading Bottleneck Queue Size Trace From: " << qStreamName); std::string line; std::istringstream lineBuffer; std::vector<int> queueSizes; uint64_t time; uint32_t qSizeBytes; while (getline (qSizeTraceFile, line)) { lineBuffer.clear (); lineBuffer.str (line); lineBuffer >> time; lineBuffer >> qSizeBytes; if (time < (uint64_t) ((START_TIME + duration) * 1e9)) queueSizes.push_back (qSizeBytes); } qSizeTraceFile.close (); std::sort (queueSizes.begin (), queueSizes.end ()); uint32_t idx = (uint32_t) ((double) queueSizes.size () * percentile); int tailQueueSizeBytes = queueSizes[idx]; double tailQueueSizeUsec = (double) tailQueueSizeBytes * 8.0 * 1e6 / (double) bottleneckBitRate; NS_LOG_UNCOND (percentile * 100 << "%ile queue size: " << tailQueueSizeUsec << "usec (" << tailQueueSizeBytes << " Bytes)"); } void FlowThptCb(Ptr<OutputStreamWrapper> stream, ns3::PfifoBoltQueueDisc::FlowKey fk, double mbps) { *stream->GetStream() << Simulator::Now().GetNanoSeconds() << " " << fk.pLow << "→" << fk.pHigh << " " << mbps << std::endl; } int nFlows = 2; int senderPortNoStart = 1000; int receiverPortNoStart = 2000; NodeContainer senderNodes; NodeContainer receiverNodes; NodeContainer switchNodes; double newFlowTime = 0.002; NetDeviceContainer switchToSwitchDevices; NetDeviceContainer senderToSwitchDevices[4]; //nFlows NetDeviceContainer receiverToSwitchDevices[4]; //nFlows // PointToPointNetDevice *bottleneckNetDevice = // dynamic_cast<PointToPointNetDevice *>(&(*(switchToSwitchDevices.Get(0)))); uint64_t bottleneckBps = 102 * 1e9; //bottleneckNetDevice->GetDataRate().GetBitRate(); BoltHeader bolth; Ipv4Header ipv4h; uint32_t payloadSize = MTU - bolth.GetSerializedSize () - ipv4h.GetSerializedSize (); Ipv4InterfaceContainer receiverToSwitchIfs[4]; //nFlows Ipv4InterfaceContainer senderToSwitchIfs[4]; //nFlows int main (int argc, char *argv[]) { // Create output directory if it doesn't exist auto simStart = std::chrono::steady_clock::now (); AsciiTraceHelper asciiTraceHelper; std::string simNote (""); double dur = 1.0; uint32_t simIdx = 0; bool traceQueues = true; bool debugMode = false; uint32_t bdpBytes = 550000; // in bytes uint64_t inboundRtxTimeout = 250000; // in microseconds uint64_t outboundRtxTimeout = 100000; // in microseconds std::string ccMode ("DEFAULT"); /* Bolt (Swift) Related Parameters */ double rttSmoothingAlpha = 0.75; // Default: 0.75 uint16_t topoScalingPerHop = 1000; // Default: 1000 ns double maxFlowScaling = 100000.0; // Default: 100000.0 double maxFlowScalingCwnd = 256.0; // Default: 256.0 pkts double minFlowScalingCwnd = 0.1; // Default: 0.1 pkts uint64_t baseDelay = 10000; // Default: 25000 us (25 usec) double aiFactor = 1.0; // Default: 1.0 double mdFactor = 0.8; // Default: 0.8 double maxMd = 0.5; // Default: 0.5 uint32_t maxCwnd = 37376000; // Default: 373760 Bytes bool usePerHopDelayForCc = false; // Default: false bool enableMsgAgg = true; bool enableBts = false; bool enablePru = true; bool enableAbs = false; int abs = 1; int pru = 1; std::string ccThreshold ("8KB"); // 4 packets int other_size = 0; std::string bottleLinkDelay ("10us"); CommandLine cmd(__FILE__); cmd.AddValue("bottlelinkdelay","bottlelinkdelay", bottleLinkDelay); cmd.AddValue("cct", "cct", ccThreshold); cmd.AddValue("os", "os", other_size); cmd.AddValue("abs", "abs", abs); cmd.AddValue("pru", "pru", pru); cmd.AddValue("note", "Any note to identify the simulation in the future", simNote); cmd.AddValue("newFlowTime", "The interval at which a new flow joins/leaves.", newFlowTime); cmd.AddValue("simIdx", "The index of the simulation used to identify parallel runs.", simIdx); cmd.AddValue("nFlows", "Number of flows in the topology.", nFlows); cmd.AddValue("traceQueues", "Whether to trace the queue lengths during the simulation.", traceQueues); cmd.AddValue("debug", "Whether to enable detailed pkt traces for debugging", debugMode); cmd.AddValue("bdp", "RttBytes to use in the simulation.", bdpBytes); cmd.AddValue("inboundRtxTimeout", "Number of microseconds before an inbound msg expires.", inboundRtxTimeout); cmd.AddValue("outboundRtxTimeout", "Number of microseconds before an outbound msg expires.", outboundRtxTimeout); cmd.AddValue("ccMode", "Type of congestion control algorithm to run.", ccMode); cmd.AddValue("rttSmoothingAlpha", "Smoothing factor for the RTT measurements.", rttSmoothingAlpha); cmd.AddValue("topoScalingPerHop", "Per hop scaling for target delay.", topoScalingPerHop); cmd.AddValue("maxFlowScaling", "Flow scaling multiplier for target delay.", maxFlowScaling); cmd.AddValue("baseDelay", "Base delay for the target delay.", baseDelay); cmd.AddValue("aiFactor", "Additive increase for congestion control.", aiFactor); cmd.AddValue("mdFactor", "Multiplicative decrease for congestion control.", mdFactor); cmd.AddValue("maxMd", "Maximum multiplicative decrease allowed.", maxMd); cmd.AddValue("maxCwnd", "Maximum value of cwnd a flow can have.", maxCwnd); cmd.AddValue("usePerHopDelayForCc", "Flag to to use per hop delay instead of RTT for CC.", usePerHopDelayForCc); cmd.AddValue("enableMsgAgg", "Flag to disable message aggregation on end-hosts.", enableMsgAgg); cmd.AddValue("enableBts", "Flag to enable back to sender feature.", enableBts); cmd.AddValue("enablePru", "Flag to enable proactive ramp-up feature.", enablePru); cmd.AddValue("enableAbs", "Flag to enable Available Bandwidth Signaling. If false, queue " "occupancy is used to detect congestion.", enableAbs); cmd.AddValue("ccThreshold", "Threshold for declaring congestion, i.e 15KB.", ccThreshold); cmd.Parse(argc, argv); std::cout << ccThreshold << std::endl; std::string outputDir = "outputs/bolt-fairness/" + bottleLinkDelay; std::string mkdir_command = "mkdir -p " + outputDir; if (system (mkdir_command.c_str ()) != 0) { NS_LOG_ERROR ("Failed to create output directory"); } if (ccMode == "DEFAULT") { enableBts = true; enablePru = true; enableAbs = true; } if (pru == 1) { enablePru = true; }else { enablePru = false; } if (abs == 1) { enableAbs = true; }else { enableAbs = false; } Time::SetResolution (Time::NS); // Packet::EnablePrinting(); LogComponentEnable ("BoltFairnessExperiment", LOG_LEVEL_WARN); LogComponentEnable ("BoltSocket", LOG_LEVEL_WARN); LogComponentEnable ("BoltL4Protocol", LOG_LEVEL_WARN); LogComponentEnable ("PfifoBoltQueueDisc", LOG_LEVEL_WARN); if (debugMode) { LogComponentEnable ("BoltFairnessExperiment", LOG_LEVEL_DEBUG); NS_LOG_DEBUG ("Running in DEBUG Mode!"); SeedManager::SetRun (0); } else { SeedManager::SetRun (simIdx); } std::string tracesFileName ("outputs/bolt-fairness/" + bottleLinkDelay + '/'); if (debugMode) tracesFileName += "debug"; else tracesFileName += std::to_string (simIdx); if (enableMsgAgg) tracesFileName += "_MSGAGG"; tracesFileName += "_" + ccMode; if (ccMode != "DEFAULT") { if (enableBts) tracesFileName += "_BTS"; if (enablePru) tracesFileName += "_PRU"; if (usePerHopDelayForCc) tracesFileName += "_PERHOP"; if (enableAbs) tracesFileName += "_ABS"; } if (!simNote.empty ()) { tracesFileName += "_" + simNote; NS_LOG_UNCOND ("Note: " << simNote); } std::string qStreamName = tracesFileName + ".qlen"; std::string tptName = tracesFileName + ".tpt"; std::string pruName = tracesFileName + ".pru"; std::string msgTracesFileName = tracesFileName + ".tr"; std::string statsTracesFileName = tracesFileName + ".log"; std::string decwinTraceFileName = tracesFileName + ".dec"; /******** Create Nodes ********/ NS_LOG_DEBUG ("Creating Nodes..."); senderNodes.Create (nFlows); receiverNodes.Create (nFlows); switchNodes.Create (2); /******** Create Channels ********/ NS_LOG_DEBUG ("Configuring Channels..."); PointToPointHelper hostLinks; hostLinks.SetDeviceAttribute ("DataRate", StringValue ("100Gbps")); hostLinks.SetChannelAttribute ("Delay", StringValue ("2us")); hostLinks.SetQueue ("ns3::DropTailQueue", "MaxSize", StringValue ("500p")); PointToPointHelper hostLinks2; hostLinks2.SetDeviceAttribute ("DataRate", StringValue ("100Gbps")); hostLinks2.SetChannelAttribute ("Delay", StringValue (bottleLinkDelay)); hostLinks2.SetQueue ("ns3::DropTailQueue", "MaxSize", StringValue ("500p")); PointToPointHelper bottleneckLink; bottleneckLink.SetDeviceAttribute ("DataRate", StringValue ("100Gbps")); bottleneckLink.SetChannelAttribute ("Delay", StringValue ("2us")); bottleneckLink.SetQueue ("ns3::DropTailQueue", "MaxSize", StringValue ("1p")); /******** Create NetDevices ********/ NS_LOG_DEBUG ("Creating NetDevices..."); switchToSwitchDevices = bottleneckLink.Install (switchNodes); for (uint32_t n = 0; n < switchToSwitchDevices.GetN (); n++) switchToSwitchDevices.Get (n)->SetMtu (MTU); // int i = 0; // senderToSwitchDevices[i] = hostLinks2.Install (senderNodes.Get (i), switchNodes.Get (0)); // for (uint32_t n = 0; n < senderToSwitchDevices[i].GetN (); n++) // senderToSwitchDevices[i].Get (n)->SetMtu (MTU); // i++; // senderToSwitchDevices[i] = hostLinks.Install (senderNodes.Get (i), switchNodes.Get (0)); // for (uint32_t n = 0; n < senderToSwitchDevices[i].GetN (); n++) // senderToSwitchDevices[i].Get (n)->SetMtu (MTU); // i = 0; // receiverToSwitchDevices[i] = // hostLinks2.Install (receiverNodes.Get (i), switchNodes.Get (1)); // for (uint32_t n = 0; n < receiverToSwitchDevices[i].GetN (); n++) // receiverToSwitchDevices[i].Get (n)->SetMtu (MTU); // i++; // receiverToSwitchDevices[i] = // hostLinks.Install (receiverNodes.Get (i), switchNodes.Get (1)); // for (uint32_t n = 0; n < receiverToSwitchDevices[i].GetN (); n++) // receiverToSwitchDevices[i].Get (n)->SetMtu (MTU); for (int i=0;i<nFlows;i++) { if(i&1) { senderToSwitchDevices[i] = hostLinks.Install (senderNodes.Get (i), switchNodes.Get (0)); receiverToSwitchDevices[i] = hostLinks.Install (receiverNodes.Get (i), switchNodes.Get (1)); } else { senderToSwitchDevices[i] = hostLinks2.Install (senderNodes.Get (i), switchNodes.Get (0)); receiverToSwitchDevices[i] = hostLinks2.Install (receiverNodes.Get (i), switchNodes.Get (1)); } for (uint32_t n = 0; n < senderToSwitchDevices[i].GetN (); n++) senderToSwitchDevices[i].Get (n)->SetMtu (MTU); for (uint32_t n = 0; n < receiverToSwitchDevices[i].GetN (); n++) receiverToSwitchDevices[i].Get (n)->SetMtu (MTU); } /******** Install Internet Stack ********/ NS_LOG_DEBUG ("Installing Internet Stack..."); /******** Set default BDP value in packets ********/ Config::SetDefault ("ns3::BoltL4Protocol::AggregateMsgsIfPossible", BooleanValue (enableMsgAgg)); Config::SetDefault ("ns3::BoltL4Protocol::BandwidthDelayProduct", UintegerValue (bdpBytes)); Config::SetDefault ("ns3::BoltL4Protocol::InbndRtxTimeout", TimeValue (MicroSeconds (inboundRtxTimeout))); Config::SetDefault ("ns3::BoltL4Protocol::OutbndRtxTimeout", TimeValue (MicroSeconds (outboundRtxTimeout))); Config::SetDefault ("ns3::BoltL4Protocol::CcMode", StringValue (ccMode)); Config::SetDefault ("ns3::BoltL4Protocol::RttSmoothingAlpha", DoubleValue (rttSmoothingAlpha)); Config::SetDefault ("ns3::BoltL4Protocol::TopoScalingPerHop", UintegerValue (topoScalingPerHop)); Config::SetDefault ("ns3::BoltL4Protocol::MaxFlowScaling", DoubleValue (maxFlowScaling)); Config::SetDefault ("ns3::BoltL4Protocol::MaxFlowScalingCwnd", DoubleValue (maxFlowScalingCwnd)); Config::SetDefault ("ns3::BoltL4Protocol::MinFlowScalingCwnd", DoubleValue (minFlowScalingCwnd)); Config::SetDefault ("ns3::BoltL4Protocol::BaseDelay", UintegerValue (baseDelay)); Config::SetDefault ("ns3::BoltL4Protocol::AiFactor", DoubleValue (aiFactor)); Config::SetDefault ("ns3::BoltL4Protocol::MdFactor", DoubleValue (mdFactor)); Config::SetDefault ("ns3::BoltL4Protocol::MaxMd", DoubleValue (maxMd)); Config::SetDefault ("ns3::BoltL4Protocol::MaxCwnd", UintegerValue (maxCwnd)); Config::SetDefault ("ns3::BoltL4Protocol::UsePerHopDelayForCc", BooleanValue (usePerHopDelayForCc)); Config::SetDefault ("ns3::Ipv4GlobalRouting::EcmpMode", EnumValue (Ipv4GlobalRouting::ECMP_PER_FLOW)); InternetStackHelper stack; stack.Install (senderNodes); stack.Install (receiverNodes); stack.Install (switchNodes); TrafficControlHelper boltQdisc; boltQdisc.SetRootQueueDisc ("ns3::PfifoBoltQueueDisc", "MaxSize", StringValue ("1000p"), "EnableBts", BooleanValue (enableBts), "CcThreshold", StringValue (ccThreshold), "EnablePru", BooleanValue (enablePru), "MaxInstAvailLoad", IntegerValue (MTU), "EnableAbs", BooleanValue (enableAbs)); QueueDiscContainer bottleneckQdisc = boltQdisc.Install (switchToSwitchDevices); //QueueDiscContainer C0toS1Qdisc = boltQdisc.Install(senderToSwitchDevices[0]); //QueueDiscContainer C1toS1Qdisc = boltQdisc.Install(senderToSwitchDevices[1]); //QueueDiscContainer S2toC3Qdisc = boltQdisc.Install(receiverToSwitchDevices[0]); //QueueDiscContainer S2toC4Qdisc = boltQdisc.Install(receiverToSwitchDevices[1]); if (traceQueues) { Ptr<OutputStreamWrapper> qStream = asciiTraceHelper.CreateFileStream (qStreamName); bottleneckQdisc.Get (0)->TraceConnectWithoutContext ( "BytesInQueue", MakeBoundCallback (&BytesInQueueDiscTrace, qStream)); Ptr<OutputStreamWrapper> tptStream = asciiTraceHelper.CreateFileStream (tptName); bottleneckQdisc.Get (0)->TraceConnectWithoutContext ("totDeQueue", MakeBoundCallback (&calTpt, tptStream)); Ptr<OutputStreamWrapper> pruStream = asciiTraceHelper.CreateFileStream (pruName); bottleneckQdisc.Get (0)->TraceConnectWithoutContext ("PruTokensInQueue", MakeBoundCallback (&calPru, pruStream)); //bottleneckQdisc.Get (0)->TraceConnectWithoutContext ("ALLPru", // MakeBoundCallback (&calPru, pruStream)); } /******** Set IP addresses of the nodes in the network ********/ Ipv4AddressHelper address; address.SetBase ("10.0.0.0", "255.255.255.0"); address.Assign (switchToSwitchDevices); for (int i = 0; i < nFlows; i++) { address.NewNetwork (); senderToSwitchIfs[i] = address.Assign (senderToSwitchDevices[i]); } std::vector<InetSocketAddress> receiverAddresses; for (int i = 0; i < nFlows; i++) { address.NewNetwork (); receiverToSwitchIfs[i] = address.Assign (receiverToSwitchDevices[i]); receiverAddresses.push_back ( InetSocketAddress (receiverToSwitchIfs[i].GetAddress (0), receiverPortNoStart + i)); } Ipv4GlobalRoutingHelper::PopulateRoutingTables (); /******** Create Flows on End-hosts ********/ NS_LOG_DEBUG ("Installing the Applications..."); /******** Schedule the long lived flows for fairness measurements ********/ uint32_t flowSizeBytes = static_cast<uint32_t> (2 * newFlowTime * 2 * static_cast<double> (bottleneckBps) * static_cast<double> (payloadSize) / 8.0 / static_cast<double> (MTU)); InetSocketAddress receiverAddr = InetSocketAddress (receiverToSwitchIfs[0].GetAddress (0), 0); // dummy Ptr<Socket> receiverSocket[nFlows]; Ptr<Socket> senderSocket[nFlows]; for (int i = 0; i < nFlows; i++) { receiverAddr = InetSocketAddress (receiverToSwitchIfs[i].GetAddress (0), receiverPortNoStart + i); receiverSocket[i] = Socket::CreateSocket (receiverNodes.Get (i), BoltSocketFactory::GetTypeId ()); receiverSocket[i]->Bind (receiverAddr); receiverSocket[i]->SetRecvCallback (MakeCallback (&ReceiveLongLivedFlow)); senderSocket[i] = Socket::CreateSocket (senderNodes.Get (i), BoltSocketFactory::GetTypeId ()); senderSocket[i]->Bind ( InetSocketAddress (senderToSwitchIfs[i].GetAddress (0), senderPortNoStart + i)); if (i & 1) { Simulator::Schedule (Seconds (START_TIME), &SendLongLivedFlow, senderSocket[i], receiverAddr, flowSizeBytes*2); } else { Simulator::Schedule (Seconds (START_TIME), &SendLongLivedFlow, senderSocket[i], receiverAddr, flowSizeBytes); } } for (int i = 0; i < nFlows; i++) { //Simulator::Schedule (Seconds (START_TIME + (nFlows + i) * newFlowTime), // &SetLinkDownToStopFlow, senderToSwitchDevices[i]); } /******** Set the message traces for the Bolt clients ********/ Ptr<OutputStreamWrapper> statsStream; statsStream = asciiTraceHelper.CreateFileStream (statsTracesFileName); Config::ConnectWithoutContext ("/NodeList/*/$ns3::BoltL4Protocol/FlowStats", MakeBoundCallback (&TraceFlowStats, statsStream)); Ptr<OutputStreamWrapper> decwinStream; decwinStream = asciiTraceHelper.CreateFileStream(decwinTraceFileName); Config::ConnectWithoutContext( "/NodeList/*/$ns3::BoltL4Protocol/CtrlPktArrival", MakeBoundCallback(&DecwinTrace, decwinStream)); // 到达:也可换 CtrlPktDeparture 看发出 std::string flowThptName = tracesFileName + ".flow_thpt"; Ptr<OutputStreamWrapper> flowThptStream = asciiTraceHelper.CreateFileStream(flowThptName); bottleneckQdisc.Get(0)->TraceConnectWithoutContext( "FlowThroughput", MakeBoundCallback(&FlowThptCb, flowThptStream)); /******** Run the Actual Simulation ********/ NS_LOG_WARN ("Running the Simulation..."); Simulator::Stop (Seconds (START_TIME + dur)); Simulator::Run (); Simulator::Destroy (); /******** Measure the tail occupancy of the bottleneck link ********/ if (traceQueues) CalculateTailBottleneckQueueOccupancy (qStreamName, 0.99, bottleneckBps, (nFlows * 2 - 1) * newFlowTime); /***** Measure the actual time the simulation has taken (for reference) *****/ auto simStop = std::chrono::steady_clock::now (); auto simTime = std::chrono::duration_cast<std::chrono::seconds> (simStop - simStart); double simTimeMin = (double) simTime.count () / 60.0; NS_LOG_UNCOND ("Time taken by simulation: " << simTimeMin << " minutes"); return 0; }
最新发布
08-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值