X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/998dcee3c1fd2e8b274506571e381296101d72e6..12e37132d1b9b141fa8497e17b0629cfd4173c36:/src/surf/HostImpl.cpp diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index ff6f1931b5..8983db795e 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -24,7 +24,7 @@ namespace surf { *********/ /* Helper function for executeParallelTask */ -static inline double has_cost(double* array, int pos) +static inline double has_cost(const double* array, size_t pos) { if (array) return array[pos]; @@ -32,8 +32,9 @@ static inline double has_cost(double* array, int pos) return -1.0; } -kernel::resource::Action* HostModel::execute_parallel(int host_nb, s4u::Host** host_list, double* flops_amount, - double* bytes_amount, double rate) +kernel::resource::Action* HostModel::execute_parallel(size_t host_nb, s4u::Host* const* host_list, + const double* flops_amount, const double* bytes_amount, + double rate) { kernel::resource::Action* action = nullptr; if ((host_nb == 1) && (has_cost(bytes_amount, 0) <= 0) && (has_cost(flops_amount, 0) > 0)) { @@ -44,7 +45,7 @@ kernel::resource::Action* HostModel::execute_parallel(int host_nb, s4u::Host** h int nb = 0; double value = 0.0; - for (int i = 0; i < host_nb * host_nb; i++) { + for (size_t i = 0; i < host_nb * host_nb; i++) { if (has_cost(bytes_amount, i) > 0.0) { nb++; value = has_cost(bytes_amount, i); @@ -97,16 +98,16 @@ HostImpl::~HostImpl() /** Re-starts all the actors that are marked as restartable. * - * Weird things will happen if you turn on an host that is already on. S4U is fool-proof, not this. + * Weird things will happen if you turn on a host that is already on. S4U is fool-proof, not this. */ void HostImpl::turn_on() { for (auto const& arg : actors_at_boot_) { XBT_DEBUG("Booting Actor %s(%s) right now", arg->name.c_str(), arg->host->get_cname()); - smx_actor_t actor = - SIMIX_process_create(arg->name.c_str(), arg->code, nullptr, arg->host, arg->properties.get(), nullptr); + simgrid::kernel::actor::ActorImplPtr actor = simgrid::kernel::actor::ActorImpl::create( + arg->name.c_str(), arg->code, nullptr, arg->host, arg->properties.get(), nullptr); if (arg->kill_time >= 0) - simcall_process_set_kill_time(actor, arg->kill_time); + actor->set_kill_time(arg->kill_time); if (arg->auto_restart) actor->auto_restart_ = arg->auto_restart; if (arg->daemon_) @@ -121,7 +122,7 @@ void HostImpl::turn_off() for (auto& actor : process_list_) { XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(), actor.host_->get_cname(), SIMIX_process_self()->get_cname()); - SIMIX_process_kill(&actor, SIMIX_process_self()); + SIMIX_process_self()->kill(&actor); } } // When a host is turned off, we want to keep only the actors that should restart for when it will boot again. @@ -142,7 +143,7 @@ std::vector HostImpl::get_all_actors() res.push_back(actor.ciface()); return res; } -int HostImpl::get_actor_count() +size_t HostImpl::get_actor_count() { return process_list_.size(); }