- simgrid::kernel::activity::ActivityImpl* remote_act = nullptr;
- switch (req->call) {
-
- 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: {
- read_element(mc_model_checker->process(), &remote_act, remote(simcall_comm_waitany__getraw__comms(req)), idx,
- sizeof(remote_act));
- }
- break;
-
- case SIMCALL_COMM_TESTANY:
- remote_act = mc_model_checker->process().read(remote(simcall_comm_testany__getraw__comms(req) + idx));
- break;
-
- default:
- return true;
- }
-
- simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
- mc_model_checker->process().read(temp_comm, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
- simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
- return comm->src_proc && comm->dst_proc;
-}
-
-
-static const char* colors[] = {
- "blue",
- "red",
- "green3",
- "goldenrod",
- "brown",
- "purple",
- "magenta",
- "turquoise4",
- "gray25",
- "forestgreen",
- "hotpink",
- "lightblue",
- "tan",
-};
-
-static inline const char* get_color(int id)
-{
- return colors[id % (sizeof(colors) / sizeof(colors[0])) ];
-}
-
-std::string request_get_dot_output(smx_simcall_t req, int value)
-{
- std::string label;
-
- const smx_actor_t issuer = MC_smx_simcall_get_issuer(req);
-
- switch (req->call) {
- case SIMCALL_COMM_ISEND:
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] iSend", issuer->pid, MC_smx_actor_get_host_name(issuer));
- else
- label = bprintf("[(%lu)] iSend", issuer->pid);
- break;
-
- case SIMCALL_COMM_IRECV:
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] iRecv", issuer->pid, MC_smx_actor_get_host_name(issuer));
- else
- label = simgrid::xbt::string_printf("[(%lu)] iRecv", issuer->pid);
- break;
-
- case SIMCALL_COMM_WAIT: {
- if (value == -1) {
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] WaitTimeout", issuer->pid, MC_smx_actor_get_host_name(issuer));
- else
- label = simgrid::xbt::string_printf("[(%lu)] WaitTimeout", issuer->pid);
- } else {
- simgrid::kernel::activity::ActivityImpl* remote_act = simcall_comm_wait__getraw__comm(req);
- simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
- mc_model_checker->process().read(temp_comm,
- remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
- simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
-
- smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_proc));
- smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc));
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] Wait [(%lu)->(%lu)]", issuer->pid,
- MC_smx_actor_get_host_name(issuer), src_proc ? src_proc->pid : 0,
- dst_proc ? dst_proc->pid : 0);
- else
- label = simgrid::xbt::string_printf("[(%lu)] Wait [(%lu)->(%lu)]",
- issuer->pid,
- src_proc ? src_proc->pid : 0,
- dst_proc ? dst_proc->pid : 0);
- }
- break;
- }
-
- case SIMCALL_COMM_TEST: {
- simgrid::kernel::activity::ActivityImpl* remote_act = simcall_comm_test__getraw__comm(req);
- simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
- mc_model_checker->process().read(temp_comm, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
- simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
- if (comm->src_proc == nullptr || comm->dst_proc == nullptr) {
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] Test FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
- else
- label = bprintf("[(%lu)] Test FALSE", issuer->pid);
- } else {
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] Test TRUE", issuer->pid, MC_smx_actor_get_host_name(issuer));
- else
- label = simgrid::xbt::string_printf("[(%lu)] Test TRUE", issuer->pid);
- }
- break;
- }
-
- case SIMCALL_COMM_WAITANY: {
- unsigned long comms_size = read_length(
- mc_model_checker->process(), remote(simcall_comm_waitany__get__comms(req)));
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] WaitAny [%d of %lu]", issuer->pid,
- MC_smx_actor_get_host_name(issuer), value + 1, comms_size);
- else
- label = simgrid::xbt::string_printf("[(%lu)] WaitAny [%d of %lu]",
- issuer->pid, value + 1, comms_size);
- break;
- }
-
- case SIMCALL_COMM_TESTANY:
- if (value == -1) {
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] TestAny FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
- else
- label = simgrid::xbt::string_printf("[(%lu)] TestAny FALSE", issuer->pid);
- } else {
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] TestAny TRUE [%d of %lu]", issuer->pid,
- MC_smx_actor_get_host_name(issuer), value + 1,
- simcall_comm_testany__get__count(req));
- else
- label = simgrid::xbt::string_printf("[(%lu)] TestAny TRUE [%d of %lu]",
- issuer->pid,
- value + 1,
- simcall_comm_testany__get__count(req));
- }
- break;
-
- case SIMCALL_MUTEX_TRYLOCK:
- label = simgrid::xbt::string_printf("[(%lu)] Mutex TRYLOCK", issuer->pid);
- break;
-
- case SIMCALL_MUTEX_LOCK:
- label = simgrid::xbt::string_printf("[(%lu)] Mutex LOCK", issuer->pid);
- break;
-
- case SIMCALL_MC_RANDOM:
- if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] MC_RANDOM (%d)", issuer->pid, MC_smx_actor_get_host_name(issuer),
- value);
- else
- label = simgrid::xbt::string_printf("[(%lu)] MC_RANDOM (%d)", issuer->pid, value);
- break;
-
- default:
- THROW_UNIMPLEMENTED;