}
namespace mc {
class CommunicationDeterminismChecker;
-class SimcallInspector;
+class SimcallObserver;
}
namespace vm {
class VMModel;
#include <string>
#include <unordered_map>
-XBT_PUBLIC void simcall_run_kernel(std::function<void()> const& code, simgrid::mc::SimcallInspector* t);
-XBT_PUBLIC void simcall_run_blocking(std::function<void()> const& code, simgrid::mc::SimcallInspector* t);
+XBT_PUBLIC void simcall_run_kernel(std::function<void()> const& code, simgrid::mc::SimcallObserver* t);
+XBT_PUBLIC void simcall_run_blocking(std::function<void()> const& code, simgrid::mc::SimcallObserver* t);
namespace simgrid {
namespace kernel {
* you may need to wait for that mutex to be unlocked by its current owner.
* Potentially blocking simcall must be issued using simcall_blocking(), right below in this file.
*/
-template <class F> typename std::result_of_t<F()> simcall(F&& code, mc::SimcallInspector* t = nullptr)
+template <class F> typename std::result_of_t<F()> simcall(F&& code, mc::SimcallObserver* t = nullptr)
{
// If we are in the maestro, we take the fast path and execute the
// code directly without simcall marshalling/unmarshalling/dispatch:
*
* If your code never calls actor->simcall_answer() itself, the actor will never return from its simcall.
*/
-template <class R, class F> R simcall_blocking(F&& code, mc::SimcallInspector* t = nullptr)
+template <class R, class F> R simcall_blocking(F&& code, mc::SimcallObserver* t = nullptr)
{
// If we are in the maestro, we take the fast path and execute the
// code directly without simcall marshalling/unmarshalling/dispatch:
#include "src/kernel/activity/MailboxImpl.hpp"
#include "src/kernel/activity/MutexImpl.hpp"
#include "src/mc/Session.hpp"
-#include "src/mc/checker/SimcallInspector.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include "src/mc/mc_comm_pattern.hpp"
#include "src/mc/mc_exit.hpp"
#include "src/mc/mc_pattern.hpp"
return nullptr; // Not executable in the application
smx_simcall_t req = nullptr;
- if (actor->simcall_.inspector_ != nullptr) {
+ if (actor->simcall_.observer_ != nullptr) {
state->transition_.times_considered_ = procstate->times_considered;
procstate->times_considered++;
if (actor->simcall_.mc_max_consider_ <= procstate->times_considered)
smx_actor_t issuer = simcall_get_issuer(req);
- if (issuer->simcall_.inspector_ != nullptr)
+ if (issuer->simcall_.observer_ != nullptr)
return mc_model_checker->simcall_to_string(issuer->get_pid(), value);
switch (req->call_) {
std::string label;
- if (req->inspector_ != nullptr) {
+ if (req->observer_ != nullptr) {
label = mc_model_checker->simcall_dot_label(issuer->get_pid(), value);
} else
switch (req->call_) {
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "src/mc/checker/SimcallInspector.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include "simgrid/s4u/Host.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_inspector, mc, "Logging specific to MC simcall inspection");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_observer, mc, "Logging specific to MC simcall observation");
namespace simgrid {
namespace mc {
-std::string SimcallInspector::to_string(int /*time_considered*/) const
+std::string SimcallObserver::to_string(int /*time_considered*/) const
{
return simgrid::xbt::string_printf("[(%ld)%s (%s)] ", issuer_->get_pid(), issuer_->get_host()->get_cname(),
issuer_->get_cname());
}
-std::string SimcallInspector::dot_label() const
+std::string SimcallObserver::dot_label() const
{
if (issuer_->get_host())
return xbt::string_printf("[(%ld)%s] ", issuer_->get_pid(), issuer_->get_cname());
std::string RandomSimcall::to_string(int time_considered) const
{
- return SimcallInspector::to_string(time_considered) + "MC_RANDOM(" + std::to_string(time_considered) + ")";
+ return SimcallObserver::to_string(time_considered) + "MC_RANDOM(" + std::to_string(time_considered) + ")";
}
std::string RandomSimcall::dot_label() const
{
- return SimcallInspector::dot_label() + "MC_RANDOM(" + std::to_string(next_value_) + ")";
+ return SimcallObserver::dot_label() + "MC_RANDOM(" + std::to_string(next_value_) + ")";
}
void RandomSimcall::prepare(int times_considered)
std::string MutexUnlockSimcall::to_string(int time_considered) const
{
- return SimcallInspector::to_string(time_considered) + "Mutex UNLOCK";
+ return SimcallObserver::to_string(time_considered) + "Mutex UNLOCK";
}
std::string MutexUnlockSimcall::dot_label() const
{
- return SimcallInspector::dot_label() + "Mutex UNLOCK";
+ return SimcallObserver::dot_label() + "Mutex UNLOCK";
}
} // namespace mc
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#ifndef SIMGRID_MC_SIMCALL_INSPECTOR_HPP
-#define SIMGRID_MC_SIMCALL_INSPECTOR_HPP
+#ifndef SIMGRID_MC_SIMCALL_OBSERVER_HPP
+#define SIMGRID_MC_SIMCALL_OBSERVER_HPP
#include "simgrid/forward.h"
namespace simgrid {
namespace mc {
-class SimcallInspector {
+class SimcallObserver {
kernel::actor::ActorImpl* issuer_;
public:
- explicit SimcallInspector(kernel::actor::ActorImpl* issuer) : issuer_(issuer) {}
+ explicit SimcallObserver(kernel::actor::ActorImpl* issuer) : issuer_(issuer) {}
kernel::actor::ActorImpl* get_issuer() const { return issuer_; }
/** Whether this transition can currently be taken without blocking.
*
virtual void prepare(int times_considered) { /* Nothing to do by default */}
/** Some simcalls may only be observable under some circumstances.
- * Most simcalls are not visible from the MC because they don't have an inspector at all. */
+ * Most simcalls are not visible from the MC because they don't have an observer at all. */
virtual bool is_visible() const { return true; }
virtual std::string to_string(int times_considered) const = 0;
virtual std::string dot_label() const = 0;
};
-class RandomSimcall : public SimcallInspector {
+class RandomSimcall : public SimcallObserver {
int min_;
int max_;
int next_value_ = 0;
public:
- RandomSimcall(smx_actor_t actor, int min, int max) : SimcallInspector(actor), min_(min), max_(max) {}
+ RandomSimcall(smx_actor_t actor, int min, int max) : SimcallObserver(actor), min_(min), max_(max) {}
int get_max_consider() const override;
void prepare(int times_considered) override;
std::string to_string(int times_considered) const override;
int get_value() const;
};
-class MutexUnlockSimcall : public SimcallInspector {
- using SimcallInspector::SimcallInspector;
+class MutexUnlockSimcall : public SimcallObserver {
+ using SimcallObserver::SimcallObserver;
public:
std::string to_string(int times_considered) const override;
#include "mc/mc.h"
#include "src/kernel/activity/CommImpl.hpp"
#include "src/kernel/activity/MutexImpl.hpp"
-#include "src/mc/checker/SimcallInspector.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include "src/mc/mc_config.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/simix/smx_private.hpp"
xbt_dynar_reset(simix_global->actors_vector);
for (std::pair<const aid_t, smx_actor_t> const& kv : simix_global->process_list) {
auto actor = kv.second;
- if (actor->simcall_.inspector_ != nullptr)
- actor->simcall_.mc_max_consider_ = actor->simcall_.inspector_->get_max_consider();
+ if (actor->simcall_.observer_ != nullptr)
+ actor->simcall_.mc_max_consider_ = actor->simcall_.observer_->get_max_consider();
xbt_dynar_push_as(simix_global->actors_vector, smx_actor_t, actor);
}
#endif
// Now, we are in the client app, no need for remote memory reading.
smx_simcall_t req = &actor->simcall_;
- if (req->inspector_ != nullptr)
- return req->inspector_->is_enabled();
+ if (req->observer_ != nullptr)
+ return req->observer_->is_enabled();
using simix::Simcall;
switch (req->call_) {
#if SIMGRID_HAVE_MC
xbt_assert(mc_model_checker == nullptr, "This should be called from the client side");
#endif
- if (req->inspector_ != nullptr)
- return req->inspector_->is_visible();
+ if (req->observer_ != nullptr)
+ return req->observer_->is_visible();
using simix::Simcall;
return req->call_ == Simcall::COMM_ISEND || req->call_ == Simcall::COMM_IRECV || req->call_ == Simcall::COMM_WAIT ||
#include "src/kernel/activity/CommImpl.hpp"
#include "src/kernel/activity/MutexImpl.hpp"
#include "src/mc/ModelChecker.hpp"
-#include "src/mc/checker/SimcallInspector.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include "src/mc/mc_smx.hpp"
#include <array>
#include "src/mc/remote/AppSide.hpp"
#include "src/internal_config.h"
#include "src/kernel/actor/ActorImpl.hpp"
-#include "src/mc/checker/SimcallInspector.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include <simgrid/modelchecker.h>
#include <cerrno>
auto msg_simcall = (s_mc_message_simcall_is_visible_t*)message_buffer.data();
const kernel::actor::ActorImpl* actor = kernel::actor::ActorImpl::by_PID(msg_simcall->aid);
xbt_assert(actor != nullptr, "Invalid pid %d", msg_simcall->aid);
- xbt_assert(actor->simcall_.inspector_, "The transition of %s has no inspector", actor->get_cname());
- bool value = actor->simcall_.inspector_->is_visible();
+ xbt_assert(actor->simcall_.observer_, "The transition of %s has no observer", actor->get_cname());
+ bool value = actor->simcall_.observer_->is_visible();
// Send result:
s_mc_message_simcall_is_visible_answer_t answer{MessageType::SIMCALL_IS_VISIBLE_ANSWER, value};
auto msg_simcall = (s_mc_message_simcall_to_string_t*)message_buffer.data();
const kernel::actor::ActorImpl* actor = kernel::actor::ActorImpl::by_PID(msg_simcall->aid);
xbt_assert(actor != nullptr, "Invalid pid %d", msg_simcall->aid);
- xbt_assert(actor->simcall_.inspector_, "The transition of %s has no inspector", actor->get_cname());
- std::string value = actor->simcall_.inspector_->to_string(msg_simcall->time_considered);
+ xbt_assert(actor->simcall_.observer_, "The transition of %s has no observer", actor->get_cname());
+ std::string value = actor->simcall_.observer_->to_string(msg_simcall->time_considered);
// Send result:
s_mc_message_simcall_to_string_answer_t answer{MessageType::SIMCALL_TO_STRING_ANSWER, {0}};
auto msg_simcall = (s_mc_message_simcall_to_string_t*)message_buffer.data();
const kernel::actor::ActorImpl* actor = kernel::actor::ActorImpl::by_PID(msg_simcall->aid);
xbt_assert(actor != nullptr, "Invalid pid %d", msg_simcall->aid);
- xbt_assert(actor->simcall_.inspector_, "The transition of %s has no inspector", actor->get_cname());
- std::string value = actor->simcall_.inspector_->dot_label();
+ xbt_assert(actor->simcall_.observer_, "The transition of %s has no observer", actor->get_cname());
+ std::string value = actor->simcall_.observer_->dot_label();
// Send result:
s_mc_message_simcall_to_string_answer_t answer{MessageType::SIMCALL_TO_STRING_ANSWER, {0}};
#include "simgrid/mutex.h"
#include "simgrid/s4u/Mutex.hpp"
#include "src/kernel/activity/MutexImpl.hpp"
-#include "src/mc/checker/SimcallInspector.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
namespace simgrid {
namespace s4u {
#include "src/kernel/activity/IoImpl.hpp"
#include "src/kernel/activity/MailboxImpl.hpp"
#include "src/kernel/activity/MutexImpl.hpp"
-#include "src/mc/checker/SimcallInspector.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
#include "xbt/random.hpp"
return simgrid::kernel::actor::simcall([io] { return io->test(); });
}
-void simcall_run_kernel(std::function<void()> const& code, simgrid::mc::SimcallInspector* t)
+void simcall_run_kernel(std::function<void()> const& code, simgrid::mc::SimcallObserver* t)
{
- simgrid::kernel::actor::ActorImpl::self()->simcall_.inspector_ = t;
+ simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = t;
simcall_BODY_run_kernel(&code);
- simgrid::kernel::actor::ActorImpl::self()->simcall_.inspector_ = nullptr;
+ simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = nullptr;
}
-void simcall_run_blocking(std::function<void()> const& code, simgrid::mc::SimcallInspector* t = nullptr)
+void simcall_run_blocking(std::function<void()> const& code, simgrid::mc::SimcallObserver* t = nullptr)
{
- simgrid::kernel::actor::ActorImpl::self()->simcall_.inspector_ = t;
+ simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = t;
simcall_BODY_run_blocking(&code);
- simgrid::kernel::actor::ActorImpl::self()->simcall_.inspector_ = nullptr;
+ simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = nullptr;
}
int simcall_mc_random(int min, int max) // XBT_ATTRIB_DEPRECATD_v331
#include "src/mc/mc_forward.hpp"
#endif
#include "src/kernel/activity/ConditionVariableImpl.hpp"
-#include "src/mc/checker/SimcallInspector.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
{
XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_.call_));
SIMCALL_SET_MC_VALUE(simcall_, times_considered_);
- if (simcall_.inspector_ != nullptr)
- simcall_.inspector_->prepare(times_considered_);
+ if (simcall_.observer_ != nullptr)
+ simcall_.observer_->prepare(times_considered_);
if (context_->wannadie())
return;
switch (simcall_.call_) {
* @brief Represents a simcall to the kernel.
*/
struct s_smx_simcall {
- 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
+ simgrid::simix::Simcall call_ = simgrid::simix::Simcall::NONE;
+ smx_actor_t issuer_ = nullptr;
+ smx_timer_t timeout_cb_ = nullptr; // Callback to timeouts
+ simgrid::mc::SimcallObserver* observer_ = nullptr; // makes that simcall observable by the MC
unsigned int mc_max_consider_ = 0; // How many times this simcall should be used. If >1, this will be a fork.
- int mc_value_ = 0;
- std::array<u_smx_scalar, 11> args_ = {};
- u_smx_scalar result_ = {};
+ int mc_value_ = 0;
+ std::array<u_smx_scalar, 11> args_ = {};
+ u_smx_scalar result_ = {};
};
#define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall).mc_value_ = (value))
fd.write('#include "src/mc/mc_forward.hpp"\n')
fd.write('#endif\n')
fd.write('#include "src/kernel/activity/ConditionVariableImpl.hpp"\n')
- fd.write('#include "src/mc/checker/SimcallInspector.hpp"\n')
+ fd.write('#include "src/mc/checker/SimcallObserver.hpp"\n')
fd.write('\n')
fd.write('XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);\n\n')
fd.write('{\n')
fd.write(' XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_.call_));\n')
fd.write(' SIMCALL_SET_MC_VALUE(simcall_, times_considered_);\n')
- fd.write(' if (simcall_.inspector_ != nullptr)\n')
- fd.write(' simcall_.inspector_->prepare(times_considered_);\n')
+ fd.write(' if (simcall_.observer_ != nullptr)\n')
+ fd.write(' simcall_.observer_->prepare(times_considered_);\n')
fd.write(' if (context_->wannadie())\n')
fd.write(' return;\n')
src/mc/mc_config.cpp
src/mc/mc_config.hpp
src/mc/mc_global.cpp
- src/mc/checker/SimcallInspector.cpp
- src/mc/checker/SimcallInspector.hpp
+ src/mc/checker/SimcallObserver.cpp
+ src/mc/checker/SimcallObserver.hpp
)
set(MC_SRC