friend mc::CommunicationDeterminismChecker;
static unsigned next_id_; // Next ID to be given
- unsigned id_;
- explicit MailboxImpl(const std::string& name) : piface_(this), name_(name), id_(next_id_++) {}
+ const unsigned id_ = next_id_++;
+ explicit MailboxImpl(const std::string& name) : piface_(this), name_(name) {}
public:
/** @brief Public interface */
- unsigned get_id() { return id_; }
+ unsigned get_id() const { return id_; }
const s4u::Mailbox* get_iface() const { return &piface_; }
s4u::Mailbox* get_iface() { return &piface_; }
namespace simgrid {
namespace mc {
-static inline const char* get_color(int id)
-{
- static constexpr std::array<const char*, 13> colors{{"blue", "red", "green3", "goldenrod", "brown", "purple",
- "magenta", "turquoise4", "gray25", "forestgreen", "hotpink",
- "lightblue", "tan"}};
- return colors[id % colors.size()];
-}
-
-static std::string pointer_to_string(void* pointer)
-{
- return XBT_LOG_ISENABLED(Api, xbt_log_priority_verbose) ? xbt::string_printf("%p", pointer) : "(verbose only)";
-}
-
-static std::string buff_size_to_string(size_t buff_size)
-{
- return XBT_LOG_ISENABLED(Api, xbt_log_priority_verbose) ? std::to_string(buff_size) : "(verbose only)";
-}
-
/** Statically "upcast" a s_smx_actor_t into an ActorInformation
*
* This gets 'actorInfo' from '&actorInfo->copy'. It upcasts in the
std::string Api::request_get_dot_output(const Transition* t) const
{
- const char* color = get_color(t->aid_ - 1);
+ static constexpr std::array<const char*, 13> colors{{"blue", "red", "green3", "goldenrod", "brown", "purple",
+ "magenta", "turquoise4", "gray25", "forestgreen", "hotpink",
+ "lightblue", "tan"}};
+ const char* color = colors[(t->aid_ - 1) % colors.size()];
+
return "label = \"" + t->dot_label() + "\", color = " + color + ", fontcolor = " + color;
}
return res;
}
TestAnyTransition::TestAnyTransition(aid_t issuer, int times_considered, std::stringstream& stream)
+ : Transition(Type::TESTANY, issuer, times_considered)
{
int size;
stream >> size;
xbt_assert(type >= 0 && type <= static_cast<short>(Transition::Type::UNKNOWN), "Invalid transition type %d received",
type);
- Transition::Type simcall = static_cast<Transition::Type>(type);
+ auto simcall = static_cast<Transition::Type>(type);
switch (simcall) {
case Transition::Type::COMM_RECV:
/* TODO : handle test and testany simcalls */
CallType call = MC_get_call_type(req);
state->get_transition()->replay();
- handle_comm_pattern(call, req, req_num, 1);
+ handle_comm_pattern(call, req, req_num, true);
/* Update statistics */
api::get().mc_inc_visited_states();
if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
call = MC_get_call_type(req);
- handle_comm_pattern(call, req, req_num, 0);
+ handle_comm_pattern(call, req, req_num, false);
/* Create the new expanded state */
auto next_state = std::make_unique<State>();
engine->reset_actor_dynar();
for (auto const& kv : engine->get_actor_list()) {
auto actor = kv.second;
- if (auto* observer = actor->simcall_.observer_)
+ if (const auto* observer = actor->simcall_.observer_)
actor->simcall_.mc_max_consider_ = observer->get_max_consider();
engine->add_actor_to_dynar(actor);
}