void IoImpl::finish()
{
while (not simcalls_.empty()) {
- smx_simcall_t simcall = simcalls_.front();
+ const s_smx_simcall* simcall = simcalls_.front();
simcalls_.pop_front();
switch (state_) {
case State::DONE:
auto& comm_queue = done ? done_comm_queue_ : comm_queue_;
for (auto it = comm_queue.begin(); it != comm_queue.end(); it++) {
- CommImplPtr& comm = *it;
+ const CommImplPtr& comm = *it;
if (comm->type_ == CommImpl::Type::SEND) {
other_user_data = comm->src_data_;
void SleepImpl::finish()
{
while (not simcalls_.empty()) {
- smx_simcall_t simcall = simcalls_.front();
+ const s_smx_simcall* simcall = simcalls_.front();
simcalls_.pop_front();
simcall->issuer_->waiting_synchro = nullptr;
void RawContext::swap_into(SwappedContext* to_)
{
- RawContext* to = static_cast<RawContext*>(to_);
+ const RawContext* to = static_cast<RawContext*>(to_);
ASAN_ONLY(void* fake_stack = nullptr);
- ASAN_ONLY(to->asan_ctx_ = this);
- ASAN_START_SWITCH(this->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
+ ASAN_ONLY(to_->asan_ctx_ = this);
+ ASAN_START_SWITCH(this->asan_stop_ ? nullptr : &fake_stack, to_->asan_stack_, to_->asan_stack_size_);
raw_swapcontext(&this->stack_top_, to->stack_top_);
ASAN_FINISH_SWITCH(fake_stack, &this->asan_ctx_->asan_stack_, &this->asan_ctx_->asan_stack_size_);
}
return;
/* maestro is already saved in the first slot of workers_context_ */
- smx_actor_t first_actor = simix_global->actors_to_run.front();
+ const actor::ActorImpl* first_actor = simix_global->actors_to_run.front();
process_index_ = 1;
/* execute the first actor; it will chain to the others when using suspend() */
static_cast<SwappedContext*>(first_actor->context_.get())->resume();
void UContext::swap_into(SwappedContext* to_)
{
- UContext* to = static_cast<UContext*>(to_);
+ const UContext* to = static_cast<UContext*>(to_);
ASAN_ONLY(void* fake_stack = nullptr);
- ASAN_ONLY(to->asan_ctx_ = this);
- ASAN_START_SWITCH(this->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
+ ASAN_ONLY(to_->asan_ctx_ = this);
+ ASAN_START_SWITCH(this->asan_stop_ ? nullptr : &fake_stack, to_->asan_stack_, to_->asan_stack_size_);
swapcontext(&this->uc_, &to->uc_);
ASAN_FINISH_SWITCH(fake_stack, &this->asan_ctx_->asan_stack_, &this->asan_ctx_->asan_stack_size_);
}
int nb = 0;
XBT_DEBUG("Processing cnst %p ", &cnst);
cnst.usage_ = 0.0;
- for (Element& elem : cnst.enabled_element_set_) {
+ for (const Element& elem : cnst.enabled_element_set_) {
xbt_assert(elem.variable->sharing_penalty_ > 0);
if (elem.consumption_weight > 0 && elem.variable->saturated_variable_set_hook_.is_linked())
nb++;
Constraint& cnst = *iter;
XBT_DEBUG("Updating cnst %p ", &cnst);
if (cnst.sharing_policy_ != s4u::Link::SharingPolicy::FATPIPE) {
- for (Element& elem : cnst.enabled_element_set_) {
+ for (const Element& elem : cnst.enabled_element_set_) {
xbt_assert(elem.variable->sharing_penalty_ > 0);
XBT_DEBUG("\tUpdate constraint %p (%g) with variable %p by %g", &cnst, cnst.remaining_, elem.variable,
elem.variable->mu_);
double_update(&cnst.remaining_, elem.consumption_weight * elem.variable->mu_, sg_maxmin_precision);
}
} else {
- for (Element& elem : cnst.enabled_element_set_) {
+ for (const Element& elem : cnst.enabled_element_set_) {
xbt_assert(elem.variable->sharing_penalty_ > 0);
XBT_DEBUG("\tNon-Shared variable. Update constraint usage of %p (%g) with variable %p by %g", &cnst,
cnst.usage_, elem.variable, elem.variable->mu_);
XBT_DEBUG("\tGet rid of constraint %p", &cnst);
iter = cnst_list.erase(iter);
- for (Element& elem : cnst.enabled_element_set_) {
+ for (const Element& elem : cnst.enabled_element_set_) {
if (elem.variable->sharing_penalty_ <= 0)
break;
if (elem.consumption_weight > 0 && elem.variable->saturated_variable_set_hook_.is_linked()) {
// If it does, subtract it from the required slack
int current_share = 0;
if (var->concurrency_share_ > 1) {
- for (Element& elem : var->cnsts_) {
+ for (const Element& elem : var->cnsts_) {
if (elem.constraint == cnst && elem.enabled_element_set_hook.is_linked())
current_share += elem.get_concurrency();
}
/* Add active variables (i.e. variables that need to be set) from the set of constraints to saturate
* (cnst_light_tab)*/
for (int const& saturated_cnst : saturated_constraints) {
- ConstraintLight& cnst = cnst_light_tab[saturated_cnst];
+ const ConstraintLight& cnst = cnst_light_tab[saturated_cnst];
for (Element const& elem : cnst.cnst->active_element_set_) {
xbt_assert(elem.variable->sharing_penalty_ > 0); // All elements of active_element_set should be active
if (elem.consumption_weight > 0 && not elem.variable->saturated_variable_set_hook_.is_linked())
// Remember: non-shared constraints only require that max(elem.value * var.value) < cnst->bound
cnst->usage_ = 0.0;
elem.make_inactive();
- for (Element& elem2 : cnst->enabled_element_set_) {
+ for (const Element& elem2 : cnst->enabled_element_set_) {
xbt_assert(elem2.variable->sharing_penalty_ > 0);
if (elem2.variable->value_ > 0)
continue;
xbt_assert(not path.empty(), "Cannot parse a trace from an empty filename");
xbt_assert(trace_list.find(path) == trace_list.end(), "Refusing to define trace %s twice", path.c_str());
- std::ifstream* f = surf_ifsopen(path);
+ const std::ifstream* f = surf_ifsopen(path);
xbt_assert(not f->fail(), "Cannot open file '%s' (path=%s)", path.c_str(), (boost::join(surf_path, ":")).c_str());
std::stringstream buffer;
link.policy = cluster->sharing_policy;
sg_platf_new_link(&link);
- s4u::Link* linkUp;
- s4u::Link* linkDown;
+ const s4u::Link* linkUp;
+ const s4u::Link* linkDown;
if (link.policy == simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX) {
linkUp = s4u::Link::by_name(link_id + "_UP");
linkDown = s4u::Link::by_name(link_id + "_DOWN");
if (edge == nullptr)
throw std::invalid_argument(xbt::string_printf("No route from '%s' to '%s'", src->get_cname(), dst->get_cname()));
- RouteCreationArgs* e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
+ const RouteCreationArgs* e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
for (auto const& link : e_route->link_list) {
route->link_list.insert(route->link_list.begin(), link);
xbt_dynar_foreach (xbt_graph_node_get_outedges(v_node), cursor, edge) {
xbt_node_t u_node = xbt_graph_edge_get_target(edge);
- GraphNodeData* data = static_cast<GraphNodeData*>(xbt_graph_node_get_data(u_node));
+ const GraphNodeData* data = static_cast<GraphNodeData*>(xbt_graph_node_get_data(u_node));
int u_id = data->graph_id_;
- RouteCreationArgs* tmp_e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
+ const RouteCreationArgs* tmp_e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
int cost_v_u = tmp_e_route->link_list.size(); /* count of links, old model assume 1 */
if (cost_v_u + cost_arr[v_id] < cost_arr[u_id]) {
if (edge == nullptr)
throw std::invalid_argument(xbt::string_printf("No route from '%s' to '%s'", src->get_cname(), dst->get_cname()));
- RouteCreationArgs* e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
+ const RouteCreationArgs* e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
- NetPoint* prev_gw_src = gw_src;
+ const NetPoint* prev_gw_src = gw_src;
gw_src = e_route->gw_src;
NetPoint* gw_dst = e_route->gw_dst;
NetPoint* prev_dst_gw = nullptr;
while (not route_stack.empty()) {
- RouteCreationArgs* e_route = route_stack.back();
+ const RouteCreationArgs* e_route = route_stack.back();
route_stack.pop_back();
if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != nullptr &&
prev_dst_gw->get_cname() != e_route->gw_src->get_cname()) {
XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
unsigned int table_size = get_table_size();
- RouteCreationArgs* e_route = TO_ROUTE_FULL(src->id(), dst->id());
+ const RouteCreationArgs* e_route = TO_ROUTE_FULL(src->id(), dst->id());
if (e_route != nullptr) {
res->gw_src = e_route->gw_src;
{
int count = 0;
for (auto const& card : get_vertices()) {
- s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->get_name());
+ const s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->get_name());
if (host != nullptr)
count++;
}
/* engage the full recursive search */
/* (1) find the path to root of src and dst*/
- NetZoneImpl* src_as = src->get_englobing_zone();
- NetZoneImpl* dst_as = dst->get_englobing_zone();
+ const NetZoneImpl* src_as = src->get_englobing_zone();
+ const NetZoneImpl* dst_as = dst->get_englobing_zone();
xbt_assert(src_as, "Host %s must be in a netzone", src->get_cname());
xbt_assert(dst_as, "Host %s must be in a netzone", dst->get_cname());
/* Base case, no recursion is needed */
if (dst->get_englobing_zone() == this && src->get_englobing_zone() == this) {
if (bypass_routes_.find({src, dst}) != bypass_routes_.end()) {
- BypassRoute* bypassedRoute = bypass_routes_.at({src, dst});
+ const BypassRoute* bypassedRoute = bypass_routes_.at({src, dst});
for (resource::LinkImpl* const& link : bypassedRoute->links) {
links.push_back(link);
if (latency)
int max_index = std::max(max_index_src, max_index_dst);
/* (3) Search for a bypass making the path up to the ancestor useless */
- BypassRoute* bypassedRoute = nullptr;
+ const BypassRoute* bypassedRoute = nullptr;
std::pair<kernel::routing::NetPoint*, kernel::routing::NetPoint*> key;
for (int max = 0; max <= max_index; max++) {
for (int i = 0; i < max; i++) {
static const char* instr_node_name(xbt_node_t node)
{
- void* data = xbt_graph_node_get_data(node);
+ const void* data = xbt_graph_node_get_data(node);
return static_cast<const char*>(data);
}
xbt_assert(src, "Cannot find a route from nullptr to %s", dst->get_cname());
xbt_assert(dst, "Cannot find a route from %s to nullptr", src->get_cname());
- NetZoneImpl* src_as = src->get_englobing_zone();
- NetZoneImpl* dst_as = dst->get_englobing_zone();
+ const NetZoneImpl* src_as = src->get_englobing_zone();
+ const NetZoneImpl* dst_as = dst->get_englobing_zone();
xbt_assert(src_as == dst_as,
"Internal error: %s@%s and %s@%s are not in the same netzone as expected. Please report that bug.",