Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Nov 18, 2023
1 parent 5552eff commit 6a01cb0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
14 changes: 5 additions & 9 deletions include/wrench/simgrid_S4U_util/S4U_CommPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ namespace wrench {
std::unique_ptr<TMessageType> getMessage(const std::string &error_prefix = "") {
auto id = ++messageCounter;
#ifndef NDEBUG
// char const *type_name = typeid(TMessageType).name();
// std::string tn = boost::core::demangle(type_name);
auto tn = this->templateWaitingLog(get_type_name<TMessageType>(), id);
#endif

Expand All @@ -77,8 +75,6 @@ namespace wrench {
message.release();
return std::unique_ptr<TMessageType>(msg);
} else {
// char const *type_name = typeid(TMessageType).name();
// std::string tn = boost::core::demangle(type_name);
throw std::runtime_error(error_prefix + " Unexpected [" + message->getName() + "] message while waiting for " +
get_type_name<TMessageType>() + ". Request ID: " + std::to_string(id));
}
Expand All @@ -98,8 +94,6 @@ namespace wrench {
std::unique_ptr<TMessageType> getMessage(double timeout, const std::string &error_prefix = "") {
auto id = ++messageCounter;
#ifndef NDEBUG
// char const *type_name = typeid(TMessageType).name();
// std::string tn = boost::core::demangle(type_name);
auto tn = get_type_name<TMessageType>();
this->templateWaitingLog(tn, id);
#endif
Expand All @@ -114,8 +108,6 @@ namespace wrench {
#endif
return std::unique_ptr<TMessageType>(msg);
} else {
// char const *type_name = typeid(TMessageType).name();
// std::string tn = boost::core::demangle(type_name);
throw std::runtime_error(error_prefix + " Unexpected [" + message->getName() + "] message while waiting for " +
get_type_name<TMessageType>() + ". Request ID: " + std::to_string(id));
}
Expand Down Expand Up @@ -144,13 +136,14 @@ namespace wrench {
return this->getMessage(timeout, true);
}


void putMessage(SimulationMessage *m);
void dputMessage(SimulationMessage *msg);
std::shared_ptr<S4U_PendingCommunication> iputMessage(SimulationMessage *msg);
std::shared_ptr<S4U_PendingCommunication> igetMessage();

static unsigned long generateUniqueSequenceNumber();

static unsigned long generateUniqueSequenceNumber();
static S4U_CommPort *getTemporaryCommPort();
static void retireTemporaryCommPort(S4U_CommPort *commport);
static void createCommPortPool(unsigned long num_commports);
Expand Down Expand Up @@ -180,6 +173,8 @@ namespace wrench {
}

private:


friend class S4U_Daemon;
friend class S4U_PendingCommunication;

Expand All @@ -189,6 +184,7 @@ namespace wrench {
std::unique_ptr<SimulationMessage> getMessage(bool log);
std::unique_ptr<SimulationMessage> getMessage(double timeout, bool log);


void templateWaitingLog(const std::string& type, unsigned long long id);
void templateWaitingLogUpdate(const std::string& type, unsigned long long id);

Expand Down
8 changes: 2 additions & 6 deletions src/wrench/simgrid_S4U_util/S4U_CommPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@ namespace wrench {
double S4U_CommPort::default_control_message_size;



class WorkflowTask;
/**
* @brief Helper method that avoids calling WRENCH_DEBUG from a .h file and do the logging for the templated getMessage() method.
* @brief Helper method that avoids calling WRENCH_DEBUG from a .h file and do the logging for the templated getMessage() method.
* It also has the added bonus of checking for inheritance
*
* @param commport: the commport so we can get its name
* @param type: a pointer to the message so we have its type
* @param id: an integer id
*
Expand All @@ -56,10 +53,9 @@ namespace wrench {
}

/**
* @brief Helper method that avoids calling WRENCH_DEBUG from a .h file and do the logging for the templated getMessage() method.
* @brief Helper method that avoids calling WRENCH_DEBUG from a .h file and do the logging for the templated getMessage() method.
* It also has the added bonus of checking for inheritance.
*
* @param commport: the commport so we can get its name
* @param type: a pointer to the message so we have its type
* @param id: an integer id
*
Expand Down
2 changes: 1 addition & 1 deletion test/simulation/S4U_CommPortTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ void S4U_CommPortTest::do_NetworkTimeout_test() {


/**********************************************************************/
/** NULL MAILBOX TEST **/
/** NULL COMPORT TEST **/
/**********************************************************************/

class NullCommPortTestWMS : public wrench::ExecutionController {
Expand Down
2 changes: 1 addition & 1 deletion test/simulation/SimulationCommandLineArgumentsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void SimulationCommandLineArgumentsTest::do_HelpArgument_test() {
}

/**********************************************************************/
/** MAILBOX-POOL-SIZE COMMAND-LINE ARGUMENT **/
/** COMMPORT-POOL-SIZE COMMAND-LINE ARGUMENT **/
/**********************************************************************/

TEST_F(SimulationCommandLineArgumentsTest, CommPortPoolSizeArgument) {
Expand Down

0 comments on commit 6a01cb0

Please sign in to comment.