ActivityTestanySimcall::ActivityTestanySimcall(ActorImpl* actor, const std::vector<activity::ActivityImpl*>& activities)
: ResultingSimcall(actor, -1), activities_(activities)
-{
-}
-
-int ActivityTestanySimcall::get_max_consider()
{
indexes_.clear();
// list all the activities that are ready
for (unsigned i = 0; i < activities_.size(); i++)
if (activities_[i]->test(get_issuer()))
indexes_.push_back(i);
+}
+
+int ActivityTestanySimcall::get_max_consider() const
+{
return indexes_.size() + 1;
}
double timeout)
: ResultingSimcall(actor, -1), activities_(activities), timeout_(timeout)
{
+ // list all the activities that are ready
+ indexes_.clear();
+ for (unsigned i = 0; i < activities_.size(); i++)
+ if (activities_[i]->test(get_issuer()))
+ indexes_.push_back(i);
}
bool ActivityWaitSimcall::is_enabled()
return not indexes_.empty();
}
-int ActivityWaitanySimcall::get_max_consider()
+int ActivityWaitanySimcall::get_max_consider() const
{
- // list all the activities that are ready
- indexes_.clear();
- for (unsigned i = 0; i < activities_.size(); i++)
- if (activities_[i]->test(get_issuer()))
- indexes_.push_back(i);
-
int res = indexes_.size();
// if (_sg_mc_timeout && timeout_)
// res++;
bool is_visible() const override { return true; }
bool is_enabled() override { return true; /* can return -1 if no activity is ready */ }
void serialize(std::stringstream& stream) const override;
- int get_max_consider() override;
+ int get_max_consider() const override;
void prepare(int times_considered) override;
const std::vector<activity::ActivityImpl*>& get_activities() const { return activities_; }
int get_value() const { return next_value_; }
void serialize(std::stringstream& stream) const override;
bool is_visible() const override { return true; }
void prepare(int times_considered) override;
- int get_max_consider() override;
+ int get_max_consider() const override;
const std::vector<activity::ActivityImpl*>& get_activities() const { return activities_; }
double get_timeout() const { return timeout_; }
int get_value() const { return next_value_; }
XBT_DEBUG("MC_RANDOM(%d, %d) will return %d after %d times", min_, max_, next_value_, times_considered);
}
-int RandomSimcall::get_max_consider()
+int RandomSimcall::get_max_consider() const
{
return max_ - min_ + 1;
}
* If it's more than one (as with mc_random or waitany), we need to consider this transition several times to start
* differing branches
*/
- virtual int get_max_consider() { return 1; }
+ virtual int get_max_consider() const { return 1; }
/** Prepares the simcall to be used.
*
xbt_assert(min < max);
}
void serialize(std::stringstream& stream) const override;
- int get_max_consider() override;
+ int get_max_consider() const override;
void prepare(int times_considered) override;
int get_value() const { return next_value_; }
};
void execute_actors()
{
auto* engine = kernel::EngineImpl::get_instance();
-#if SIMGRID_HAVE_MC
- xbt_assert(mc_model_checker == nullptr, "This must be called from the client");
-#endif
+
while (engine->has_actors_to_run()) {
engine->run_all_actors();
for (auto const& actor : engine->get_actors_that_ran()) {