Commit 88d99a86 authored by shengjh's avatar shengjh 🇨🇳
Browse files

Try to make the WorkloadSynthesizer.cc Working.

parents
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="org.omnetpp.cdt.gnu.config.debug.1129532685">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.omnetpp.cdt.gnu.config.debug.1129532685" moduleId="org.eclipse.cdt.core.settings" name="debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="org.omnetpp.cdt.gnu.config.debug.1129532685" name="debug" parent="org.omnetpp.cdt.gnu.config.debug">
<folderInfo id="org.omnetpp.cdt.gnu.config.debug.1129532685." name="/" resourcePath="">
<toolChain id="org.omnetpp.cdt.gnu.toolchain.debug.1821014475" name="C++ Toolchain for OMNeT++" superClass="org.omnetpp.cdt.gnu.toolchain.debug">
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.MachO64;org.eclipse.cdt.core.PE" id="org.omnetpp.cdt.targetPlatform.788523457" isAbstract="false" name="Windows, Linux, Mac" osList="win32,linux,macosx" superClass="org.omnetpp.cdt.targetPlatform"/>
<builder id="org.omnetpp.cdt.gnu.builder.debug.740772511" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="OMNeT++ Make Builder (opp_makemake)" superClass="org.omnetpp.cdt.gnu.builder.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1465116300" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.570835948" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.225543778" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../../src"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.162883184" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.591736027" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1497451886" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../../src"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1817116036" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.1072472336" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.1059236047" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1478399519" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.base.25027629" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.1719978384" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../../src"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1665584104" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="simulations"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="org.omnetpp.cdt.gnu.config.release.1098127154">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.omnetpp.cdt.gnu.config.release.1098127154" moduleId="org.eclipse.cdt.core.settings" name="release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="org.omnetpp.cdt.gnu.config.release.1098127154" name="release" parent="org.omnetpp.cdt.gnu.config.release">
<folderInfo id="org.omnetpp.cdt.gnu.config.release.1098127154." name="/" resourcePath="">
<toolChain id="org.omnetpp.cdt.gnu.toolchain.release.1118741311" name="C++ Toolchain for OMNeT++" superClass="org.omnetpp.cdt.gnu.toolchain.release">
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.MachO64;org.eclipse.cdt.core.PE" id="org.omnetpp.cdt.targetPlatform.1173394564" isAbstract="false" name="Windows, Linux, Mac" osList="win32,linux,macosx" superClass="org.omnetpp.cdt.targetPlatform"/>
<builder id="org.omnetpp.cdt.gnu.builder.release.501898576" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="OMNeT++ Make Builder (opp_makemake)" superClass="org.omnetpp.cdt.gnu.builder.release"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.2021405562" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.642012093" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.728074668" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/src}&quot;"/>
<listOptionValue builtIn="false" value="../../src"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.401974327" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.403320710" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1738718894" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/src}&quot;"/>
<listOptionValue builtIn="false" value="../../src"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1317044548" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.1804791927" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.864629746" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1890881018" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.base.1776795898" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.264532140" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/src}&quot;"/>
<listOptionValue builtIn="false" value="../../src"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.646112021" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="simulations"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="dctrans.org.omnetpp.cdt.omnetppProjectType.324327461" name="OMNeT++ Simulation" projectType="org.omnetpp.cdt.omnetppProjectType"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="org.omnetpp.cdt.gnu.config.debug.1129532685">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.omnetpp.cdt.OmnetppGCCPerProjectProfile"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="org.omnetpp.cdt.gnu.config.release.1098127154">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.omnetpp.cdt.OmnetppGCCPerProjectProfile"/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="debug">
<resource resourceType="PROJECT" workspacePath="/dctrans"/>
</configuration>
<configuration configurationName="release">
<resource resourceType="PROJECT" workspacePath="/dctrans"/>
</configuration>
</storageModule>
</cproject>
\ No newline at end of file
/src/**/Makefile
*_m.h
*_m.cc
*_sm.h
*_sm.cc
/.settings
/.vscode
/out
/script/**/results
/script/**/figures
/simulations/**/results
/simulations/**/*.anf
simulations
src/dctrans
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<buildspec version="4.0">
<dir makemake-options="--deep --meta:recurse --meta:use-exported-include-paths --meta:export-library --meta:use-exported-libs" path="src" type="makemake"/>
<dir path="." type="custom"/>
</buildspec>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<featurestates/>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>dctrans</name>
<comment></comment>
<projects>
<project>inet</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.omnetpp.cdt.MakefileBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.omnetpp.scave.builder.vectorfileindexer</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.omnetpp.main.omnetppnature</nature>
</natures>
</projectDescription>
all: checkmakefiles
cd src && $(MAKE)
clean: checkmakefiles
cd src && $(MAKE) clean
cleanall: checkmakefiles
cd src && $(MAKE) MODE=release clean
cd src && $(MAKE) MODE=debug clean
rm -f src/Makefile
makefiles:
cd src && opp_makemake -f --deep
checkmakefiles:
@if [ ! -f src/Makefile ]; then \
echo; \
echo '======================================================================='; \
echo 'src/Makefile does not exist. Please use "make makefiles" to generate it!'; \
echo '======================================================================='; \
echo; \
exit 1; \
fi
package dctrans.simulations;
@license(LGPL);
#!/bin/sh
cd `dirname $0`
../src/dctrans -n .:../src $*
# for shared lib, use: opp_run -l ../src/dctrans -n .:../src $*
{
"configurations": [
{
"name": "Win32",
"includePath": [
"D:/Program/omnetpp-5.6.2/include/**",
"${workspaceFolder}/../**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
\ No newline at end of file
{
"files.associations": {
"system_error": "cpp",
"xlocale": "cpp"
}
}
\ No newline at end of file
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
import inet.networklayer.common.L3Address;
packet AppMessage {
inet::L3Address destAddr;
inet::L3Address srcAddr;
simtime_t msgCreationTime;
simtime_t transportSchedDelay;
simtime_t transportSchedPreemptionLag;
long msgBytesOnWire;
}
\ No newline at end of file
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
package dctrans.applications;
//
// Interface for applications
//
moduleinterface ITrafficGeneratorApp
{
parameters:
@display("i=block/app");
xml appConfig;
int nicLinkSpeed @unit(Gbps);
int fabricLinkSpeed @unit(Gbps);
double fabricLinkDelay @unit(us);
double edgeLinkDelay @unit(us);
double hostSwTurnAroundTime @unit(us);
double hostNicSxThinkTime @unit(us);
double switchFixDelay @unit(us);
gates:
input transportIn @label(AppMessage/up);
output transportOut @labels(AppMessage/down);
}
/*
* MsgSizeDistributions.cc
*
* Created on: May 22, 2015
* Author: neverhood
*/
#include <fstream>
#include <cstdio>
#include <math.h>
#include <stdio.h>
#include "MsgSizeDistributions.h"
/**
* avgRate must be in Gb/s defined as loadFactor*nicLinkSpeed
*/
MsgSizeDistributions::MsgSizeDistributions(const char* distFileName,
int maxDataBytesPerPkt, InterArrivalDist interArrivalDist,
DistributionChoice sizeDistSelector, double avgRate, int callerHostId)
: msgSizeProbDistVector()
, msgSizeDestInterarrivalQueue()
, sizeDistSelector(sizeDistSelector)
, interArrivalDist(interArrivalDist)
, SEED(0)
, avgMsgSize(0.0)
, avgInterArrivalTime(0.0)
, maxDataBytesPerPkt(maxDataBytesPerPkt)
{
rng = omnetpp::cSimulation::getActiveSimulation()->getContext()->getRNG(SEED);
std::ifstream distFileStream;
distFileStream.open(distFileName);
if (distFileStream.fail()) {
char buf[100];
snprintf(buf, 100, "%s: Failed to open file.", distFileName);
throw MsgSizeDistException(buf);
distFileStream.close();
}
if (sizeDistSelector >= DistributionChoice::NO_SIZE_DIST_SPECIFIED ||
sizeDistSelector < 0) {
throw MsgSizeDistException("Invalide MsgSize Distribution Selected.");
}
if (interArrivalDist >= InterArrivalDist::NO_INTERARRIAVAL_DIST_SPECIFIED ||
interArrivalDist < 0) {
throw MsgSizeDistException("Invalid MsgArrival Distribution Selected.");
}
if (sizeDistSelector == DistributionChoice::SIZE_IN_FILE){
ASSERT(interArrivalDist == InterArrivalDist::INTERARRIVAL_IN_FILE);
double dt = 0.0;
std::string hostIdSizeInterarrivalLine;
int srcHostId;
int destHostId;
int msgSize;
double deltaTime;
while (getline(distFileStream, hostIdSizeInterarrivalLine)) {
sscanf(hostIdSizeInterarrivalLine.c_str(), "%d %d %d %lf",
&srcHostId, &destHostId, &msgSize, &deltaTime);
dt += deltaTime;
if (srcHostId == callerHostId) {
msgSizeDestInterarrivalQueue.push(
std::make_tuple(msgSize, destHostId, dt));
dt = 0.0;
}
}
} else {
ASSERT(interArrivalDist != InterArrivalDist::INTERARRIVAL_IN_FILE);
std::string avgMsgSizeStr;
std::string sizeProbStr;
// The first line of distFileName is the average message size of the
// distribution.
getline(distFileStream, avgMsgSizeStr);
sscanf(avgMsgSizeStr.c_str(), "%lf", &avgMsgSize);
if (sizeDistSelector == DistributionChoice::DCTCP) {
avgMsgSize *= maxDataBytesPerPkt; // AvgSize in terms of bytes
}
avgInterArrivalTime = 1e-9 * avgMsgSize * 8 / avgRate;
// reads msgSize<->probabilty pairs from "distFileName" file
while(getline(distFileStream, sizeProbStr)) {
int msgSize;
double prob;
sscanf(sizeProbStr.c_str(), "%d %lf",
&msgSize, &prob);
msgSizeProbDistVector.push_back(std::make_pair(msgSize, prob));
}
}
distFileStream.close();
}
void
MsgSizeDistributions::getSizeAndInterarrival(int &msgSize, int &destHostId,
double &nextInterarrivalTime)
{
// Default value -1 if not destHostId is determined in the files. In which
// case, the destination will be chosen based on the config.xml file.
destHostId = -1;
switch(sizeDistSelector) {
case DistributionChoice::DCTCP:
case DistributionChoice::GOOGLE_ALL_RPC:
case DistributionChoice::GOOGLE_SEARCH_RPC:
case DistributionChoice::FACEBOOK_WEB_SERVER_INTRACLUSTER:
case DistributionChoice::FACEBOOK_CACHE_FOLLOWER_INTRACLUSTER:
case DistributionChoice::FACEBOOK_HADOOP_ALL:
case DistributionChoice::FABRICATED_HEAVY_MIDDLE:
case DistributionChoice::FABRICATED_HEAVY_HEAD:
case DistributionChoice::TEST_DIST:
getInterarrivalSizeFromVec(msgSize, nextInterarrivalTime);
return;
case DistributionChoice::FACEBOOK_KEY_VALUE:
getFacebookSizeInterarrival(msgSize, nextInterarrivalTime);
return;
case DistributionChoice::SIZE_IN_FILE:
getInfileSizeInterarrivalDest(msgSize, destHostId,
nextInterarrivalTime);
return;
default:
msgSize = -1;
nextInterarrivalTime = 0.0;
return;
}
}
void
MsgSizeDistributions::getInfileSizeInterarrivalDest(int &msgSize,
int &destHostId, double &nextInterarrivalTime)
{
ASSERT(interArrivalDist == InterArrivalDist::INTERARRIVAL_IN_FILE);
if (msgSizeDestInterarrivalQueue.empty()) {
msgSize = -1;
nextInterarrivalTime = 0.0;
return;
}
auto msgTuple = msgSizeDestInterarrivalQueue.front();
msgSize = std::get<0>(msgTuple);
destHostId = std::get<1>(msgTuple);
nextInterarrivalTime = std::get<2>(msgTuple);
msgSizeDestInterarrivalQueue.pop();
return;
}
/*
* Internal method for DCTCP, TestDist, FACEBOOK_CACHE_FOLLOWER_INTRACLUSTER,
* FACEBOOK_WEB_SERVER_INTRACLUSTER, FACEBOOK_HADOOP_ALL,
* FABRICATED_HEAVY_MIDDLE, and FABRICATED_HEAVY_HEAD
*/
void
MsgSizeDistributions::getInterarrivalSizeFromVec(int &msgSize,
double &nextInterarrivalTime)
{
double prob = uniform(rng, 0.0, 1.0);
size_t mid, high, low;
high = msgSizeProbDistVector.size() - 1;
low = 0;
while(low < high) {
mid = (high + low) / 2;
if (prob <= msgSizeProbDistVector[mid].second) {
high = mid;
} else {
low = mid + 1;
}
}
msgSize = msgSizeProbDistVector[high].first;
if (sizeDistSelector == DistributionChoice::DCTCP){
msgSize *= maxDataBytesPerPkt;
}
//generate the interarrival time
nextInterarrivalTime = getInterarrivalTime();
return;
}
void
MsgSizeDistributions::getFacebookSizeInterarrival(int &msgSize,
double &nextInterarrivalTime)
{
// Facebook KeyValue workload constants
int sizeOffset = msgSizeProbDistVector.back().first;
double probOffset = msgSizeProbDistVector.back().second;
// Generalized pareto distribution parameters
const double k = 0.348238;
const double sigma = 214.476;
// Maximum allowed Msg size
const int maxSize = 0x40000000;
double prob = uniform(rng, 0.0, 1.0);
int size;
if (prob <= msgSizeProbDistVector.back().second) {
int first = 0;
int last = msgSizeProbDistVector.size() - 1;
while (first < last) {
int mid = first + (last - first)/2;
if (prob <= msgSizeProbDistVector[mid].second) {
last = mid;
} else {
first = mid + 1;
}
}
size = msgSizeProbDistVector[first].first;
} else {
double msgSizeTemp =
round( sizeOffset +
(pow((1-probOffset)/(1-prob), k) - 1) * sigma / k );
size = msgSizeTemp > maxSize ? maxSize : (int)(msgSizeTemp);
}
msgSize = size;
//generate the interarrival gap
nextInterarrivalTime = getInterarrivalTime();
return;
}
double
MsgSizeDistributions::facebookParetoInterGap()
{
// Generalized pareto distribution parameters
const double k = 0.154971;
const double sigma = 16.0292e-6;
// Maximum interarrival gap
const int maxGap = 1000;
double prob = uniform(rng, 0.0, 1.0);
double gapTime = (pow(1/(1-prob), k) - 1) * sigma / k;
// Capping the gap value at the maxGap
if (gapTime > maxGap) {
gapTime = maxGap;
}
return gapTime;
}
double
MsgSizeDistributions::getInterarrivalTime()
{
if (interArrivalDist == InterArrivalDist::EXPONENTIAL) {
return exponential(rng, avgInterArrivalTime);
} else if (interArrivalDist == InterArrivalDist::FACEBOOK_PARETO) {
return facebookParetoInterGap();