aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-05-11 08:53:11 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-05-11 08:53:11 +0200
commit1477290330630bdf2d2ccf019b6bc416c8866dcd (patch)
treea5b608bcc809b2171f6387e6070ec335e2a152cd /src
parent9c9be6752d32106d18226e4eed7b7d68da79d178 (diff)
Improve data analysis and simulation
Diffstat (limited to 'src')
-rw-r--r--src/Inputs.cc1
-rw-r--r--src/Inputs.hpp1
-rw-r--r--src/scenarios.cc6
-rw-r--r--src/simulator.cc11
4 files changed, 13 insertions, 6 deletions
diff --git a/src/Inputs.cc b/src/Inputs.cc
index 22af68b..bef8b6f 100644
--- a/src/Inputs.cc
+++ b/src/Inputs.cc
@@ -18,6 +18,7 @@ Inputs::Inputs(std::string node_name){
data_size=d["nodes"][node_name.c_str()]["data_size"].GetInt();
extended=d["extended"].GetBool();
seed=d["seed"].GetInt();
+ hint_size=d["hint_size"].GetInt();
n_nodes=d["nodes"].MemberCount();
// Instantiate wake_ts
diff --git a/src/Inputs.hpp b/src/Inputs.hpp
index bbe4d8b..34f75b6 100644
--- a/src/Inputs.hpp
+++ b/src/Inputs.hpp
@@ -77,6 +77,7 @@ public:
bool use_hint;
bool extended;
int data_size;
+ int hint_size;
int seed;
int n_nodes;
}; \ No newline at end of file
diff --git a/src/scenarios.cc b/src/scenarios.cc
index f34c9c3..3102e3d 100644
--- a/src/scenarios.cc
+++ b/src/scenarios.cc
@@ -17,10 +17,10 @@ using namespace rapidjson;
int main(int argc, char **argv){
// Setup seed
- if(argc!=14){
+ if(argc!=15){
cerr << "Usage: " << argv[0] <<
" <seed> <simtime> <wakeupevery> <wakeupfor> <n_nodes>" <<
- " <extended> <hint> <poff> <pon> <prx> <ptx> <datasize> <bitrate>" <<
+ " <extended> <hint> <poff> <pon> <prx> <ptx> <datasize> <bitrate> <hintsize>" <<
endl;
exit(1);
}
@@ -39,6 +39,7 @@ int main(int argc, char **argv){
double ptx=stod(argv[11]);
unsigned int datasize=atoi(argv[12]);
string bitrate(argv[13]);
+ unsigned int hintsize=atoi(argv[14]);
// Setup seed
@@ -52,6 +53,7 @@ int main(int argc, char **argv){
simkeyValue.SetString(bitrate.c_str(),bitrate.size(),d.GetAllocator());
d.AddMember("bitrate",simkeyValue,d.GetAllocator());
d.AddMember("extended",extended,d.GetAllocator());
+ d.AddMember("hint_size",hintsize,d.GetAllocator());
// Create nodes
Value nodes(kObjectType);
diff --git a/src/simulator.cc b/src/simulator.cc
index c3d961d..6b3e5b0 100644
--- a/src/simulator.cc
+++ b/src/simulator.cc
@@ -27,9 +27,10 @@ typedef unsigned int u32;
*/
class Payload{
public:
- Payload():hint(0),duration(0),containsHint(false){}
+ Payload():hint(0),duration(0),containsHint(false),size(0){}
double hint;
double duration;
+ int size;
bool containsHint;
std::string node;
};
@@ -109,10 +110,12 @@ static void obs_node(std::vector<std::string> args) {
if(isSender){ // If I am a sender
Payload *p=new Payload();
p->node=selfName;
+ p->size=data_size;
if(useHint&&i.HasNext()){
p->containsHint=true;
p->hint=i.GetNextTS();
p->duration=i.GetNextDuration();
+ p->size=data_size+i.hint_size;
}
if(i.extended){
// We use a trick here
@@ -124,11 +127,11 @@ static void obs_node(std::vector<std::string> args) {
m->put(p,0,uptime);
simgrid::s4u::Mailbox *m_ext= simgrid::s4u::Mailbox::by_name("medium"+selfName);
MODE_TX();
- m_ext->put(p,data_size);
+ m_ext->put(p,p->size);
}
else{
MODE_TX();
- m->put(p,data_size,uptime);
+ m->put(p,p->size,uptime);
}
nSend++;
isSender=(nSend<(i.n_nodes-1));
@@ -186,5 +189,5 @@ static void obs_node(std::vector<std::string> args) {
}
// Done
MODE_OFF()
- XBT_INFO("Observation node %s finished [LOG2PARSE](node:%s|nSend:%d|nWakeUp:%d|nDataRcv:%d|nSendFail:%d|nRcvFail:%d|totalUptime:%f|seed:%d)",selfName.c_str(),selfName.c_str(),nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,totalUptime,i.seed);
+ XBT_INFO("Observation node %s finished [LOG2PARSE](node:%s|isSender:%d|nSend:%d|nWakeUp:%d|nDataRcv:%d|nSendFail:%d|nRcvFail:%d|totalUptime:%f|seed:%d)",selfName.c_str(),selfName.c_str(),i.is_sender,nSend,nWakeUp,nDataRcv,nSendFail,nRcvFail,totalUptime,i.seed);
} \ No newline at end of file