aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-05-07 09:07:20 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-05-07 09:07:20 +0200
commit9bc9ab691afeeb676ae9b3c386a49c13a453dc0b (patch)
tree5a0d86c07202375a48fe844b494bb98299122958
parentb7abfc66f0a5a30e9703908c018032d68e65d6b7 (diff)
Debug parser and cleaning
-rwxr-xr-xparser.awk27
-rw-r--r--src/Inputs.cc6
-rw-r--r--src/simulator.cc18
3 files changed, 33 insertions, 18 deletions
diff --git a/parser.awk b/parser.awk
index d1e4289..f146bfd 100755
--- a/parser.awk
+++ b/parser.awk
@@ -1,21 +1,24 @@
#!/usr/bin/awk -f
BEGIN {
- RS=" "
+ RS="\n"
+ FS=" "
CSV_HEADER=""
CSV_DATA=""
+ # ENERGY created below
}
/LOG2PARSE/{
# First extract what we need
- to_parse=$1
+ split($0,fields," ")
+ to_parse=fields[8]
gsub(/\[LOG2PARSE\]\(/,"",to_parse)
gsub(/\)/,"",to_parse)
split(to_parse,tokens,"|")
# Check if we have to build the csv header
if(CSV_HEADER==""){
- for(i = 1; i<length(tokens);i++){
+ for(i = 1; i<=length(tokens);i++){
split(tokens[i],h,":")
if(CSV_HEADER=="")
CSV_HEADER=h[1]
@@ -26,7 +29,7 @@ BEGIN {
# Build a row
row=""
- for(i = 1; i<length(tokens);i++){
+ for(i = 1; i<=length(tokens);i++){
split(tokens[i],h,":")
if(row=="")
row=h[2]
@@ -42,7 +45,19 @@ BEGIN {
}
+/\[surf_energy\/INFO\] Energy/ {
+ $7=substr($7, 1, length($7)-1)
+ ENERGY[$7]=$8
+}
+
+
END {
- print(CSV_HEADER);
- print(CSV_DATA)
+ print(CSV_HEADER",energy");
+
+ # Print data and add up energy values
+ split(CSV_DATA,rows, "\n")
+ for(i=1;i<=length(rows);i++){
+ split(rows[i],fields, ",")
+ print(rows[i]","ENERGY[fields[1]])
+ }
} \ No newline at end of file
diff --git a/src/Inputs.cc b/src/Inputs.cc
index de81aec..d71d8f7 100644
--- a/src/Inputs.cc
+++ b/src/Inputs.cc
@@ -5,7 +5,7 @@
#include <fstream>
Inputs::Inputs(std::string node_name){
- // Here we doing all the boring stuff
+ // Here we do all the boring stuff
FILE* input_file = fopen(INPUTS_FILE, "rb");
char input_file_buffer[JSON_BUFFER_SIZE];
rapidjson::FileReadStream is(input_file, input_file_buffer, sizeof(input_file_buffer));
@@ -64,7 +64,7 @@ void Inputs::MergeEvents(){
}
double Inputs::GetNextTS(){
- // Ensure the caller is smart
+ // Ensure that the caller is smart
if(wake_duration.size()<2){
std::cerr << "You are trying to access to the next timestamp but it does not exists" <<std::endl;
exit(1);
@@ -73,7 +73,7 @@ double Inputs::GetNextTS(){
}
double Inputs::GetNextDuration(){
- // Ensure the caller is smart
+ // Ensure that the caller is smart
if(wake_duration.size()<2){
std::cerr << "You are trying to access to the next duration but it does not exists" <<std::endl;
exit(1);
diff --git a/src/simulator.cc b/src/simulator.cc
index 167810f..5da125d 100644
--- a/src/simulator.cc
+++ b/src/simulator.cc
@@ -17,7 +17,7 @@
/// @brief Required by SimGrid
XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[DAO]");
-/// @brief For convenience
+/// @brief For convenience sake
typedef unsigned int u32;
/**
@@ -61,7 +61,7 @@ int main(int argc, char **argv) {
simgrid::s4u::Actor::create("ON", simgrid::s4u::Host::by_name(ss.str()), obs_node, args);
}
- // Setup/Run simulation
+ // Launch the simulation
engine.run();
XBT_INFO("Simulation took %fs", simgrid::s4u::Engine::get_clock());
XBT_INFO("The simulated platform file is available in \"%s\"",PLATFORM_FILE);
@@ -109,11 +109,11 @@ static void obs_node(std::vector<std::string> args) {
}
if(i.extended){
// We use a trick here
- // First we send an instantanous message (size=0) with a timeout
+ // First we send an instantaneous message (size=0) with the usual timeout
// to check whether there is a receiver!
// If there is one, we are sure that a put in the "medium"+selfName
// will not lead to a deadlock (cf anchor:5623) and we are using a exclusive
- // channel (to avoid another receiver to get the message)
+ // channel (to avoid other receivers to get the message)
m->put(p,0,i.GetDuration());
simgrid::s4u::Mailbox *m_ext= simgrid::s4u::Mailbox::by_name("medium"+selfName);
m_ext->put(p,data_size);
@@ -121,7 +121,7 @@ static void obs_node(std::vector<std::string> args) {
else{
m->put(p,data_size,i.GetDuration());
}
- XBT_INFO("%s send data successfully",selfName.c_str());
+ XBT_INFO("%s sent data successfully",selfName.c_str());
isObserver=true; // Do one send for now...
isSender=false;
}
@@ -130,7 +130,7 @@ static void obs_node(std::vector<std::string> args) {
if(i.extended){
// anchor:5623 We can see here that
// we first receive the instantaneous message
- // and then use the mailbox specific to the sender (to have an exclusive channel)
+ // and then we use a mailbox specific to the sender (to have an exclusive channel)
p=m->get<Payload>(i.GetDuration());
simgrid::s4u::Mailbox *m_ext_sender = simgrid::s4u::Mailbox::by_name("medium"+p->node);
p=m_ext_sender->get<Payload>();
@@ -149,18 +149,18 @@ static void obs_node(std::vector<std::string> args) {
}
}
else {
- XBT_INFO("%s is observing is environment...",selfName.c_str());
+ XBT_INFO("%s is observing his environment...",selfName.c_str());
simgrid::s4u::this_actor::sleep_until(i.GetDuration());
}
}
catch (...)
{
if(isSender){
- XBT_INFO("%s failed to send data",selfName.c_str());
+ XBT_INFO("%s could not send any data",selfName.c_str());
nSendFail++;
}
else{
- XBT_INFO("%s failed to receive data",selfName.c_str());
+ XBT_INFO("%s could not receive any data",selfName.c_str());
nRcvFail++;
}
}