Skip to content

Commit

Permalink
Merge pull request #3 from googleinterns/topic-testing
Browse files Browse the repository at this point in the history
Reliability and packet scheduling
  • Loading branch information
sakshamagarwals authored Jul 12, 2020
2 parents f01f82b + 8d1f7e2 commit 3fcd3b5
Show file tree
Hide file tree
Showing 14 changed files with 1,112 additions and 134 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 0 1000 0.001
1 0 11010 0.001
13 changes: 8 additions & 5 deletions homatransport/src/application/WorkloadSynthesizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ WorkloadSynthesizer::WorkloadSynthesizer()
sendMsgSize = -1;
nextDestHostId = -1;
hostIdAddrMap.clear();
addrHostidMap.clear();
}

WorkloadSynthesizer::~WorkloadSynthesizer()
Expand Down Expand Up @@ -235,7 +236,7 @@ WorkloadSynthesizer::initialize()
distSelector =
MsgSizeDistributions::DistributionChoice::SIZE_IN_FILE;
distFileName = std::string(
"../../sizeDistributions/HostidSizeInterarrival.txt");
"../../sizeDistributions/HostidSizeInterarrival-test.txt");
} else {
throw cRuntimeError("'%s': Not a valie workload type.",workLoadType);
}
Expand Down Expand Up @@ -337,6 +338,7 @@ WorkloadSynthesizer::parseAndProcessXMLConfig()
<< token << endl;
}
hostIdAddrMap[mod->getIndex()] = result;
addrHostidMap[result.str()] = mod->getIndex();

if (!destHostIds.empty()) {
if (destHostIds.count(-1)) {
Expand Down Expand Up @@ -528,10 +530,11 @@ WorkloadSynthesizer::processRcvdMsg(cPacket* msg)
inet::L3Address srcAddr = rcvdMsg->getSrcAddr();
inet::L3Address destAddr = rcvdMsg->getDestAddr();

outputFile << srcAddr << " " << destAddr <<
" " << msgByteLen << " " << rcvdMsg->getMsgCreationTime().dbl() <<
" " << simTime() << " "
<< completionTime.dbl() << std::endl;
outputFile << addrHostidMap[srcAddr.str()] << " "
<< parentHostIdx << " " << srcAddr << " " << destAddr
<< " " << msgByteLen << " " << rcvdMsg->getMsgCreationTime().dbl()
<< " " << simTime() << " " << completionTime.dbl() << " "
<< idealMsgEndToEndDelay(rcvdMsg) << std::endl;
outputFile.flush();

delete rcvdMsg;
Expand Down
2 changes: 2 additions & 0 deletions homatransport/src/application/WorkloadSynthesizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class WorkloadSynthesizer : public cSimpleModule
int nextDestHostId; // -1 means the destination must be chosen
// randomely based on config.xml information.
std::unordered_map<int, inet::L3Address> hostIdAddrMap;
// also need host address to host id map for logging purposes
std::unordered_map<std::string, int> addrHostidMap;

// statistics
int numSent;
Expand Down
15 changes: 15 additions & 0 deletions homatransport/src/common/Lagger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#include "inet/linklayer/ethernet/Ethernet.h"
#include "inet/linklayer/ethernet/EtherMACBase.h"

#include <fstream>

extern std::ofstream logFile;
extern bool logPacketEvents;


Define_Module(Lagger);

Expand Down Expand Up @@ -49,8 +54,18 @@ Lagger::handleMessage(cMessage *msg)
} else {
if (hookType == "InputHook") {
inputHookPktHandler(msg);
if (logPacketEvents){
cModule* parentHost = this->getParentModule();
cModule* grandParentHost = parentHost->getParentModule();
logFile << simTime() << " At input lagger: " << parentHost->getName() << " " << grandParentHost->getName() << " " << grandParentHost->getIndex() << std::endl;
}
} else if (hookType == "OutputHook") {
outputHookPktHandler(msg);
if (logPacketEvents){
cModule* parentHost = this->getParentModule();
cModule* grandParentHost = parentHost->getParentModule();
logFile << simTime() << " At output lagger: " << parentHost->getName() << " " << grandParentHost->getName() << " " << grandParentHost->getIndex() << std::endl;
}
} else {
throw cRuntimeError("Lagger type '%s' is not recognized.",
hookType.c_str());
Expand Down
12 changes: 6 additions & 6 deletions homatransport/src/dcntopo/DcnTopo.ned
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ network DcnTopo

// Set input and output hooks in NICs to "Lagger" type and set the delayPar to
// hostSwTurnAroundTime
**.eth[*].numInputHooks = 1;
**.eth[*].inputHook[*].typename = "Lagger";
**.eth[*].inputHook[*].hookType = "InputHook";
nic[*].eth[*].numInputHooks = 1;
nic[*].eth[*].inputHook[*].typename = "Lagger";
nic[*].eth[*].inputHook[*].hookType = "InputHook";
nic[*].eth[*].inputHook[*].delayPar = convertUnit(hostSwTurnAroundTime, "s");
**.eth[*].numOutputHooks = 1;
**.eth[*].outputHook[*].typename = "Lagger";
**.eth[*].outputHook[*].hookType = "OutputHook";
nic[*].eth[*].numOutputHooks = 1;
nic[*].eth[*].outputHook[*].typename = "Lagger";
nic[*].eth[*].outputHook[*].hookType = "OutputHook";
nic[*].eth[*].outputHook[*].delayPar = convertUnit(hostSwTurnAroundTime, "s");

types:
Expand Down
3 changes: 2 additions & 1 deletion homatransport/src/dcntopo/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<interface hosts='**.nic[96..111]' address='10.x.6.x' netmask='255.x.x.x'/>
<interface hosts='**.nic[112..127]' address='10.x.7.x' netmask='255.x.x.x'/>
<interface hosts='**.nic[128..143]' address='10.x.8.x' netmask='255.x.x.x'/>
<interface hosts='**' address='10.x.x.x' netmask='255.x.x.x'/>
<interface hosts='**.tor[*]' address='10.x.x.x' netmask='255.x.x.x'/>
<interface hosts='**.aggRouter[*]' address='10.x.x.x' netmask='255.x.x.x'/>
</config>
</IPv4Configurator>

Expand Down
2 changes: 1 addition & 1 deletion homatransport/src/dcntopo/run.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
../homatransport -u Cmdenv -c WorkloadHadoop -r 6 -n ..:../../simulations:../../../inet/examples:../../../inet/src -l ../../../inet/src/INET vectioTransportConfig.ini
../homatransport -u Cmdenv -c InFileDist -r 6 -n ..:../../simulations:../../../inet/examples:../../../inet/src -l ../../../inet/src/INET vectioTransportConfig.ini
4 changes: 4 additions & 0 deletions homatransport/src/transport/HomaPkt.msg
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ enum PktType
GRANT = 1;
SCHED_DATA = 2;
UNSCHED_DATA = 3;
ACK = 4;
NACK = 5;
NONE = 6;
};

struct UnschedFields
Expand Down Expand Up @@ -56,6 +59,7 @@ struct GrantFields
uint16_t grantBytes;
uint32_t offset;
uint16_t schedPrio;
bool isFree;

// [(uint32_t size_upper_bound, uint16_t req_byte, uint16_t prio)]
UnsignedVec sizeReqBytesPrio;
Expand Down
Loading

0 comments on commit 3fcd3b5

Please sign in to comment.