- popping_bodies.cpp:
The BODY function of each simcall
- popping_enum.hpp:
- Definition of type `enum e_smx_simcall_t` (one value per existing simcall)
+ Definition of type `enum class Simcall` (one value per existing simcall)
- popping_generated.cpp:
Definitions of `simcall_names[]` (debug name of each simcall), and
ActorImpl::simcall_handle() that deals with the simcall from within the kernel
@code{cpp}
struct s_smx_simcall {
// Simcall number:
- e_smx_simcall_t call;
+ Simcall call;
// Issuing actor:
smx_actor_t issuer;
// Arguments of the simcall:
* list. Afterwards, get the position of the actual synchro in the waitany list and return it as the result of the
* simcall */
- if (simcall->call_ == SIMCALL_NONE) // FIXME: maybe a better way to handle this case
- continue; // if actor handling comm is killed
- if (simcall->call_ == SIMCALL_COMM_WAITANY) {
+ if (simcall->call_ == simix::Simcall::NONE) // FIXME: maybe a better way to handle this case
+ continue; // if actor handling comm is killed
+ if (simcall->call_ == simix::Simcall::COMM_WAITANY) {
SIMIX_waitany_remove_simcall_from_actions(simcall);
if (simcall->timeout_cb_) {
simcall->timeout_cb_->remove();
}
/* if there is an exception during a waitany or a testany, indicate the position of the failed communication */
if (simcall->issuer_->exception_ &&
- (simcall->call_ == SIMCALL_COMM_WAITANY || simcall->call_ == SIMCALL_COMM_TESTANY)) {
+ (simcall->call_ == simix::Simcall::COMM_WAITANY || simcall->call_ == simix::Simcall::COMM_TESTANY)) {
// First retrieve the rank of our failing synchro
CommImpl** comms;
size_t count;
- if (simcall->call_ == SIMCALL_COMM_WAITANY) {
+ if (simcall->call_ == simix::Simcall::COMM_WAITANY) {
comms = simcall_comm_waitany__get__comms(simcall);
count = simcall_comm_waitany__get__count(simcall);
} else {
- /* simcall->call_ == SIMCALL_COMM_TESTANY */
+ /* simcall->call_ == simix::Simcall::COMM_TESTANY */
comms = simcall_comm_testany__get__comms(simcall);
count = simcall_comm_testany__get__count(simcall);
}
/* Now transform the cond wait simcall into a mutex lock one */
smx_simcall_t simcall = &proc.simcall_;
MutexImpl* simcall_mutex;
- if (simcall->call_ == SIMCALL_COND_WAIT)
+ if (simcall->call_ == simix::Simcall::COND_WAIT)
simcall_mutex = simcall_cond_wait__get__mutex(simcall);
else
simcall_mutex = simcall_cond_wait_timeout__get__mutex(simcall);
- simcall->call_ = SIMCALL_MUTEX_LOCK;
+ simcall->call_ = simix::Simcall::MUTEX_LOCK;
simcall_mutex->lock(simcall->issuer_);
}
* list. Afterwards, get the position of the actual synchro in the waitany list and return it as the result of the
* simcall */
- if (simcall->call_ == SIMCALL_NONE) // FIXME: maybe a better way to handle this case
+ if (simcall->call_ == simix::Simcall::NONE) // FIXME: maybe a better way to handle this case
continue; // if process handling comm is killed
- if (simcall->call_ == SIMCALL_EXECUTION_WAITANY_FOR) {
+ if (simcall->call_ == simix::Simcall::EXECUTION_WAITANY_FOR) {
simgrid::kernel::activity::ExecImpl** execs = simcall_execution_waitany_for__get__execs(simcall);
size_t count = simcall_execution_waitany_for__get__count(simcall);
}
switch (simcall->call_) {
- case SIMCALL_MUTEX_LOCK:
+ case simix::Simcall::MUTEX_LOCK:
simcall_mutex_lock__get__mutex(simcall)->remove_sleeping_actor(*simcall->issuer_);
break;
- case SIMCALL_COND_WAIT:
+ case simix::Simcall::COND_WAIT:
simcall_cond_wait_timeout__get__cond(simcall)->remove_sleeping_actor(*simcall->issuer_);
break;
- case SIMCALL_COND_WAIT_TIMEOUT:
+ case simix::Simcall::COND_WAIT_TIMEOUT:
simcall_cond_wait_timeout__get__cond(simcall)->remove_sleeping_actor(*simcall->issuer_);
simcall_cond_wait_timeout__set__result(simcall, 1); // signal a timeout
break;
- case SIMCALL_SEM_ACQUIRE:
+ case simix::Simcall::SEM_ACQUIRE:
simcall_sem_acquire_timeout__get__sem(simcall)->remove_sleeping_actor(*simcall->issuer_);
break;
- case SIMCALL_SEM_ACQUIRE_TIMEOUT:
+ case simix::Simcall::SEM_ACQUIRE_TIMEOUT:
simcall_sem_acquire_timeout__get__sem(simcall)->remove_sleeping_actor(*simcall->issuer_);
simcall_sem_acquire_timeout__set__result(simcall, 1); // signal a timeout
break;
if (this != simix_global->maestro_) {
XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall_.call_), (int)simcall_.call_,
get_cname(), this);
- xbt_assert(simcall_.call_ != SIMCALL_NONE);
- simcall_.call_ = SIMCALL_NONE;
+ xbt_assert(simcall_.call_ != simix::Simcall::NONE);
+ simcall_.call_ = simix::Simcall::NONE;
xbt_assert(not XBT_LOG_ISENABLED(simix_process, xbt_log_priority_debug) ||
std::find(begin(simix_global->actors_to_run), end(simix_global->actors_to_run), this) ==
end(simix_global->actors_to_run),
std::vector<std::string> tmp;
boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";"));
- if (parameters.size() != 4 || parameters.empty()) {
+ if (parameters.size() != 4) {
surf_parse_error(
"Dragonfly are defined by the number of groups, chassis per groups, blades per chassis, nodes per blade");
}
add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
/* Check that the route does not already exist */
- if (gw_dst) // netzone route (to adapt the error message, if any)
+ if (gw_dst && gw_src) // netzone route (to adapt the error message, if any)
xbt_assert(nullptr == TO_FLOYD_LINK(src->id(), dst->id()),
"The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).",
src->get_cname(), gw_src->get_cname(), dst->get_cname(), gw_dst->get_cname());
TO_FLOYD_COST(src->id(), dst->id()) = (TO_FLOYD_LINK(src->id(), dst->id()))->link_list.size();
if (symmetrical) {
- if (gw_dst) // netzone route (to adapt the error message, if any)
+ if (gw_dst && gw_src) // netzone route (to adapt the error message, if any)
xbt_assert(
nullptr == TO_FLOYD_LINK(dst->id(), src->id()),
"The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
routing_table_.resize(table_size * table_size, nullptr);
/* Check that the route does not already exist */
- if (gw_dst) // inter-zone route (to adapt the error message, if any)
+ if (gw_dst && gw_src) // inter-zone route (to adapt the error message, if any)
xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()),
"The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).",
src->get_cname(), gw_src->get_cname(), dst->get_cname(), gw_dst->get_cname());
void ModelChecker::resume(RemoteSimulation& process)
{
- int res = checker_side_.get_channel().send(MC_MESSAGE_CONTINUE);
+ int res = checker_side_.get_channel().send(MessageType::CONTINUE);
if (res)
throw xbt::errno_error();
process.clear_cache();
memcpy(&base_message, buffer, sizeof(base_message));
switch(base_message.type) {
- case MC_MESSAGE_IGNORE_HEAP:
- {
- s_mc_message_ignore_heap_t message;
- xbt_assert(size == sizeof(message), "Broken message");
- memcpy(&message, buffer, sizeof(message));
-
- IgnoredHeapRegion region;
- region.block = message.block;
- region.fragment = message.fragment;
- region.address = message.address;
- region.size = message.size;
- get_remote_simulation().ignore_heap(region);
- break;
+ case MessageType::IGNORE_HEAP: {
+ s_mc_message_ignore_heap_t message;
+ xbt_assert(size == sizeof(message), "Broken message");
+ memcpy(&message, buffer, sizeof(message));
+
+ IgnoredHeapRegion region;
+ region.block = message.block;
+ region.fragment = message.fragment;
+ region.address = message.address;
+ region.size = message.size;
+ get_remote_simulation().ignore_heap(region);
+ break;
}
- case MC_MESSAGE_UNIGNORE_HEAP:
- {
- s_mc_message_ignore_memory_t message;
- xbt_assert(size == sizeof(message), "Broken message");
- memcpy(&message, buffer, sizeof(message));
- get_remote_simulation().unignore_heap((void*)(std::uintptr_t)message.addr, message.size);
- break;
+ case MessageType::UNIGNORE_HEAP: {
+ s_mc_message_ignore_memory_t message;
+ xbt_assert(size == sizeof(message), "Broken message");
+ memcpy(&message, buffer, sizeof(message));
+ get_remote_simulation().unignore_heap((void*)(std::uintptr_t)message.addr, message.size);
+ break;
}
- case MC_MESSAGE_IGNORE_MEMORY:
- {
- s_mc_message_ignore_memory_t message;
- xbt_assert(size == sizeof(message), "Broken message");
- memcpy(&message, buffer, sizeof(message));
- this->get_remote_simulation().ignore_region(message.addr, message.size);
- break;
+ case MessageType::IGNORE_MEMORY: {
+ s_mc_message_ignore_memory_t message;
+ xbt_assert(size == sizeof(message), "Broken message");
+ memcpy(&message, buffer, sizeof(message));
+ this->get_remote_simulation().ignore_region(message.addr, message.size);
+ break;
}
- case MC_MESSAGE_STACK_REGION:
- {
- s_mc_message_stack_region_t message;
- xbt_assert(size == sizeof(message), "Broken message");
- memcpy(&message, buffer, sizeof(message));
- this->get_remote_simulation().stack_areas().push_back(message.stack_region);
- }
- break;
+ case MessageType::STACK_REGION: {
+ s_mc_message_stack_region_t message;
+ xbt_assert(size == sizeof(message), "Broken message");
+ memcpy(&message, buffer, sizeof(message));
+ this->get_remote_simulation().stack_areas().push_back(message.stack_region);
+ } break;
- case MC_MESSAGE_REGISTER_SYMBOL:
- {
- s_mc_message_register_symbol_t message;
- xbt_assert(size == sizeof(message), "Broken message");
- memcpy(&message, buffer, sizeof(message));
- xbt_assert(not message.callback, "Support for client-side function proposition is not implemented.");
- XBT_DEBUG("Received symbol: %s", message.name);
+ case MessageType::REGISTER_SYMBOL: {
+ s_mc_message_register_symbol_t message;
+ xbt_assert(size == sizeof(message), "Broken message");
+ memcpy(&message, buffer, sizeof(message));
+ xbt_assert(not message.callback, "Support for client-side function proposition is not implemented.");
+ XBT_DEBUG("Received symbol: %s", message.name);
- if (property_automaton == nullptr)
- property_automaton = xbt_automaton_new();
+ if (property_automaton == nullptr)
+ property_automaton = xbt_automaton_new();
- const RemoteSimulation* process = &this->get_remote_simulation();
- RemotePtr<int> address = remote((int*)message.data);
- xbt::add_proposition(property_automaton, message.name, [process, address]() { return process->read(address); });
+ const RemoteSimulation* process = &this->get_remote_simulation();
+ RemotePtr<int> address = remote((int*)message.data);
+ xbt::add_proposition(property_automaton, message.name, [process, address]() { return process->read(address); });
- break;
+ break;
}
- case MC_MESSAGE_WAITING:
- return false;
+ case MessageType::WAITING:
+ return false;
- case MC_MESSAGE_ASSERTION_FAILED:
- MC_report_assertion_error();
- this->exit(SIMGRID_MC_EXIT_SAFETY);
+ case MessageType::ASSERTION_FAILED:
+ MC_report_assertion_error();
+ this->exit(SIMGRID_MC_EXIT_SAFETY);
- default:
- xbt_die("Unexpected message from model-checked application");
+ default:
+ xbt_die("Unexpected message from model-checked application");
}
return true;
}
{
s_mc_message_simcall_handle_t m;
memset(&m, 0, sizeof(m));
- m.type = MC_MESSAGE_SIMCALL_HANDLE;
+ m.type = MessageType::SIMCALL_HANDLE;
m.pid = transition.pid_;
m.value = transition.argument_;
checker_side_.get_channel().send(m);
bool ModelChecker::checkDeadlock()
{
- int res = checker_side_.get_channel().send(MC_MESSAGE_DEADLOCK_CHECK);
+ int res = checker_side_.get_channel().send(MessageType::DEADLOCK_CHECK);
xbt_assert(res == 0, "Could not check deadlock state");
s_mc_message_int_t message;
ssize_t s = checker_side_.get_channel().receive(message);
xbt_assert(s != -1, "Could not receive message");
- xbt_assert(s == sizeof(message) && message.type == MC_MESSAGE_DEADLOCK_CHECK_REPLY,
+ xbt_assert(s == sizeof(message) && message.type == MessageType::DEADLOCK_CHECK_REPLY,
"Received unexpected message %s (%i, size=%i) "
- "expected MC_MESSAGE_DEADLOCK_CHECK_REPLY (%i, size=%i)",
- MC_message_type_name(message.type), (int)message.type, (int)s, (int)MC_MESSAGE_DEADLOCK_CHECK_REPLY,
+ "expected MessageType::DEADLOCK_CHECK_REPLY (%i, size=%i)",
+ MC_message_type_name(message.type), (int)message.type, (int)s, (int)MessageType::DEADLOCK_CHECK_REPLY,
(int)sizeof(message));
return message.value != 0;
}
bool Session::actor_is_enabled(aid_t pid) const
{
- s_mc_message_actor_enabled_t msg{MC_MESSAGE_ACTOR_ENABLED, pid};
+ s_mc_message_actor_enabled_t msg{simgrid::mc::MessageType::ACTOR_ENABLED, pid};
model_checker_->channel().send(msg);
std::array<char, MC_MESSAGE_LENGTH> buff;
ssize_t received = model_checker_->channel().receive(buff.data(), buff.size(), true);
/********** Static functions ***********/
-static e_mc_comm_pattern_difference_t compare_comm_pattern(const simgrid::mc::PatternCommunication* comm1,
- const simgrid::mc::PatternCommunication* comm2)
+static simgrid::mc::CommPatternDifference compare_comm_pattern(const simgrid::mc::PatternCommunication* comm1,
+ const simgrid::mc::PatternCommunication* comm2)
{
+ using simgrid::mc::CommPatternDifference;
if(comm1->type != comm2->type)
- return TYPE_DIFF;
+ return CommPatternDifference::TYPE;
if (comm1->rdv != comm2->rdv)
- return RDV_DIFF;
+ return CommPatternDifference::RDV;
if (comm1->src_proc != comm2->src_proc)
- return SRC_PROC_DIFF;
+ return CommPatternDifference::SRC_PROC;
if (comm1->dst_proc != comm2->dst_proc)
- return DST_PROC_DIFF;
+ return CommPatternDifference::DST_PROC;
if (comm1->tag != comm2->tag)
- return TAG_DIFF;
+ return CommPatternDifference::TAG;
if (comm1->data.size() != comm2->data.size())
- return DATA_SIZE_DIFF;
+ return CommPatternDifference::DATA_SIZE;
if (comm1->data != comm2->data)
- return DATA_DIFF;
- return NONE_DIFF;
+ return CommPatternDifference::DATA;
+ return CommPatternDifference::NONE;
}
-static char* print_determinism_result(e_mc_comm_pattern_difference_t diff, int process,
+static char* print_determinism_result(simgrid::mc::CommPatternDifference diff, int process,
const simgrid::mc::PatternCommunication* comm, unsigned int cursor)
{
char* type;
else
type = bprintf("The recv communications pattern of the process %d is different!", process - 1);
+ using simgrid::mc::CommPatternDifference;
switch(diff) {
- case TYPE_DIFF:
- res = bprintf("%s Different type for communication #%u", type, cursor);
- break;
- case RDV_DIFF:
- res = bprintf("%s Different rdv for communication #%u", type, cursor);
- break;
- case TAG_DIFF:
- res = bprintf("%s Different tag for communication #%u", type, cursor);
- break;
- case SRC_PROC_DIFF:
- res = bprintf("%s Different source for communication #%u", type, cursor);
- break;
- case DST_PROC_DIFF:
- res = bprintf("%s Different destination for communication #%u", type, cursor);
- break;
- case DATA_SIZE_DIFF:
- res = bprintf("%s Different data size for communication #%u", type, cursor);
- break;
- case DATA_DIFF:
- res = bprintf("%s Different data for communication #%u", type, cursor);
- break;
- default:
- res = nullptr;
- break;
+ case CommPatternDifference::TYPE:
+ res = bprintf("%s Different type for communication #%u", type, cursor);
+ break;
+ case CommPatternDifference::RDV:
+ res = bprintf("%s Different rdv for communication #%u", type, cursor);
+ break;
+ case CommPatternDifference::TAG:
+ res = bprintf("%s Different tag for communication #%u", type, cursor);
+ break;
+ case CommPatternDifference::SRC_PROC:
+ res = bprintf("%s Different source for communication #%u", type, cursor);
+ break;
+ case CommPatternDifference::DST_PROC:
+ res = bprintf("%s Different destination for communication #%u", type, cursor);
+ break;
+ case CommPatternDifference::DATA_SIZE:
+ res = bprintf("%s Different data size for communication #%u", type, cursor);
+ break;
+ case CommPatternDifference::DATA:
+ res = bprintf("%s Different data for communication #%u", type, cursor);
+ break;
+ default:
+ res = nullptr;
+ break;
}
return res;
{
if (not backtracking) {
PatternCommunicationList& list = initial_communications_pattern[process];
- e_mc_comm_pattern_difference_t diff = compare_comm_pattern(list.list[list.index_comm].get(), comm);
+ CommPatternDifference diff = compare_comm_pattern(list.list[list.index_comm].get(), comm);
- if (diff != NONE_DIFF) {
+ if (diff != CommPatternDifference::NONE) {
if (comm->type == PatternCommunicationType::send) {
this->send_deterministic = false;
if (this->send_diff != nullptr)
/********** Non Static functions ***********/
-void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, e_mc_call_type_t call_type,
- int backtracking)
+void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, CallType call_type, int backtracking)
{
const smx_actor_t issuer = mcapi::get().mc_smx_simcall_get_issuer(request);
const mc::PatternCommunicationList& initial_pattern = initial_communications_pattern[issuer->get_pid()];
auto pattern = std::make_unique<PatternCommunication>();
pattern->index = initial_pattern.index_comm + incomplete_pattern.size();
- if (call_type == MC_CALL_TYPE_SEND) {
+ if (call_type == CallType::SEND) {
/* Create comm pattern */
pattern->type = PatternCommunicationType::send;
pattern->comm_addr = mcapi::get().get_pattern_comm_addr(request);
return;
}
#endif
- } else if (call_type == MC_CALL_TYPE_RECV) {
+ } else if (call_type == CallType::RECV) {
pattern->type = PatternCommunicationType::receive;
pattern->comm_addr = static_cast<kernel::activity::CommImpl*>(simcall_comm_irecv__getraw__result(request));
std::vector<std::string> trace;
for (auto const& state : stack_) {
smx_simcall_t req = &state->executed_req_;
- if (req)
- trace.push_back(mcapi::get().request_to_string(req, state->transition_.argument_, RequestType::executed));
+ trace.push_back(request_to_string(req, state->transition_.argument_, RequestType::executed));
}
return trace;
}
smx_simcall_t req = &issuer->simcall_;
/* TODO : handle test and testany simcalls */
- e_mc_call_type_t call = MC_get_call_type(req);
- mcapi::get().handle_simcall(state->transition_);
+ CallType call = MC_get_call_type(req);
+ mc_model_checker->handle_simcall(state->transition_);
MC_handle_comm_pattern(call, req, req_num, 1);
mcapi::get().mc_wait_for_requests();
mcapi::get().mc_inc_executed_trans();
/* TODO : handle test and testany simcalls */
- e_mc_call_type_t call = MC_CALL_TYPE_NONE;
+ CallType call = CallType::NONE;
if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
call = MC_get_call_type(req);
public:
// These are used by functions which should be moved in CommunicationDeterminismChecker:
- void get_comm_pattern(smx_simcall_t request, e_mc_call_type_t call_type, int backtracking);
+ void get_comm_pattern(smx_simcall_t request, CallType call_type, int backtracking);
void complete_comm_pattern(RemotePtr<kernel::activity::CommImpl> comm_addr, unsigned int issuer, int backtracking);
private:
smx_simcall_t req = nullptr;
- if (saved_req != nullptr) {
- /* because we got a copy of the executed request, we have to fetch the
- real one, pointed by the request field of the issuer process */
- const smx_actor_t issuer = MC_smx_simcall_get_issuer(saved_req);
- req = &issuer->simcall_;
-
- /* Debug information */
- XBT_DEBUG("Replay (depth = %d) : %s (%p)", depth,
- request_to_string(req, req_num, simgrid::mc::RequestType::simix).c_str(), state.get());
- }
+ /* because we got a copy of the executed request, we have to fetch the
+ real one, pointed by the request field of the issuer process */
+ const smx_actor_t issuer = MC_smx_simcall_get_issuer(saved_req);
+ req = &issuer->simcall_;
+
+ /* Debug information */
+ XBT_DEBUG("Replay (depth = %d) : %s (%p)", depth,
+ request_to_string(req, req_num, simgrid::mc::RequestType::simix).c_str(), state.get());
this->get_session().execute(state->transition_);
}
for (std::shared_ptr<Pair> const& pair : exploration_stack_) {
int req_num = pair->graph_state->transition_.argument_;
smx_simcall_t req = &pair->graph_state->executed_req_;
- if (req && req->call_ != SIMCALL_NONE)
+ if (req->call_ != simix::Simcall::NONE)
trace.push_back(request_to_string(req, req_num, RequestType::executed));
}
return trace;
for (auto const& state : stack_) {
int value = state->transition_.argument_;
smx_simcall_t req = &state->executed_req_;
- if (req)
- trace.push_back(mcapi::get().request_to_string(req, value, RequestType::executed));
+ trace.push_back(request_to_string(req, value, RequestType::executed));
}
return trace;
}
stack_.pop_back();
if (reductionMode_ == ReductionMode::dpor) {
smx_simcall_t req = &state->internal_req_;
- if (req->call_ == SIMCALL_MUTEX_LOCK || req->call_ == SIMCALL_MUTEX_TRYLOCK)
+ if (req->call_ == simix::Simcall::MUTEX_LOCK || req->call_ == simix::Simcall::MUTEX_TRYLOCK)
xbt_die("Mutex is currently not supported with DPOR, use --cfg=model-check/reduction:none");
const kernel::actor::ActorImpl* issuer = mcapi::get().mc_smx_simcall_get_issuer(req);
simix_global->run_all_actors();
for (smx_actor_t const& process : simix_global->actors_that_ran) {
const s_smx_simcall* req = &process->simcall_;
- if (req->call_ != SIMCALL_NONE && not simgrid::mc::request_is_visible(req))
+ if (req->call_ != simix::Simcall::NONE && not simgrid::mc::request_is_visible(req))
process->simcall_handle(0);
}
}
if (req->inspector_ != nullptr)
return req->inspector_->is_enabled();
+ using simix::Simcall;
switch (req->call_) {
- case SIMCALL_NONE:
+ case Simcall::NONE:
return false;
- case SIMCALL_COMM_WAIT: {
+ case Simcall::COMM_WAIT: {
/* FIXME: check also that src and dst processes are not suspended */
const kernel::activity::CommImpl* act = simcall_comm_wait__getraw__comm(req);
return (act->src_actor_ && act->dst_actor_);
}
- case SIMCALL_COMM_WAITANY: {
+ case Simcall::COMM_WAITANY: {
simgrid::kernel::activity::CommImpl** comms = simcall_comm_waitany__get__comms(req);
size_t count = simcall_comm_waitany__get__count(req);
for (unsigned int index = 0; index < count; ++index) {
return false;
}
- case SIMCALL_MUTEX_LOCK: {
+ case Simcall::MUTEX_LOCK: {
const kernel::activity::MutexImpl* mutex = simcall_mutex_lock__get__mutex(req);
if (mutex->get_owner() == nullptr)
return mutex->get_owner()->get_pid() == req->issuer_->get_pid();
}
- case SIMCALL_SEM_ACQUIRE: {
+ case Simcall::SEM_ACQUIRE: {
static int warned = 0;
if (not warned)
XBT_INFO("Using semaphore in model-checked code is still experimental. Use at your own risk");
return true;
}
- case SIMCALL_COND_WAIT: {
+ case Simcall::COND_WAIT: {
static int warned = 0;
if (not warned)
XBT_INFO("Using condition variables in model-checked code is still experimental. Use at your own risk");
xbt_assert(mc_model_checker == nullptr, "This should be called from the client side");
#endif
- return (req->inspector_ != nullptr && req->inspector_->is_visible()) || req->call_ == SIMCALL_COMM_ISEND ||
- req->call_ == SIMCALL_COMM_IRECV || req->call_ == SIMCALL_COMM_WAIT || req->call_ == SIMCALL_COMM_WAITANY ||
- req->call_ == SIMCALL_COMM_TEST || req->call_ == SIMCALL_COMM_TESTANY || req->call_ == SIMCALL_MC_RANDOM ||
- req->call_ == SIMCALL_MUTEX_LOCK || req->call_ == SIMCALL_MUTEX_TRYLOCK || req->call_ == SIMCALL_MUTEX_UNLOCK;
+ using simix::Simcall;
+ return (req->inspector_ != nullptr && req->inspector_->is_visible()) || req->call_ == Simcall::COMM_ISEND ||
+ req->call_ == Simcall::COMM_IRECV || req->call_ == Simcall::COMM_WAIT || req->call_ == Simcall::COMM_WAITANY ||
+ req->call_ == Simcall::COMM_TEST || req->call_ == Simcall::COMM_TESTANY || req->call_ == Simcall::MC_RANDOM ||
+ req->call_ == Simcall::MUTEX_LOCK || req->call_ == Simcall::MUTEX_TRYLOCK ||
+ req->call_ == Simcall::MUTEX_UNLOCK;
}
}
state->communication_indices_.push_back(list_process_comm.index_comm);
}
-void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t req, int value, int backtracking)
+void MC_handle_comm_pattern(simgrid::mc::CallType call_type, smx_simcall_t req, int value, int backtracking)
{
// HACK, do not rely on the Checker implementation outside of it
auto* checker = static_cast<simgrid::mc::CommunicationDeterminismChecker*>(mc_model_checker->getChecker());
+ using simgrid::mc::CallType;
switch(call_type) {
- case MC_CALL_TYPE_NONE:
- break;
- case MC_CALL_TYPE_SEND:
- case MC_CALL_TYPE_RECV:
- checker->get_comm_pattern(req, call_type, backtracking);
- break;
- case MC_CALL_TYPE_WAIT:
- case MC_CALL_TYPE_WAITANY:
- {
- simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr{nullptr};
- if (call_type == MC_CALL_TYPE_WAIT)
- comm_addr = remote(simcall_comm_wait__getraw__comm(req));
+ case CallType::NONE:
+ break;
+ case CallType::SEND:
+ case CallType::RECV:
+ checker->get_comm_pattern(req, call_type, backtracking);
+ break;
+ case CallType::WAIT:
+ case CallType::WAITANY: {
+ simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr{nullptr};
+ if (call_type == CallType::WAIT)
+ comm_addr = remote(simcall_comm_wait__getraw__comm(req));
- else {
- simgrid::kernel::activity::ActivityImpl* addr;
- addr = mc_model_checker->get_remote_simulation().read(remote(simcall_comm_waitany__getraw__comms(req) + value));
- comm_addr = remote(static_cast<simgrid::kernel::activity::CommImpl*>(addr));
+ else {
+ simgrid::kernel::activity::ActivityImpl* addr;
+ addr = mc_model_checker->get_remote_simulation().read(remote(simcall_comm_waitany__getraw__comms(req) + value));
+ comm_addr = remote(static_cast<simgrid::kernel::activity::CommImpl*>(addr));
}
checker->complete_comm_pattern(comm_addr, MC_smx_simcall_get_issuer(req)->get_pid(), backtracking);
- }
- break;
+ } break;
default:
xbt_die("Unexpected call type %i", (int)call_type);
}
namespace simgrid {
namespace mc {
+enum class CallType {
+ NONE,
+ SEND,
+ RECV,
+ WAIT,
+ WAITANY,
+};
+
+enum class CommPatternDifference {
+ NONE,
+ TYPE,
+ RDV,
+ TAG,
+ SRC_PROC,
+ DST_PROC,
+ DATA_SIZE,
+ DATA,
+};
+
struct PatternCommunicationList {
unsigned int index_comm = 0;
std::vector<std::unique_ptr<simgrid::mc::PatternCommunication>> list;
};
-}
-}
+} // namespace mc
+} // namespace simgrid
extern XBT_PRIVATE std::vector<simgrid::mc::PatternCommunicationList> initial_communications_pattern;
extern XBT_PRIVATE std::vector<std::vector<simgrid::mc::PatternCommunication*>> incomplete_communications_pattern;
-enum e_mc_call_type_t {
- MC_CALL_TYPE_NONE,
- MC_CALL_TYPE_SEND,
- MC_CALL_TYPE_RECV,
- MC_CALL_TYPE_WAIT,
- MC_CALL_TYPE_WAITANY,
-};
-
-enum e_mc_comm_pattern_difference_t {
- NONE_DIFF,
- TYPE_DIFF,
- RDV_DIFF,
- TAG_DIFF,
- SRC_PROC_DIFF,
- DST_PROC_DIFF,
- DATA_SIZE_DIFF,
- DATA_DIFF,
-};
-
-static inline e_mc_call_type_t MC_get_call_type(const s_smx_simcall* req)
+static inline simgrid::mc::CallType MC_get_call_type(const s_smx_simcall* req)
{
+ using simgrid::mc::CallType;
+ using simgrid::simix::Simcall;
switch (req->call_) {
- case SIMCALL_COMM_ISEND:
- return MC_CALL_TYPE_SEND;
- case SIMCALL_COMM_IRECV:
- return MC_CALL_TYPE_RECV;
- case SIMCALL_COMM_WAIT:
- return MC_CALL_TYPE_WAIT;
- case SIMCALL_COMM_WAITANY:
- return MC_CALL_TYPE_WAITANY;
+ case Simcall::COMM_ISEND:
+ return CallType::SEND;
+ case Simcall::COMM_IRECV:
+ return CallType::RECV;
+ case Simcall::COMM_WAIT:
+ return CallType::WAIT;
+ case Simcall::COMM_WAITANY:
+ return CallType::WAITANY;
default:
- return MC_CALL_TYPE_NONE;
+ return CallType::NONE;
}
}
-XBT_PRIVATE void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, int backtracking);
+XBT_PRIVATE void MC_handle_comm_pattern(simgrid::mc::CallType call_type, smx_simcall_t request, int value,
+ int backtracking);
XBT_PRIVATE void MC_restore_communications_pattern(simgrid::mc::State* state);
if (not process)
xbt_die("Unexpected process (pid:%d).", transition.pid_);
const s_smx_simcall* simcall = &(process->simcall_);
- if (simcall == nullptr || simcall->call_ == SIMCALL_NONE)
+ if (simcall->call_ == simix::Simcall::NONE)
xbt_die("No simcall for process %d.", transition.pid_);
if (not simgrid::mc::request_is_visible(simcall) || not simgrid::mc::actor_is_enabled(process))
xbt_die("Unexpected simcall.");
#include <array>
using simgrid::mc::remote;
+using simgrid::simix::Simcall;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_request, mc, "Logging specific to MC (request)");
static inline simgrid::kernel::activity::CommImpl* MC_get_comm(smx_simcall_t r)
{
switch (r->call_) {
- case SIMCALL_COMM_WAIT:
+ case Simcall::COMM_WAIT:
return simcall_comm_wait__getraw__comm(r);
- case SIMCALL_COMM_TEST:
+ case Simcall::COMM_TEST:
return simcall_comm_test__getraw__comm(r);
default:
return nullptr;
smx_mailbox_t MC_get_mbox(smx_simcall_t r)
{
switch (r->call_) {
- case SIMCALL_COMM_ISEND:
+ case Simcall::COMM_ISEND:
return simcall_comm_isend__get__mbox(r);
- case SIMCALL_COMM_IRECV:
+ case Simcall::COMM_IRECV:
return simcall_comm_irecv__get__mbox(r);
default:
return nullptr;
static inline
bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
{
- if (r1->call_ == SIMCALL_COMM_ISEND && r2->call_ == SIMCALL_COMM_IRECV)
+ if (r1->call_ == Simcall::COMM_ISEND && r2->call_ == Simcall::COMM_IRECV)
return false;
- if (r1->call_ == SIMCALL_COMM_IRECV && r2->call_ == SIMCALL_COMM_ISEND)
+ if (r1->call_ == Simcall::COMM_IRECV && r2->call_ == Simcall::COMM_ISEND)
return false;
// Those are internal requests, we do not need indirection because those objects are copies:
const kernel::activity::CommImpl* synchro1 = MC_get_comm(r1);
const kernel::activity::CommImpl* synchro2 = MC_get_comm(r2);
- if ((r1->call_ == SIMCALL_COMM_ISEND || r1->call_ == SIMCALL_COMM_IRECV) && r2->call_ == SIMCALL_COMM_WAIT) {
+ if ((r1->call_ == Simcall::COMM_ISEND || r1->call_ == Simcall::COMM_IRECV) && r2->call_ == Simcall::COMM_WAIT) {
const kernel::activity::MailboxImpl* mbox = MC_get_mbox(r1);
if (mbox != synchro2->mbox_cpy
simcall_comm_wait__get__timeout(r2) <= 0)
return false;
- if ((r1->call_ == SIMCALL_COMM_ISEND) && (synchro2->type_ == kernel::activity::CommImpl::Type::SEND) &&
+ if ((r1->call_ == Simcall::COMM_ISEND) && (synchro2->type_ == kernel::activity::CommImpl::Type::SEND) &&
(synchro2->src_buff_ != simcall_comm_isend__get__src_buff(r1)) && simcall_comm_wait__get__timeout(r2) <= 0)
return false;
- if ((r1->call_ == SIMCALL_COMM_IRECV) && (synchro2->type_ == kernel::activity::CommImpl::Type::RECEIVE) &&
+ if ((r1->call_ == Simcall::COMM_IRECV) && (synchro2->type_ == kernel::activity::CommImpl::Type::RECEIVE) &&
(synchro2->dst_buff_ != simcall_comm_irecv__get__dst_buff(r1)) && simcall_comm_wait__get__timeout(r2) <= 0)
return false;
}
/* FIXME: the following rule assumes that the result of the isend/irecv call is not stored in a buffer used in the
* test call. */
#if 0
- if((r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
- && r2->call == SIMCALL_COMM_TEST)
+ if((r1->call == Simcall::COMM_ISEND || r1->call == Simcall::COMM_IRECV)
+ && r2->call == Simcall::COMM_TEST)
return false;
#endif
- if (r1->call_ == SIMCALL_COMM_WAIT && (r2->call_ == SIMCALL_COMM_WAIT || r2->call_ == SIMCALL_COMM_TEST) &&
+ if (r1->call_ == Simcall::COMM_WAIT && (r2->call_ == Simcall::COMM_WAIT || r2->call_ == Simcall::COMM_TEST) &&
(synchro1->src_actor_.get() == nullptr || synchro1->dst_actor_.get() == nullptr))
return false;
- if (r1->call_ == SIMCALL_COMM_TEST &&
+ if (r1->call_ == Simcall::COMM_TEST &&
(simcall_comm_test__get__comm(r1) == nullptr || synchro1->src_buff_ == nullptr || synchro1->dst_buff_ == nullptr))
return false;
- if (r1->call_ == SIMCALL_COMM_TEST && r2->call_ == SIMCALL_COMM_WAIT && synchro1->src_buff_ == synchro2->src_buff_ &&
- synchro1->dst_buff_ == synchro2->dst_buff_)
+ if (r1->call_ == Simcall::COMM_TEST && r2->call_ == Simcall::COMM_WAIT &&
+ synchro1->src_buff_ == synchro2->src_buff_ && synchro1->dst_buff_ == synchro2->dst_buff_)
return false;
- if (r1->call_ == SIMCALL_COMM_WAIT && r2->call_ == SIMCALL_COMM_TEST && synchro1->src_buff_ != nullptr &&
+ if (r1->call_ == Simcall::COMM_WAIT && r2->call_ == Simcall::COMM_TEST && synchro1->src_buff_ != nullptr &&
synchro1->dst_buff_ != nullptr && synchro2->src_buff_ != nullptr && synchro2->dst_buff_ != nullptr &&
synchro1->dst_buff_ != synchro2->src_buff_ && synchro1->dst_buff_ != synchro2->dst_buff_ &&
synchro2->dst_buff_ != synchro1->src_buff_)
return false;
/* Wait with timeout transitions are not considered by the independence theorem, thus we consider them as dependent with all other transitions */
- if ((req1->call_ == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(req1) > 0) ||
- (req2->call_ == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(req2) > 0))
+ if ((req1->call_ == Simcall::COMM_WAIT && simcall_comm_wait__get__timeout(req1) > 0) ||
+ (req2->call_ == Simcall::COMM_WAIT && simcall_comm_wait__get__timeout(req2) > 0))
return true;
if (req1->call_ != req2->call_)
const kernel::activity::CommImpl* synchro2 = MC_get_comm(req2);
switch (req1->call_) {
- case SIMCALL_COMM_ISEND:
+ case Simcall::COMM_ISEND:
return simcall_comm_isend__get__mbox(req1) == simcall_comm_isend__get__mbox(req2);
- case SIMCALL_COMM_IRECV:
+ case Simcall::COMM_IRECV:
return simcall_comm_irecv__get__mbox(req1) == simcall_comm_irecv__get__mbox(req2);
- case SIMCALL_COMM_WAIT:
+ case Simcall::COMM_WAIT:
if (synchro1->src_buff_ == synchro2->src_buff_ && synchro1->dst_buff_ == synchro2->dst_buff_)
return false;
if (synchro1->src_buff_ != nullptr && synchro1->dst_buff_ != nullptr && synchro2->src_buff_ != nullptr &&
smx_actor_t issuer = MC_smx_simcall_get_issuer(req);
switch (req->call_) {
- case SIMCALL_COMM_ISEND: {
+ case Simcall::COMM_ISEND: {
type = "iSend";
char* p = pointer_to_string(simcall_comm_isend__get__src_buff(req));
char* bs = buff_size_to_string(simcall_comm_isend__get__src_buff_size(req));
break;
}
- case SIMCALL_COMM_IRECV: {
+ case Simcall::COMM_IRECV: {
size_t* remote_size = simcall_comm_irecv__get__dst_buff_size(req);
size_t size = 0;
if (remote_size)
break;
}
- case SIMCALL_COMM_WAIT: {
+ case Simcall::COMM_WAIT: {
simgrid::kernel::activity::CommImpl* remote_act = simcall_comm_wait__getraw__comm(req);
char* p;
if (value == -1) {
break;
}
- case SIMCALL_COMM_TEST: {
+ case Simcall::COMM_TEST: {
simgrid::kernel::activity::CommImpl* remote_act = simcall_comm_test__getraw__comm(req);
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
const simgrid::kernel::activity::CommImpl* act;
break;
}
- case SIMCALL_COMM_WAITANY: {
+ case Simcall::COMM_WAITANY: {
type = "WaitAny";
size_t count = simcall_comm_waitany__get__count(req);
if (count > 0) {
break;
}
- case SIMCALL_COMM_TESTANY:
+ case Simcall::COMM_TESTANY:
if (value == -1) {
type = "TestAny FALSE";
args = xbt_strdup("-");
}
break;
- case SIMCALL_MUTEX_TRYLOCK:
- case SIMCALL_MUTEX_LOCK: {
- if (req->call_ == SIMCALL_MUTEX_LOCK)
+ case Simcall::MUTEX_TRYLOCK:
+ case Simcall::MUTEX_LOCK: {
+ if (req->call_ == Simcall::MUTEX_LOCK)
type = "Mutex LOCK";
else
type = "Mutex TRYLOCK";
simgrid::mc::Remote<simgrid::kernel::activity::MutexImpl> mutex;
mc_model_checker->get_remote_simulation().read_bytes(mutex.get_buffer(), sizeof(mutex),
- remote(req->call_ == SIMCALL_MUTEX_LOCK
+ remote(req->call_ == Simcall::MUTEX_LOCK
? simcall_mutex_lock__get__mutex(req)
: simcall_mutex_trylock__get__mutex(req)));
args = bprintf("locked = %d, owner = %d, sleeping = n/a", mutex.get_buffer()->is_locked(),
break;
}
- case SIMCALL_MC_RANDOM:
+ case Simcall::MC_RANDOM:
type = "MC_RANDOM";
args = bprintf("%d", value);
break;
{
kernel::activity::CommImpl* remote_act = nullptr;
switch (req->call_) {
- case SIMCALL_COMM_WAIT:
+ case Simcall::COMM_WAIT:
/* FIXME: check also that src and dst processes are not suspended */
remote_act = simcall_comm_wait__getraw__comm(req);
break;
- case SIMCALL_COMM_WAITANY:
+ case Simcall::COMM_WAITANY:
remote_act = mc_model_checker->get_remote_simulation().read(remote(simcall_comm_testany__get__comms(req) + idx));
break;
- case SIMCALL_COMM_TESTANY:
+ case Simcall::COMM_TESTANY:
remote_act = mc_model_checker->get_remote_simulation().read(remote(simcall_comm_testany__get__comms(req) + idx));
break;
std::string label;
switch (req->call_) {
- case SIMCALL_COMM_ISEND:
+ case Simcall::COMM_ISEND:
if (issuer->get_host())
label = xbt::string_printf("[(%ld)%s] iSend", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
else
label = bprintf("[(%ld)] iSend", issuer->get_pid());
break;
- case SIMCALL_COMM_IRECV:
+ case Simcall::COMM_IRECV:
if (issuer->get_host())
label = xbt::string_printf("[(%ld)%s] iRecv", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
else
label = xbt::string_printf("[(%ld)] iRecv", issuer->get_pid());
break;
- case SIMCALL_COMM_WAIT:
+ case Simcall::COMM_WAIT:
if (value == -1) {
if (issuer->get_host())
label = xbt::string_printf("[(%ld)%s] WaitTimeout", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
}
break;
- case SIMCALL_COMM_TEST: {
+ case Simcall::COMM_TEST: {
kernel::activity::ActivityImpl* remote_act = simcall_comm_test__getraw__comm(req);
Remote<simgrid::kernel::activity::CommImpl> temp_comm;
mc_model_checker->get_remote_simulation().read(temp_comm,
break;
}
- case SIMCALL_COMM_WAITANY: {
+ case Simcall::COMM_WAITANY: {
size_t comms_size = simcall_comm_waitany__get__count(req);
if (issuer->get_host())
label = xbt::string_printf("[(%ld)%s] WaitAny [%d of %zu]", issuer->get_pid(),
break;
}
- case SIMCALL_COMM_TESTANY:
+ case Simcall::COMM_TESTANY:
if (value == -1) {
if (issuer->get_host())
label = xbt::string_printf("[(%ld)%s] TestAny FALSE", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
}
break;
- case SIMCALL_MUTEX_TRYLOCK:
+ case Simcall::MUTEX_TRYLOCK:
label = xbt::string_printf("[(%ld)] Mutex TRYLOCK", issuer->get_pid());
break;
- case SIMCALL_MUTEX_LOCK:
+ case Simcall::MUTEX_LOCK:
label = xbt::string_printf("[(%ld)] Mutex LOCK", issuer->get_pid());
break;
- case SIMCALL_MC_RANDOM:
+ case Simcall::MC_RANDOM:
if (issuer->get_host())
label = xbt::string_printf("[(%ld)%s] MC_RANDOM (%d)", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
value);
const char* MC_smx_actor_get_name(smx_actor_t actor)
{
- const simgrid::mc::RemoteSimulation* process = &mc_model_checker->get_remote_simulation();
if (mc_model_checker == nullptr)
return actor->get_cname();
+ const simgrid::mc::RemoteSimulation* process = &mc_model_checker->get_remote_simulation();
+
simgrid::mc::ActorInformation* info = actor_info_cast(actor);
if (info->name.empty()) {
simgrid::xbt::string_data string_data = simgrid::xbt::string::to_string_data(actor->name_);
}
}
+
+/* Search an enabled transition for the given process.
+ *
+ * This can be seen as an iterator returning the next transition of the process.
+ *
+ * We only consider the processes that are both
+ * - marked "to be interleaved" in their ActorState (controlled by the checker algorithm).
+ * - which simcall can currently be executed (like a comm where the other partner is already known)
+ * Once we returned the last enabled transition of a process, it is marked done.
+ *
+ * Things can get muddled with the WAITANY and TESTANY simcalls, that are rewritten on the fly to a bunch of WAIT
+ * (resp TEST) transitions using the transition.argument field to remember what was the last returned sub-transition.
+ */
+static inline smx_simcall_t MC_state_choose_request_for_process(simgrid::mc::State* state, smx_actor_t actor)
+{
+ using simgrid::simix::Simcall;
+
+ /* reset the outgoing transition */
+ simgrid::mc::ActorState* procstate = &state->actor_states_[actor->get_pid()];
+ state->transition_.pid_ = -1;
+ state->transition_.argument_ = -1;
+ state->executed_req_.call_ = Simcall::NONE;
+
+ if (not simgrid::mc::actor_is_enabled(actor))
+ return nullptr; // Not executable in the application
+
+ smx_simcall_t req = nullptr;
+ switch (actor->simcall_.call_) {
+ case Simcall::COMM_WAITANY:
+ state->transition_.argument_ = -1;
+ while (procstate->times_considered < simcall_comm_waitany__get__count(&actor->simcall_)) {
+ if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall_, procstate->times_considered)) {
+ state->transition_.argument_ = procstate->times_considered;
+ ++procstate->times_considered;
+ break;
+ }
+ ++procstate->times_considered;
+ }
+
+ if (procstate->times_considered >= simcall_comm_waitany__get__count(&actor->simcall_))
+ procstate->set_done();
+ if (state->transition_.argument_ != -1)
+ req = &actor->simcall_;
+ break;
+
+ case Simcall::COMM_TESTANY: {
+ unsigned start_count = procstate->times_considered;
+ state->transition_.argument_ = -1;
+ while (procstate->times_considered < simcall_comm_testany__get__count(&actor->simcall_)) {
+ if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall_, procstate->times_considered)) {
+ state->transition_.argument_ = procstate->times_considered;
+ ++procstate->times_considered;
+ break;
+ }
+ ++procstate->times_considered;
+ }
+
+ if (procstate->times_considered >= simcall_comm_testany__get__count(&actor->simcall_))
+ procstate->set_done();
+
+ if (state->transition_.argument_ != -1 || start_count == 0)
+ req = &actor->simcall_;
+
+ break;
+ }
+
+ case Simcall::COMM_WAIT: {
+ simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> remote_act =
+ remote(simcall_comm_wait__getraw__comm(&actor->simcall_));
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_act;
+ mc_model_checker->get_remote_simulation().read(temp_act, remote_act);
+ const simgrid::kernel::activity::CommImpl* act = temp_act.get_buffer();
+ if (act->src_actor_.get() && act->dst_actor_.get())
+ state->transition_.argument_ = 0; // OK
+ else if (act->src_actor_.get() == nullptr && act->type_ == simgrid::kernel::activity::CommImpl::Type::READY &&
+ act->detached())
+ state->transition_.argument_ = 0; // OK
+ else
+ state->transition_.argument_ = -1; // timeout
+ procstate->set_done();
+ req = &actor->simcall_;
+ break;
+ }
+
+ case Simcall::MC_RANDOM: {
+ int min_value = simcall_mc_random__get__min(&actor->simcall_);
+ state->transition_.argument_ = procstate->times_considered + min_value;
+ procstate->times_considered++;
+ if (state->transition_.argument_ == simcall_mc_random__get__max(&actor->simcall_))
+ procstate->set_done();
+ req = &actor->simcall_;
+ break;
+ }
+
+ default:
+ procstate->set_done();
+ state->transition_.argument_ = 0;
+ req = &actor->simcall_;
+ break;
+ }
+ if (not req)
+ return nullptr;
+
+ state->transition_.pid_ = actor->get_pid();
+ state->executed_req_ = *req;
+ // Fetch the data of the request and translate it:
+ state->internal_req_ = *req;
+
+ /* The waitany and testany request are transformed into a wait or test request over the corresponding communication
+ * action so it can be treated later by the dependence function. */
+ switch (req->call_) {
+ case Simcall::COMM_WAITANY: {
+ state->internal_req_.call_ = Simcall::COMM_WAIT;
+ simgrid::kernel::activity::CommImpl* remote_comm;
+ remote_comm = mc_model_checker->get_remote_simulation().read(
+ remote(simcall_comm_waitany__get__comms(req) + state->transition_.argument_));
+ mc_model_checker->get_remote_simulation().read(state->internal_comm_, remote(remote_comm));
+ simcall_comm_wait__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
+ simcall_comm_wait__set__timeout(&state->internal_req_, 0);
+ break;
+ }
+
+ case Simcall::COMM_TESTANY:
+ state->internal_req_.call_ = Simcall::COMM_TEST;
+
+ if (state->transition_.argument_ > 0) {
+ simgrid::kernel::activity::CommImpl* remote_comm = mc_model_checker->get_remote_simulation().read(
+ remote(simcall_comm_testany__get__comms(req) + state->transition_.argument_));
+ mc_model_checker->get_remote_simulation().read(state->internal_comm_, remote(remote_comm));
+ }
+
+ simcall_comm_test__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
+ simcall_comm_test__set__result(&state->internal_req_, state->transition_.argument_);
+ break;
+
+ case Simcall::COMM_WAIT:
+ mc_model_checker->get_remote_simulation().read_bytes(&state->internal_comm_, sizeof(state->internal_comm_),
+ remote(simcall_comm_wait__getraw__comm(req)));
+ simcall_comm_wait__set__comm(&state->executed_req_, state->internal_comm_.get_buffer());
+ simcall_comm_wait__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
+ break;
+
+ case Simcall::COMM_TEST:
+ mc_model_checker->get_remote_simulation().read_bytes(&state->internal_comm_, sizeof(state->internal_comm_),
+ remote(simcall_comm_test__getraw__comm(req)));
+ simcall_comm_test__set__comm(&state->executed_req_, state->internal_comm_.get_buffer());
+ simcall_comm_test__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
+ break;
+
+ default:
+ /* No translation needed */
+ break;
+ }
+
+ return req;
+}
+
+smx_simcall_t MC_state_choose_request(simgrid::mc::State* state)
+{
+ for (auto& actor : mc_model_checker->get_remote_simulation().actors()) {
+ /* Only consider the actors that were marked as interleaving by the checker algorithm */
+ if (not state->actor_states_[actor.copy.get_buffer()->get_pid()].is_todo())
+ continue;
+
+ smx_simcall_t res = MC_state_choose_request_for_process(state, actor.copy.get_buffer());
+ if (res)
+ return res;
+ }
+ return nullptr;
+}
/* Internal translation of the executed_req simcall
*
- * SIMCALL_COMM_TESTANY is translated to a SIMCALL_COMM_TEST
- * and SIMCALL_COMM_WAITANY to a SIMCALL_COMM_WAIT.
+ * Simcall::COMM_TESTANY is translated to a Simcall::COMM_TEST
+ * and Simcall::COMM_WAITANY to a Simcall::COMM_WAIT.
*/
s_smx_simcall internal_req_;
}
// Send result:
- s_mc_message_int_t answer{MC_MESSAGE_DEADLOCK_CHECK_REPLY, deadlock};
+ s_mc_message_int_t answer{MessageType::DEADLOCK_CHECK_REPLY, deadlock};
xbt_assert(channel_.send(answer) == 0, "Could not send response");
}
void AppSide::handle_continue(const s_mc_message_t*) const
smx_actor_t process = SIMIX_process_from_PID(message->pid);
xbt_assert(process != nullptr, "Invalid pid %lu", message->pid);
process->simcall_handle(message->value);
- if (channel_.send(MC_MESSAGE_WAITING))
+ if (channel_.send(MessageType::WAITING))
xbt_die("Could not send MESSAGE_WAITING to model-checker");
}
void AppSide::handle_actor_enabled(const s_mc_message_actor_enabled_t* msg) const
{
bool res = simgrid::mc::actor_is_enabled(SIMIX_process_from_PID(msg->aid));
- s_mc_message_int_t answer{MC_MESSAGE_ACTOR_ENABLED_REPLY, res};
+ s_mc_message_int_t answer{MessageType::ACTOR_ENABLED_REPLY, res};
channel_.send(answer);
}
const s_mc_message_t* message = (s_mc_message_t*)message_buffer.data();
switch (message->type) {
- case MC_MESSAGE_DEADLOCK_CHECK:
+ case MessageType::DEADLOCK_CHECK:
assert_msg_size("DEADLOCK_CHECK", s_mc_message_t);
handle_deadlock_check(message);
break;
- case MC_MESSAGE_CONTINUE:
+ case MessageType::CONTINUE:
assert_msg_size("MESSAGE_CONTINUE", s_mc_message_t);
handle_continue(message);
return;
- case MC_MESSAGE_SIMCALL_HANDLE:
+ case MessageType::SIMCALL_HANDLE:
assert_msg_size("SIMCALL_HANDLE", s_mc_message_simcall_handle_t);
handle_simcall((s_mc_message_simcall_handle_t*)message_buffer.data());
break;
- case MC_MESSAGE_ACTOR_ENABLED:
+ case MessageType::ACTOR_ENABLED:
assert_msg_size("ACTOR_ENABLED", s_mc_message_actor_enabled_t);
handle_actor_enabled((s_mc_message_actor_enabled_t*)message_buffer.data());
break;
default:
- xbt_die("Received unexpected message %s (%i)", MC_message_type_name(message->type), message->type);
+ xbt_die("Received unexpected message %s (%i)", MC_message_type_name(message->type),
+ static_cast<int>(message->type));
break;
}
}
{
while (true) {
simgrid::mc::wait_for_requests();
- xbt_assert(channel_.send(MC_MESSAGE_WAITING) == 0, "Could not send WAITING message to model-checker");
+ xbt_assert(channel_.send(MessageType::WAITING) == 0, "Could not send WAITING message to model-checker");
this->handle_messages();
}
}
void AppSide::report_assertion_failure() const
{
- if (channel_.send(MC_MESSAGE_ASSERTION_FAILED))
+ if (channel_.send(MessageType::ASSERTION_FAILED))
xbt_die("Could not send assertion to model-checker");
this->handle_messages();
}
void AppSide::ignore_memory(void* addr, std::size_t size) const
{
s_mc_message_ignore_memory_t message;
- message.type = MC_MESSAGE_IGNORE_MEMORY;
+ message.type = MessageType::IGNORE_MEMORY;
message.addr = (std::uintptr_t)addr;
message.size = size;
if (channel_.send(message))
const s_xbt_mheap_t* heap = mmalloc_get_current_heap();
s_mc_message_ignore_heap_t message;
- message.type = MC_MESSAGE_IGNORE_HEAP;
+ message.type = MessageType::IGNORE_HEAP;
message.address = address;
message.size = size;
message.block = ((char*)address - (char*)heap->heapbase) / BLOCKSIZE + 1;
void AppSide::unignore_heap(void* address, std::size_t size) const
{
s_mc_message_ignore_memory_t message;
- message.type = MC_MESSAGE_UNIGNORE_HEAP;
+ message.type = MessageType::UNIGNORE_HEAP;
message.addr = (std::uintptr_t)address;
message.size = size;
if (channel_.send(message))
void AppSide::declare_symbol(const char* name, int* value) const
{
s_mc_message_register_symbol_t message;
- message.type = MC_MESSAGE_REGISTER_SYMBOL;
+ message.type = MessageType::REGISTER_SYMBOL;
if (strlen(name) + 1 > sizeof(message.name))
xbt_die("Symbol is too long");
strncpy(message.name, name, sizeof(message.name));
region.block = ((char*)stack - (char*)heap->heapbase) / BLOCKSIZE + 1;
s_mc_message_stack_region_t message;
- message.type = MC_MESSAGE_STACK_REGION;
+ message.type = MessageType::STACK_REGION;
message.stack_region = region;
if (channel_.send(message))
xbt_die("Could not send STACK_REGION to model-checker");
/** @brief Send a message; returns 0 on success or errno on failure */
int Channel::send(const void* message, size_t size) const
{
- XBT_DEBUG("Send %s", MC_message_type_name(*(e_mc_message_type*)message));
+ XBT_DEBUG("Send %s", MC_message_type_name(*(MessageType*)message));
while (::send(this->socket_, message, size, 0) == -1) {
if (errno != EINTR)
return errno;
{
ssize_t res = recv(this->socket_, message, size, block ? 0 : MSG_DONTWAIT);
if (res != -1)
- XBT_DEBUG("Receive %s", MC_message_type_name(*(e_mc_message_type*)message));
+ XBT_DEBUG("Receive %s", MC_message_type_name(*(MessageType*)message));
return res;
}
}
// Send
int send(const void* message, size_t size) const;
- int send(e_mc_message_type type) const
+ int send(MessageType type) const
{
s_mc_message_t message = {type};
return this->send(&message, sizeof(message));
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/mc/remote/mc_protocol.h"
+#include <array>
-const char* MC_message_type_name(e_mc_message_type type)
+const char* MC_message_type_name(simgrid::mc::MessageType type)
{
- switch (type) {
- case MC_MESSAGE_NONE:
- return "NONE";
- case MC_MESSAGE_CONTINUE:
- return "CONTINUE";
- case MC_MESSAGE_IGNORE_HEAP:
- return "IGNORE_HEAP";
- case MC_MESSAGE_UNIGNORE_HEAP:
- return "UNIGNORE_HEAP";
- case MC_MESSAGE_IGNORE_MEMORY:
- return "IGNORE_MEMORY";
- case MC_MESSAGE_STACK_REGION:
- return "STACK_REGION";
- case MC_MESSAGE_REGISTER_SYMBOL:
- return "REGISTER_SYMBOL";
- case MC_MESSAGE_DEADLOCK_CHECK:
- return "DEADLOCK_CHECK";
- case MC_MESSAGE_DEADLOCK_CHECK_REPLY:
- return "DEADLOCK_CHECK_REPLY";
- case MC_MESSAGE_WAITING:
- return "WAITING";
- case MC_MESSAGE_SIMCALL_HANDLE:
- return "SIMCALL_HANDLE";
- case MC_MESSAGE_ASSERTION_FAILED:
- return "ASSERTION_FAILED";
-
- case MC_MESSAGE_ACTOR_ENABLED:
- return "ACTOR_ENABLED";
- case MC_MESSAGE_ACTOR_ENABLED_REPLY:
- return "ACTOR_ENABLED_REPLY";
-
- default:
- return "?";
- }
+ constexpr std::array<const char*, 14> names{{"NONE", "CONTINUE", "IGNORE_HEAP", "UNIGNORE_HEAP", "IGNORE_MEMORY",
+ "STACK_REGION", "REGISTER_SYMBOL", "DEADLOCK_CHECK",
+ "DEADLOCK_CHECK_REPLY", "WAITING", "SIMCALL_HANDLE", "ASSERTION_FAILED",
+ "ACTOR_ENABLED", "ACTOR_ENABLED_REPLY"}};
+ return names[static_cast<int>(type)];
}
#ifndef SIMGRID_MC_PROTOCOL_H
#define SIMGRID_MC_PROTOCOL_H
-#include "mc/datatypes.h"
-#include "simgrid/forward.h"
-#include "stdint.h"
-
-SG_BEGIN_DECL
-
// ***** Environment variables for passing context to the model-checked process
/** Environment variable name used to pass the communication socket.
*/
#define MC_ENV_SOCKET_FD "SIMGRID_MC_SOCKET_FD"
-// ***** Messages
+#ifdef __cplusplus
-enum e_mc_message_type {
- MC_MESSAGE_NONE,
- MC_MESSAGE_CONTINUE,
- MC_MESSAGE_IGNORE_HEAP,
- MC_MESSAGE_UNIGNORE_HEAP,
- MC_MESSAGE_IGNORE_MEMORY,
- MC_MESSAGE_STACK_REGION,
- MC_MESSAGE_REGISTER_SYMBOL,
- MC_MESSAGE_DEADLOCK_CHECK,
- MC_MESSAGE_DEADLOCK_CHECK_REPLY,
- MC_MESSAGE_WAITING,
- MC_MESSAGE_SIMCALL_HANDLE,
- MC_MESSAGE_ASSERTION_FAILED,
- MC_MESSAGE_ACTOR_ENABLED,
- MC_MESSAGE_ACTOR_ENABLED_REPLY
+#include "cstdint"
+#include "mc/datatypes.h"
+#include "simgrid/forward.h" // aid_t
+
+// ***** Messages
+namespace simgrid {
+namespace mc {
+
+enum class MessageType {
+ NONE,
+ CONTINUE,
+ IGNORE_HEAP,
+ UNIGNORE_HEAP,
+ IGNORE_MEMORY,
+ STACK_REGION,
+ REGISTER_SYMBOL,
+ DEADLOCK_CHECK,
+ DEADLOCK_CHECK_REPLY,
+ WAITING,
+ SIMCALL_HANDLE,
+ ASSERTION_FAILED,
+ ACTOR_ENABLED,
+ ACTOR_ENABLED_REPLY
};
+} // namespace mc
+} // namespace simgrid
+
#define MC_MESSAGE_LENGTH 512
/** Basic structure for a MC message
/* Basic structure: all message start with a message type */
struct s_mc_message_t {
- enum e_mc_message_type type;
+ simgrid::mc::MessageType type;
};
struct s_mc_message_int_t {
- enum e_mc_message_type type;
+ simgrid::mc::MessageType type;
uint64_t value;
};
/* Client->Server */
struct s_mc_message_ignore_heap_t {
- enum e_mc_message_type type;
+ simgrid::mc::MessageType type;
int block;
int fragment;
void* address;
};
struct s_mc_message_ignore_memory_t {
- enum e_mc_message_type type;
+ simgrid::mc::MessageType type;
uint64_t addr;
size_t size;
};
struct s_mc_message_stack_region_t {
- enum e_mc_message_type type;
+ simgrid::mc::MessageType type;
s_stack_region_t stack_region;
};
struct s_mc_message_register_symbol_t {
- enum e_mc_message_type type;
+ simgrid::mc::MessageType type;
char name[128];
int (*callback)(void*);
void* data;
/* Server -> client */
struct s_mc_message_simcall_handle_t {
- enum e_mc_message_type type;
+ simgrid::mc::MessageType type;
unsigned long pid;
int value;
};
struct s_mc_message_restore_t {
- enum e_mc_message_type type;
+ simgrid::mc::MessageType type;
int index;
};
struct s_mc_message_actor_enabled_t {
- enum e_mc_message_type type;
+ simgrid::mc::MessageType type;
aid_t aid; // actor ID
};
-XBT_PRIVATE const char* MC_message_type_name(enum e_mc_message_type type);
-
-SG_END_DECL
+XBT_PRIVATE const char* MC_message_type_name(simgrid::mc::MessageType type);
+#endif // __cplusplus
#endif
/* ************************************************************************** */
/** @brief returns a printable string representing a simcall */
-const char *SIMIX_simcall_name(e_smx_simcall_t kind) {
- return simcall_names[kind];
+const char* SIMIX_simcall_name(Simcall kind)
+{
+ return simcall_names[static_cast<int>(kind)];
}
namespace simgrid {
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
+using simgrid::simix::Simcall;
+
template<class R, class... T>
-inline static R simcall(e_smx_simcall_t call, T const&... t)
+inline static R simcall(Simcall call, T const&... t)
{
smx_actor_t self = SIMIX_process_self();
simgrid::simix::marshal(&self->simcall_, call, t...);
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_execution_waitany_for(&SIMIX_process_self()->simcall_, execs, count, timeout);
- return simcall<int, simgrid::kernel::activity::ExecImpl**, size_t, double>(SIMCALL_EXECUTION_WAITANY_FOR, execs, count, timeout);
+ return simcall<int, simgrid::kernel::activity::ExecImpl**, size_t, double>(Simcall::EXECUTION_WAITANY_FOR, execs, count, timeout);
}
inline static void simcall_BODY_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_send(&SIMIX_process_self()->simcall_, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
- return simcall<void, smx_actor_t, smx_mailbox_t, double, double, unsigned char*, size_t, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_SEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
+ return simcall<void, smx_actor_t, smx_mailbox_t, double, double, unsigned char*, size_t, simix_match_func_t, simix_copy_data_func_t, void*, double>(Simcall::COMM_SEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
}
inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_BODY_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_isend(&SIMIX_process_self()->simcall_, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
- return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, double, double, unsigned char*, size_t, simix_match_func_t, simix_clean_func_t, simix_copy_data_func_t, void*, bool>(SIMCALL_COMM_ISEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
+ return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, double, double, unsigned char*, size_t, simix_match_func_t, simix_clean_func_t, simix_copy_data_func_t, void*, bool>(Simcall::COMM_ISEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
}
inline static void simcall_BODY_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_recv(&SIMIX_process_self()->simcall_, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
- return simcall<void, smx_actor_t, smx_mailbox_t, unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double, double>(SIMCALL_COMM_RECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
+ return simcall<void, smx_actor_t, smx_mailbox_t, unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double, double>(Simcall::COMM_RECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
}
inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_BODY_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_irecv(&SIMIX_process_self()->simcall_, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
- return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_IRECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
+ return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double>(Simcall::COMM_IRECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
}
inline static int simcall_BODY_comm_waitany(simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_waitany(&SIMIX_process_self()->simcall_, comms, count, timeout);
- return simcall<int, simgrid::kernel::activity::CommImpl**, size_t, double>(SIMCALL_COMM_WAITANY, comms, count, timeout);
+ return simcall<int, simgrid::kernel::activity::CommImpl**, size_t, double>(Simcall::COMM_WAITANY, comms, count, timeout);
}
inline static void simcall_BODY_comm_wait(simgrid::kernel::activity::CommImpl* comm, double timeout)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_wait(&SIMIX_process_self()->simcall_, comm, timeout);
- return simcall<void, simgrid::kernel::activity::CommImpl*, double>(SIMCALL_COMM_WAIT, comm, timeout);
+ return simcall<void, simgrid::kernel::activity::CommImpl*, double>(Simcall::COMM_WAIT, comm, timeout);
}
inline static bool simcall_BODY_comm_test(simgrid::kernel::activity::CommImpl* comm)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_test(&SIMIX_process_self()->simcall_, comm);
- return simcall<bool, simgrid::kernel::activity::CommImpl*>(SIMCALL_COMM_TEST, comm);
+ return simcall<bool, simgrid::kernel::activity::CommImpl*>(Simcall::COMM_TEST, comm);
}
inline static int simcall_BODY_comm_testany(simgrid::kernel::activity::CommImpl** comms, size_t count)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_testany(&SIMIX_process_self()->simcall_, comms, count);
- return simcall<int, simgrid::kernel::activity::CommImpl**, size_t>(SIMCALL_COMM_TESTANY, comms, count);
+ return simcall<int, simgrid::kernel::activity::CommImpl**, size_t>(Simcall::COMM_TESTANY, comms, count);
}
inline static void simcall_BODY_mutex_lock(smx_mutex_t mutex)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_mutex_lock(&SIMIX_process_self()->simcall_, mutex);
- return simcall<void, smx_mutex_t>(SIMCALL_MUTEX_LOCK, mutex);
+ return simcall<void, smx_mutex_t>(Simcall::MUTEX_LOCK, mutex);
}
inline static int simcall_BODY_mutex_trylock(smx_mutex_t mutex)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_mutex_trylock(&SIMIX_process_self()->simcall_, mutex);
- return simcall<int, smx_mutex_t>(SIMCALL_MUTEX_TRYLOCK, mutex);
+ return simcall<int, smx_mutex_t>(Simcall::MUTEX_TRYLOCK, mutex);
}
inline static void simcall_BODY_mutex_unlock(smx_mutex_t mutex)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_mutex_unlock(&SIMIX_process_self()->simcall_, mutex);
- return simcall<void, smx_mutex_t>(SIMCALL_MUTEX_UNLOCK, mutex);
+ return simcall<void, smx_mutex_t>(Simcall::MUTEX_UNLOCK, mutex);
}
inline static void simcall_BODY_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_cond_wait(&SIMIX_process_self()->simcall_, cond, mutex);
- return simcall<void, smx_cond_t, smx_mutex_t>(SIMCALL_COND_WAIT, cond, mutex);
+ return simcall<void, smx_cond_t, smx_mutex_t>(Simcall::COND_WAIT, cond, mutex);
}
inline static int simcall_BODY_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_cond_wait_timeout(&SIMIX_process_self()->simcall_, cond, mutex, timeout);
- return simcall<int, smx_cond_t, smx_mutex_t, double>(SIMCALL_COND_WAIT_TIMEOUT, cond, mutex, timeout);
+ return simcall<int, smx_cond_t, smx_mutex_t, double>(Simcall::COND_WAIT_TIMEOUT, cond, mutex, timeout);
}
inline static void simcall_BODY_sem_acquire(smx_sem_t sem)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_sem_acquire(&SIMIX_process_self()->simcall_, sem);
- return simcall<void, smx_sem_t>(SIMCALL_SEM_ACQUIRE, sem);
+ return simcall<void, smx_sem_t>(Simcall::SEM_ACQUIRE, sem);
}
inline static int simcall_BODY_sem_acquire_timeout(smx_sem_t sem, double timeout)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_sem_acquire_timeout(&SIMIX_process_self()->simcall_, sem, timeout);
- return simcall<int, smx_sem_t, double>(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem, timeout);
+ return simcall<int, smx_sem_t, double>(Simcall::SEM_ACQUIRE_TIMEOUT, sem, timeout);
}
inline static int simcall_BODY_mc_random(int min, int max)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_mc_random(&SIMIX_process_self()->simcall_, min, max);
- return simcall<int, int, int>(SIMCALL_MC_RANDOM, min, max);
+ return simcall<int, int, int>(Simcall::MC_RANDOM, min, max);
}
inline static void simcall_BODY_run_kernel(std::function<void()> const* code)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
SIMIX_run_kernel(code);
- return simcall<void, std::function<void()> const*>(SIMCALL_RUN_KERNEL, code);
+ return simcall<void, std::function<void()> const*>(Simcall::RUN_KERNEL, code);
}
inline static void simcall_BODY_run_blocking(std::function<void()> const* code)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
SIMIX_run_blocking(code);
- return simcall<void, std::function<void()> const*>(SIMCALL_RUN_BLOCKING, code);
+ return simcall<void, std::function<void()> const*>(Simcall::RUN_BLOCKING, code);
}
/** @endcond */
* That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
*/
+namespace simgrid {
+namespace simix {
/**
* @brief All possible simcalls.
*/
-enum e_smx_simcall_t {
- SIMCALL_NONE,
- SIMCALL_EXECUTION_WAITANY_FOR,
- SIMCALL_COMM_SEND,
- SIMCALL_COMM_ISEND,
- SIMCALL_COMM_RECV,
- SIMCALL_COMM_IRECV,
- SIMCALL_COMM_WAITANY,
- SIMCALL_COMM_WAIT,
- SIMCALL_COMM_TEST,
- SIMCALL_COMM_TESTANY,
- SIMCALL_MUTEX_LOCK,
- SIMCALL_MUTEX_TRYLOCK,
- SIMCALL_MUTEX_UNLOCK,
- SIMCALL_COND_WAIT,
- SIMCALL_COND_WAIT_TIMEOUT,
- SIMCALL_SEM_ACQUIRE,
- SIMCALL_SEM_ACQUIRE_TIMEOUT,
- SIMCALL_MC_RANDOM,
- SIMCALL_RUN_KERNEL,
- SIMCALL_RUN_BLOCKING,
+enum class Simcall {
+ NONE,
+ EXECUTION_WAITANY_FOR,
+ COMM_SEND,
+ COMM_ISEND,
+ COMM_RECV,
+ COMM_IRECV,
+ COMM_WAITANY,
+ COMM_WAIT,
+ COMM_TEST,
+ COMM_TESTANY,
+ MUTEX_LOCK,
+ MUTEX_TRYLOCK,
+ MUTEX_UNLOCK,
+ COND_WAIT,
+ COND_WAIT_TIMEOUT,
+ SEM_ACQUIRE,
+ SEM_ACQUIRE_TIMEOUT,
+ MC_RANDOM,
+ RUN_KERNEL,
+ RUN_BLOCKING,
};
constexpr int NUM_SIMCALLS = 20;
+} // namespace simix
+} // namespace simgrid
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
+using simgrid::simix::Simcall;
/** @brief Simcalls' names (generated from src/simix/simcalls.in) */
-constexpr std::array<const char*, NUM_SIMCALLS> simcall_names{{
- "SIMCALL_NONE",
- "SIMCALL_EXECUTION_WAITANY_FOR",
- "SIMCALL_COMM_SEND",
- "SIMCALL_COMM_ISEND",
- "SIMCALL_COMM_RECV",
- "SIMCALL_COMM_IRECV",
- "SIMCALL_COMM_WAITANY",
- "SIMCALL_COMM_WAIT",
- "SIMCALL_COMM_TEST",
- "SIMCALL_COMM_TESTANY",
- "SIMCALL_MUTEX_LOCK",
- "SIMCALL_MUTEX_TRYLOCK",
- "SIMCALL_MUTEX_UNLOCK",
- "SIMCALL_COND_WAIT",
- "SIMCALL_COND_WAIT_TIMEOUT",
- "SIMCALL_SEM_ACQUIRE",
- "SIMCALL_SEM_ACQUIRE_TIMEOUT",
- "SIMCALL_MC_RANDOM",
- "SIMCALL_RUN_KERNEL",
- "SIMCALL_RUN_BLOCKING",
+constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{
+ "Simcall::NONE",
+ "Simcall::EXECUTION_WAITANY_FOR",
+ "Simcall::COMM_SEND",
+ "Simcall::COMM_ISEND",
+ "Simcall::COMM_RECV",
+ "Simcall::COMM_IRECV",
+ "Simcall::COMM_WAITANY",
+ "Simcall::COMM_WAIT",
+ "Simcall::COMM_TEST",
+ "Simcall::COMM_TESTANY",
+ "Simcall::MUTEX_LOCK",
+ "Simcall::MUTEX_TRYLOCK",
+ "Simcall::MUTEX_UNLOCK",
+ "Simcall::COND_WAIT",
+ "Simcall::COND_WAIT_TIMEOUT",
+ "Simcall::SEM_ACQUIRE",
+ "Simcall::SEM_ACQUIRE_TIMEOUT",
+ "Simcall::MC_RANDOM",
+ "Simcall::RUN_KERNEL",
+ "Simcall::RUN_BLOCKING",
}};
/** @private
if (context_->wannadie())
return;
switch (simcall_.call_) {
- case SIMCALL_EXECUTION_WAITANY_FOR:
+ case Simcall::EXECUTION_WAITANY_FOR:
simcall_HANDLER_execution_waitany_for(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl**>(simcall_.args_[0]), simgrid::simix::unmarshal<size_t>(simcall_.args_[1]), simgrid::simix::unmarshal<double>(simcall_.args_[2]));
break;
- case SIMCALL_COMM_SEND:
+ case Simcall::COMM_SEND:
simcall_HANDLER_comm_send(&simcall_, simgrid::simix::unmarshal<smx_actor_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall_.args_[1]), simgrid::simix::unmarshal<double>(simcall_.args_[2]), simgrid::simix::unmarshal<double>(simcall_.args_[3]), simgrid::simix::unmarshal<unsigned char*>(simcall_.args_[4]), simgrid::simix::unmarshal<size_t>(simcall_.args_[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall_.args_[6]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall_.args_[7]), simgrid::simix::unmarshal<void*>(simcall_.args_[8]), simgrid::simix::unmarshal<double>(simcall_.args_[9]));
break;
- case SIMCALL_COMM_ISEND:
+ case Simcall::COMM_ISEND:
simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall_.result_, simcall_HANDLER_comm_isend(&simcall_, simgrid::simix::unmarshal<smx_actor_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall_.args_[1]), simgrid::simix::unmarshal<double>(simcall_.args_[2]), simgrid::simix::unmarshal<double>(simcall_.args_[3]), simgrid::simix::unmarshal<unsigned char*>(simcall_.args_[4]), simgrid::simix::unmarshal<size_t>(simcall_.args_[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall_.args_[6]), simgrid::simix::unmarshal<simix_clean_func_t>(simcall_.args_[7]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall_.args_[8]), simgrid::simix::unmarshal<void*>(simcall_.args_[9]), simgrid::simix::unmarshal<bool>(simcall_.args_[10])));
simcall_answer();
break;
- case SIMCALL_COMM_RECV:
+ case Simcall::COMM_RECV:
simcall_HANDLER_comm_recv(&simcall_, simgrid::simix::unmarshal<smx_actor_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall_.args_[1]), simgrid::simix::unmarshal<unsigned char*>(simcall_.args_[2]), simgrid::simix::unmarshal<size_t*>(simcall_.args_[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall_.args_[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall_.args_[5]), simgrid::simix::unmarshal<void*>(simcall_.args_[6]), simgrid::simix::unmarshal<double>(simcall_.args_[7]), simgrid::simix::unmarshal<double>(simcall_.args_[8]));
break;
- case SIMCALL_COMM_IRECV:
+ case Simcall::COMM_IRECV:
simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall_.result_, simcall_HANDLER_comm_irecv(&simcall_, simgrid::simix::unmarshal<smx_actor_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall_.args_[1]), simgrid::simix::unmarshal<unsigned char*>(simcall_.args_[2]), simgrid::simix::unmarshal<size_t*>(simcall_.args_[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall_.args_[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall_.args_[5]), simgrid::simix::unmarshal<void*>(simcall_.args_[6]), simgrid::simix::unmarshal<double>(simcall_.args_[7])));
simcall_answer();
break;
- case SIMCALL_COMM_WAITANY:
+ case Simcall::COMM_WAITANY:
simcall_HANDLER_comm_waitany(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall_.args_[0]), simgrid::simix::unmarshal<size_t>(simcall_.args_[1]), simgrid::simix::unmarshal<double>(simcall_.args_[2]));
break;
- case SIMCALL_COMM_WAIT:
+ case Simcall::COMM_WAIT:
simcall_HANDLER_comm_wait(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0]), simgrid::simix::unmarshal<double>(simcall_.args_[1]));
break;
- case SIMCALL_COMM_TEST:
+ case Simcall::COMM_TEST:
simcall_HANDLER_comm_test(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0]));
break;
- case SIMCALL_COMM_TESTANY:
+ case Simcall::COMM_TESTANY:
simcall_HANDLER_comm_testany(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall_.args_[0]), simgrid::simix::unmarshal<size_t>(simcall_.args_[1]));
break;
- case SIMCALL_MUTEX_LOCK:
+ case Simcall::MUTEX_LOCK:
simcall_HANDLER_mutex_lock(&simcall_, simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[0]));
break;
- case SIMCALL_MUTEX_TRYLOCK:
+ case Simcall::MUTEX_TRYLOCK:
simgrid::simix::marshal<int>(simcall_.result_, simcall_HANDLER_mutex_trylock(&simcall_, simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[0])));
simcall_answer();
break;
- case SIMCALL_MUTEX_UNLOCK:
+ case Simcall::MUTEX_UNLOCK:
simcall_HANDLER_mutex_unlock(&simcall_, simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[0]));
simcall_answer();
break;
- case SIMCALL_COND_WAIT:
+ case Simcall::COND_WAIT:
simcall_HANDLER_cond_wait(&simcall_, simgrid::simix::unmarshal<smx_cond_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[1]));
break;
- case SIMCALL_COND_WAIT_TIMEOUT:
+ case Simcall::COND_WAIT_TIMEOUT:
simcall_HANDLER_cond_wait_timeout(&simcall_, simgrid::simix::unmarshal<smx_cond_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[1]), simgrid::simix::unmarshal<double>(simcall_.args_[2]));
break;
- case SIMCALL_SEM_ACQUIRE:
+ case Simcall::SEM_ACQUIRE:
simcall_HANDLER_sem_acquire(&simcall_, simgrid::simix::unmarshal<smx_sem_t>(simcall_.args_[0]));
break;
- case SIMCALL_SEM_ACQUIRE_TIMEOUT:
+ case Simcall::SEM_ACQUIRE_TIMEOUT:
simcall_HANDLER_sem_acquire_timeout(&simcall_, simgrid::simix::unmarshal<smx_sem_t>(simcall_.args_[0]), simgrid::simix::unmarshal<double>(simcall_.args_[1]));
break;
- case SIMCALL_MC_RANDOM:
+ case Simcall::MC_RANDOM:
simgrid::simix::marshal<int>(simcall_.result_, simcall_HANDLER_mc_random(&simcall_, simgrid::simix::unmarshal<int>(simcall_.args_[0]), simgrid::simix::unmarshal<int>(simcall_.args_[1])));
simcall_answer();
break;
- case SIMCALL_RUN_KERNEL:
+ case Simcall::RUN_KERNEL:
SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall_.args_[0]));
simcall_answer();
break;
- case SIMCALL_RUN_BLOCKING:
+ case Simcall::RUN_BLOCKING:
SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall_.args_[0]));
break;
- case SIMCALL_NONE:
+ case Simcall::NONE:
throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
get_cname(),
sg_host_get_name(get_host())));
#include <boost/intrusive_ptr.hpp>
/********************************* Simcalls *********************************/
-#include "popping_enum.hpp" /* Definition of e_smx_simcall_t, with one value per simcall */
+#include "popping_enum.hpp" /* Definition of Simcall, with one value per simcall */
-XBT_PUBLIC_DATA const std::array<const char*, NUM_SIMCALLS> simcall_names; /* Name of each simcall */
+XBT_PUBLIC_DATA const std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names; /* Name of each simcall */
using simix_match_func_t = bool (*)(void*, void*, simgrid::kernel::activity::CommImpl*);
using simix_copy_data_func_t = void (*)(simgrid::kernel::activity::CommImpl*, void*, size_t);
* @brief Represents a simcall to the kernel.
*/
struct s_smx_simcall {
- e_smx_simcall_t call_ = SIMCALL_NONE;
+ simgrid::simix::Simcall call_ = simgrid::simix::Simcall::NONE;
smx_actor_t issuer_ = nullptr;
smx_timer_t timeout_cb_ = nullptr; // Callback to timeouts
simgrid::mc::SimcallInspector* inspector_ = nullptr; // makes that simcall observable by the MC
/******************************** General *************************************/
-XBT_PRIVATE const char* SIMIX_simcall_name(e_smx_simcall_t kind);
+XBT_PRIVATE const char* SIMIX_simcall_name(simgrid::simix::Simcall kind);
XBT_PRIVATE void SIMIX_run_kernel(std::function<void()> const* code);
XBT_PRIVATE void SIMIX_run_blocking(std::function<void()> const* code);
}
/** Initialize the simcall */
-template <class... A> inline void marshal(smx_simcall_t simcall, e_smx_simcall_t call, A const&... a)
+template <class... A> inline void marshal(smx_simcall_t simcall, Simcall call, A const&... a)
{
simcall->call_ = call;
memset(&simcall->result_, 0, sizeof simcall->result_);
return True
def enum(self):
- return ' SIMCALL_%s,' % (self.name.upper())
+ return ' %s,' % (self.name.upper())
def string(self):
- return ' "SIMCALL_%s",' % self.name.upper()
+ return ' "Simcall::%s",' % self.name.upper()
def accessors(self):
res = []
indent = ' '
args = ["simgrid::simix::unmarshal<%s>(simcall_.args_[%d])" % (arg.rettype(), i)
for i, arg in enumerate(self.args)]
- res.append(indent + 'case SIMCALL_%s:' % (self.name.upper()))
+ res.append(indent + 'case Simcall::%s:' % (self.name.upper()))
if self.need_handler:
call = "simcall_HANDLER_%s(&simcall_%s%s)" % (self.name,
", " if args else "",
else:
res.append(' SIMIX_%s(%s);' % (self.name,
', '.join(arg.name for arg in self.args)))
- res.append(' return simcall<%s%s>(SIMCALL_%s%s);' % (
+ res.append(' return simcall<%s%s>(Simcall::%s%s);' % (
self.res.rettype(),
"".join([", " + arg.rettype() for i, arg in enumerate(self.args)]),
self.name.upper(),
# popping_enum.hpp
#
fd = header("popping_enum.hpp")
+ fd.write('namespace simgrid {\n');
+ fd.write('namespace simix {\n');
fd.write('/**\n')
fd.write(' * @brief All possible simcalls.\n')
fd.write(' */\n')
- fd.write('enum e_smx_simcall_t {\n')
- fd.write(' SIMCALL_NONE,\n')
+ fd.write('enum class Simcall {\n')
+ fd.write(' NONE,\n')
handle(fd, Simcall.enum, simcalls, simcalls_dict)
fd.write('};\n')
fd.write('\n')
fd.write('constexpr int NUM_SIMCALLS = ' + str(1 + len(simcalls)) + ';\n');
+ fd.write('} // namespace simix\n');
+ fd.write('} // namespace simgrid\n');
fd.close()
#
fd.write('\n')
fd.write('XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);\n\n')
+ fd.write('using simgrid::simix::Simcall;')
+ fd.write('\n')
fd.write(
'/** @brief Simcalls\' names (generated from src/simix/simcalls.in) */\n')
- fd.write('constexpr std::array<const char*, NUM_SIMCALLS> simcall_names{{\n')
+ fd.write('constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{\n')
- fd.write(' "SIMCALL_NONE",\n')
+ fd.write(' "Simcall::NONE",\n')
handle(fd, Simcall.string, simcalls, simcalls_dict)
fd.write('}};\n\n')
handle(fd, Simcall.case, simcalls, simcalls_dict)
- fd.write(' case SIMCALL_NONE:\n')
+ fd.write(' case Simcall::NONE:\n')
fd.write(' throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",\n')
fd.write(' get_cname(),\n')
fd.write(' sg_host_get_name(get_host())));\n')
fd.write('''
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
+using simgrid::simix::Simcall;
+
template<class R, class... T>
-inline static R simcall(e_smx_simcall_t call, T const&... t)
+inline static R simcall(Simcall call, T const&... t)
{
smx_actor_t self = SIMIX_process_self();
simgrid::simix::marshal(&self->simcall_, call, t...);
*/
for (auto const& actor : simix_global->actors_that_ran) {
- if (actor->simcall_.call_ != SIMCALL_NONE) {
+ if (actor->simcall_.call_ != simgrid::simix::Simcall::NONE) {
actor->simcall_handle(0);
}
}
XBT_CDEBUG(smpi_pmpi, "my offsets to read : %lld:%lld, global min and max %lld:%lld", min_offset, max_offset, min,
max);
if (empty == 1) {
- status->count = 0;
+ if (status != MPI_STATUS_IGNORE)
+ status->count = 0;
return MPI_SUCCESS;
}
MPI_Offset total = max - min;
#ifndef WIN32
#include <sys/mman.h>
#endif
+#include <cerrno>
#include <cmath>
#if HAVE_PAPI
#if _POSIX_TIMERS > 0
int smpi_clock_gettime(clockid_t clk_id, struct timespec* tp)
{
+ if (not tp) {
+ errno = EFAULT;
+ return -1;
+ }
if (not smpi_process())
return clock_gettime(clk_id, tp);
//there is only one time in SMPI, so clk_id is ignored.
smpi_bench_end();
double now = SIMIX_get_clock();
- if (tp) {
- tp->tv_sec = static_cast<time_t>(now);
- tp->tv_nsec = static_cast<long int>((now - tp->tv_sec) * 1e9);
- }
+ tp->tv_sec = static_cast<time_t>(now);
+ tp->tv_nsec = static_cast<long int>((now - tp->tv_sec) * 1e9);
if (smpi_wtime_sleep > 0)
simgrid::s4u::this_actor::sleep_for(smpi_wtime_sleep);
smpi_bench_begin();
show_string(ev->functionName);
break;
case 'd': /* date; LOG4J compliant */
- show_double(simgrid_get_clock());
- break;
case 'r': /* application age; LOG4J compliant */
show_double(simgrid_get_clock());
break;
for node in "${nodes[@]}"
do
- wget --quiet ${BUILD_URL}/build_mode=Debug,node=${node}/consoleText >/dev/null 2>&1
+ wget --quiet --output-document=consoleText \
+ ${BUILD_URL}/build_mode=Debug,node=${node}/consoleText \
+ ${BUILD_URL}/build_mode=ModelChecker,node=${node}/consoleText \
+ >/dev/null 2>&1
if [ ! -f consoleText ]; then
echo "file not existing for node ${node}"
exit 1