#include "simgrid/s4u.hpp" /* All of S4U */
#include "xbt/config.hpp"
-namespace sg4 = simgrid::s4u;
-
#include <mutex> /* std::mutex and std::lock_guard */
+namespace sg4 = simgrid::s4u;
+
static simgrid::config::Flag<int> cfg_actor_count("actors", "How many pairs of actors should be started?", 6);
XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "a sample log category");
// Support for the boost::intrusive_ptr<ActivityImpl> datatype
friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
friend XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
- int get_refcount() { return refcount_; } // For debugging purpose
+ int get_refcount() const { return refcount_; } // For debugging purpose
static xbt::signal<void(ActivityImpl const&)> on_suspended;
static xbt::signal<void(ActivityImpl const&)> on_resumed;
void MutexObserver::serialize(std::stringstream& stream) const
{
- auto* owner = get_mutex()->get_owner();
+ const auto* owner = get_mutex()->get_owner();
stream << (short)type_ << ' ' << get_mutex()->get_id() << ' ' << (owner != nullptr ? owner->get_pid() : -1);
}
namespace simgrid {
namespace mc {
-void RecordTrace::replay()
+void RecordTrace::replay() const
{
simgrid::mc::execute_actors();
- for (simgrid::mc::Transition* const transition : transitions_) {
+ for (const simgrid::mc::Transition* transition : transitions_) {
XBT_DEBUG("Executing %ld$%i", transition->aid_, transition->times_considered_);
// Choose a request:
void push_back(Transition* t) { transitions_.push_back(t); }
/** Replay all transitions of a trace */
- void replay();
+ void replay() const;
/** Parse and replay a string representation */
static void replay(const std::string& trace);
XBT_DEBUG("send SIMCALL_EXECUTE_ANSWER(%s) ~> '%s'", actor->get_cname(), str.c_str());
xbt_assert(channel_.send(answer) == 0, "Could not send response");
-
}
void AppSide::handle_actor_enabled(const s_mc_message_actor_enabled_t* msg) const
bool MutexTransition::depends(const Transition* o) const
{
-
if (o->type_ < type_)
return o->depends(this);
// type_ <= other->type_ in MUTEX_LOCK, MUTEX_TEST, MUTEX_TRYLOCK, MUTEX_UNLOCK, MUTEX_WAIT,
if (auto* other = dynamic_cast<const MutexTransition*>(o)) {
-
// Theorem 4.4.7: Any pair of synchronization actions of distinct actors concerning distinct mutexes are independent
if (mutex_ != other->mutex_)
return false;
const char* SIMIX_simcall_name(const s_smx_simcall& simcall)
{
if (simcall.observer_ != nullptr) {
-
static std::string name;
name = boost::core::demangle(typeid(*simcall.observer_).name());
const char* cname = name.c_str();
int todo; // remaining amount of tasks to execute, a global variable
sg4::Mailbox* mailbox; // as a global to reduce the amount of simcalls during actor reboot
-static void master()
+XBT_ATTRIB_NORETURN static void master()
{
double comp_size = 1e6;
long comm_size = 1e6;
todo--;
} catch (const simgrid::TimeoutException&) {
XBT_INFO("Timeouted while getting a task.");
-
} catch (const simgrid::NetworkFailureException&) {
XBT_INFO("Got a NetworkFailureException. Wait a second before starting again.");
sg4::this_actor::sleep_for(1);
}
}
rootzone->seal();
- sg4::Engine::get_instance()->on_platform_created(); // FIXME this should not be necessary
+ sg4::Engine::on_platform_created(); // FIXME this should not be necessary
sg4::Actor::create("master", main, master)->set_auto_restart(true);
int id = 0;