/* Install our extension on all existing hosts */
HostBittorrent::EXTENSION_ID = simgrid::s4u::Host::extension_create<HostBittorrent>();
- std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+ std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
for (auto const& host : list)
host->extension_set(new HostBittorrent(host));
ia.what());
}
my_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(rank));
- if (rank + 1 == simgrid::s4u::Engine::getInstance()->get_host_count())
+ if (rank + 1 == simgrid::s4u::Engine::get_instance()->get_host_count())
/* The last process, which sends the token back to rank 0 */
neighbor_mailbox = simgrid::s4u::Mailbox::byName("0");
else
XBT_DEBUG("Sets nb_keys to %d", nb_keys);
HostChord::EXTENSION_ID = simgrid::s4u::Host::extension_create<HostChord>();
- for (auto const& host : simgrid::s4u::Engine::getInstance()->get_all_hosts())
+ for (auto const& host : simgrid::s4u::Engine::get_instance()->get_all_hosts())
host->extension_set(new HostChord(host));
e.register_actor<Node>("node");
static void runner()
{
/* Retrieve the list of all hosts as an array of hosts */
- std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+ std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
int hosts_count = hosts.size();
XBT_INFO("First, build a classical parallel task, with 1 Gflop to execute on each node, "
static int bob(int argc, char* argv[])
{
/* this host also tests the properties of the AS*/
- simgrid::s4u::NetZone* root = simgrid::s4u::Engine::getInstance()->getNetRoot();
+ simgrid::s4u::NetZone* root = simgrid::s4u::Engine::get_instance()->getNetRoot();
XBT_INFO("== Print the properties of the zone");
XBT_INFO(" Zone property: filename -> %s", root->getProperty("filename"));
XBT_INFO(" Zone property: date -> %s", root->getProperty("date"));
/** Finalize the default engine and all its dependencies */
static void shutdown();
+ /** @brief Run the simulation */
+ void run();
+
+ /** @brief Retrieve the simulation time */
+ static double get_clock();
+ /** @brief Retrieve the engine singleton */
+ static s4u::Engine* get_instance();
+
/** @brief Load a platform file describing the environment
*
* The environment is either a XML file following the simgrid.dtd formalism, or a lua file.
simgrid::s4u::Storage* storage_by_name(std::string name);
simgrid::s4u::Storage* storage_by_name_or_null(std::string name);
- /** @brief Run the simulation */
- void run();
-
- /** @brief Retrieve the simulation time */
- static double get_clock();
-
- /** @brief Retrieve the engine singleton */
- static s4u::Engine* getInstance();
+ std::vector<simgrid::kernel::routing::NetPoint*> get_all_netpoints();
/** @brief Retrieve the root netzone, containing all others */
simgrid::s4u::NetZone* getNetRoot();
- /** @brief Retrieve the netzone of the given name (or nullptr if not found) */
simgrid::s4u::NetZone* getNetzoneByNameOrNull(const char* name);
/** @brief Retrieves all netzones of the same type than the subtype of the whereto vector */
template <class T> void getNetzoneByType(std::vector<T*> * whereto) { netzoneByTypeRecursive(getNetRoot(), whereto); }
+
/** @brief Retrieve the netcard of the given name (or nullptr if not found) */
simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(std::string name);
- void getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
/** Returns whether SimGrid was initialized yet -- mostly for internal use */
- static bool isInitialized();
-
+ static bool is_initialized();
/** @brief set a configuration variable
*
- * Do --help on any simgrid binary to see the list of currently existing configuration variables (see @ref options).
+ * Do --help on any simgrid binary to see the list of currently existing configuration variables (see also @ref
+ * options).
*
* Example:
- * e->setConfig("host/model","ptask_L07");
+ * e->set_config("host/model:ptask_L07");
*/
- void setConfig(std::string str);
+ void set_config(std::string str);
+ simgrid::kernel::EngineImpl* pimpl;
+
+private:
+ static s4u::Engine* instance_;
+
+ //////////////// Deprecated functions
+public:
XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_platform()") void loadPlatform(const char* platf)
{
load_platform(platf);
return get_all_storages();
}
XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_clock()") static double getClock() { return get_clock(); }
-
- simgrid::kernel::EngineImpl* pimpl;
-
-private:
- static s4u::Engine* instance_;
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_all_netpoints()") void getNetpointList(
+ std::vector<simgrid::kernel::routing::NetPoint*>* list);
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_instance()") static s4u::Engine* getInstance()
+ {
+ return get_instance();
+ }
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::is_initialized()") static bool isInitialized()
+ {
+ return is_initialized();
+ }
+ XBT_ATTRIB_DEPRECATED_v323("Please use Engine::set_config()") void setConfig(std::string str) { set_config(str); }
};
/** Callback fired when the platform is created (ie, the xml file parsed),
NetZoneContainer::NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father)
: Container::Container(name, "", father)
{
- netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+ netpoint_ = simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name);
xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
if (father_) {
type_ = father_->type_->getOrCreateContainerType(std::string("L") + std::to_string(level));
{
xbt_assert(father, "Only the Root container has no father");
- netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+ netpoint_ = simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name);
xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
trivaNodeTypes.insert(type_->get_name());
}
}
- xbt_graph_t graph = xbt_graph_new_graph(0, nullptr);
+ xbt_graph_t graph = xbt_graph_new_graph(0, nullptr);
std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
currentContainer.clear();
std::set<std::string>* filter = new std::set<std::string>;
XBT_DEBUG("Starting graph extraction.");
- recursiveGraphExtraction(simgrid::s4u::Engine::getInstance()->getNetRoot(), simgrid::instr::Container::getRoot(),
+ recursiveGraphExtraction(simgrid::s4u::Engine::get_instance()->getNetRoot(), simgrid::instr::Container::getRoot(),
filter);
XBT_DEBUG("Graph extraction finished.");
delete filter;
xbt_graph_t instr_routing_platform_graph()
{
- xbt_graph_t ret = xbt_graph_new_graph(0, nullptr);
+ xbt_graph_t ret = xbt_graph_new_graph(0, nullptr);
std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
- recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::getInstance()->getNetRoot(),
+ recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::get_instance()->getNetRoot(),
simgrid::instr::Container::getRoot());
delete nodes;
delete edges;
hosts_.at(name)->destroy();
/* Also delete the other data */
- delete netRoot_;
+ delete netzone_root_;
for (auto const& kv : netpoints_)
delete kv.second;
public:
EngineImpl();
virtual ~EngineImpl();
- kernel::routing::NetZoneImpl* netRoot_ = nullptr;
+ kernel::routing::NetZoneImpl* netzone_root_ = nullptr;
private:
std::map<std::string, simgrid::s4u::Host*> hosts_;
id_ = netzone_p->addComponent(this);
else
id_ = static_cast<decltype(id_)>(-1);
- simgrid::s4u::Engine::getInstance()->netpoint_register(this);
+ simgrid::s4u::Engine::get_instance()->netpoint_register(this);
simgrid::kernel::routing::NetPoint::onCreation(this);
}
}
*/
simgrid::kernel::routing::NetPoint* sg_netpoint_by_name_or_null(const char* name)
{
- return simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+ return simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name);
}
NetZoneImpl::NetZoneImpl(NetZone* father, std::string name) : NetZone(father, name)
{
- xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name.c_str()),
+ xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name.c_str()),
"Refusing to create a second NetZone called '%s'.", name.c_str());
netpoint_ = new NetPoint(name, NetPoint::Type::NetZone, static_cast<NetZoneImpl*>(father));
for (auto const& kv : bypass_routes_)
delete kv.second;
- simgrid::s4u::Engine::getInstance()->netpoint_unregister(netpoint_);
+ simgrid::s4u::Engine::get_instance()->netpoint_unregister(netpoint_);
}
simgrid::s4u::Host* NetZoneImpl::create_host(const char* name, std::vector<double>* speedPerPstate, int coreAmount,
if (src->is_netzone()) {
std::string srcName = "router_" + src->get_name();
std::string dstName = "router_" + dst->get_name();
- route->gw_src = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(srcName.c_str());
- route->gw_dst = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(dstName.c_str());
+ route->gw_src = simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(srcName.c_str());
+ route->gw_dst = simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(dstName.c_str());
}
/* Retrieve the private links */
s4u::Engine::instance_ = nullptr;
}
-Engine* Engine::getInstance()
+/** @brief Retrieve the engine singleton */
+Engine* Engine::get_instance()
{
if (s4u::Engine::instance_ == nullptr)
return new Engine(0, nullptr);
s4u::NetZone* Engine::getNetRoot()
{
- return pimpl->netRoot_;
+ return pimpl->netzone_root_;
}
-static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* name)
+static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, const char* name)
{
if (not strcmp(current->get_cname(), name))
return current;
for (auto const& elem : *(current->getChildren())) {
- simgrid::s4u::NetZone* tmp = netzoneByNameRecursive(elem, name);
+ simgrid::s4u::NetZone* tmp = netzone_by_name_recursive(elem, name);
if (tmp != nullptr) {
return tmp;
}
/** @brief Retrieve the NetZone of the given name (or nullptr if not found) */
NetZone* Engine::getNetzoneByNameOrNull(const char* name)
{
- return netzoneByNameRecursive(getNetRoot(), name);
+ return netzone_by_name_recursive(getNetRoot(), name);
}
/** @brief Retrieve the netpoint of the given name (or nullptr if not found) */
for (auto const& kv : pimpl->netpoints_)
list->push_back(kv.second);
}
+std::vector<simgrid::kernel::routing::NetPoint*> Engine::get_all_netpoints()
+{
+ std::vector<simgrid::kernel::routing::NetPoint*> res;
+ for (auto const& kv : pimpl->netpoints_)
+ res.push_back(kv.second);
+ return res;
+}
+
/** @brief Register a new netpoint to the system */
void Engine::netpoint_register(simgrid::kernel::routing::NetPoint* point)
{
});
}
-bool Engine::isInitialized()
+bool Engine::is_initialized()
{
return Engine::instance_ != nullptr;
}
-void Engine::setConfig(std::string str)
+void Engine::set_config(std::string str)
{
simgrid::config::set_parse(std::move(str));
}
Host::Host(const char* name) : name_(name)
{
xbt_assert(Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name);
- Engine::getInstance()->host_register(std::string(name_), this);
+ Engine::get_instance()->host_register(std::string(name_), this);
new simgrid::surf::HostImpl(this);
}
delete pimpl_;
if (pimpl_netpoint != nullptr) // not removed yet by a children class
- simgrid::s4u::Engine::getInstance()->netpoint_unregister(pimpl_netpoint);
+ simgrid::s4u::Engine::get_instance()->netpoint_unregister(pimpl_netpoint);
delete pimpl_cpu;
delete mounts;
}
if (not currentlyDestroying_) {
currentlyDestroying_ = true;
onDestruction(*this);
- Engine::getInstance()->host_unregister(std::string(name_));
+ Engine::get_instance()->host_unregister(std::string(name_));
delete this;
}
}
Host* Host::by_name(std::string name)
{
- return Engine::getInstance()->host_by_name(name);
+ return Engine::get_instance()->host_by_name(name);
}
Host* Host::by_name(const char* name)
{
- return Engine::getInstance()->host_by_name(std::string(name));
+ return Engine::get_instance()->host_by_name(std::string(name));
}
Host* Host::by_name_or_null(const char* name)
{
- return Engine::getInstance()->host_by_name_or_null(std::string(name));
+ return Engine::get_instance()->host_by_name_or_null(std::string(name));
}
Host* Host::by_name_or_null(std::string name)
{
- return Engine::getInstance()->host_by_name_or_null(name);
+ return Engine::get_instance()->host_by_name_or_null(name);
}
Host* Host::current()
sg_netzone_t sg_zone_get_root()
{
- return simgrid::s4u::Engine::getInstance()->getNetRoot();
+ return simgrid::s4u::Engine::get_instance()->getNetRoot();
}
const char* sg_zone_get_name(sg_netzone_t netzone)
sg_netzone_t sg_zone_get_by_name(const char* name)
{
- return simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(name);
+ return simgrid::s4u::Engine::get_instance()->getNetzoneByNameOrNull(name);
}
void sg_zone_get_sons(sg_netzone_t netzone, xbt_dict_t whereto)
void getStorageList(std::map<std::string, Storage*>* whereTo)
{
- for (auto const& s : simgrid::s4u::Engine::getInstance()->get_all_storages())
+ for (auto const& s : simgrid::s4u::Engine::get_instance()->get_all_storages())
whereTo->insert({s->get_name(), s});
}
Storage::Storage(std::string name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(name)
{
- simgrid::s4u::Engine::getInstance()->storage_register(name, this);
+ simgrid::s4u::Engine::get_instance()->storage_register(name, this);
}
Storage* Storage::byName(std::string name)
{
- return Engine::getInstance()->storage_by_name_or_null(name);
+ return Engine::get_instance()->storage_by_name_or_null(name);
}
const std::string& Storage::get_name() const
*/
xbt_dynar_t sg_storages_as_dynar()
{
- std::vector<simgrid::s4u::Storage*> storage_list = simgrid::s4u::Engine::getInstance()->get_all_storages();
+ std::vector<simgrid::s4u::Storage*> storage_list = simgrid::s4u::Engine::get_instance()->get_all_storages();
xbt_dynar_t res = xbt_dynar_new(sizeof(sg_storage_t), nullptr);
for (auto const& s : storage_list)
xbt_dynar_push(res, &s);
if(schedule){
if (schedule_success) {
- std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+ std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
for (auto const& elm : computers) {
SD_task_t previous_task = nullptr;
*/
void SD_create_environment(const char *platform_file)
{
- simgrid::s4u::Engine::getInstance()->load_platform(platform_file);
+ simgrid::s4u::Engine::get_instance()->load_platform(platform_file);
XBT_DEBUG("Host number: %zu, link number: %d", sg_host_count(), sg_link_count());
#if SIMGRID_HAVE_JEDULE
size_t sg_host_count()
{
- return simgrid::s4u::Engine::getInstance()->get_host_count();
+ return simgrid::s4u::Engine::get_instance()->get_host_count();
}
/** @brief Returns the host list
*
*/
sg_host_t *sg_host_list() {
xbt_assert(sg_host_count() > 0, "There is no host!");
- std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+ std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
sg_host_t* res = (sg_host_t*)malloc(sizeof(sg_host_t) * hosts.size());
memcpy(res, hosts.data(), sizeof(sg_host_t) * hosts.size());
{
xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),nullptr);
- std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+ std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
for (auto const& host : list) {
if (host && host->pimpl_netpoint && host->pimpl_netpoint->is_host())
int PMPI_Init(int *argc, char ***argv)
{
- xbt_assert(simgrid::s4u::Engine::isInitialized(),
+ xbt_assert(simgrid::s4u::Engine::is_initialized(),
"Your MPI program was not properly initialized. The easiest is to use smpirun to start it.");
// PMPI_Init is called only once per SMPI process
int already_init;
static int already_called = 0;
if (not already_called) {
already_called = 1;
- std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+ std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
for (auto const& host : list) {
host->extension_set(new simgrid::smpi::SmpiHost(host));
}
static void onSimulationEnd()
{
- std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+ std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
double total_energy = 0.0; // Total energy consumption (whole platform)
double used_hosts_energy = 0.0; // Energy consumed by hosts that computed something
void sg_host_energy_update_all()
{
simgrid::simix::kernelImmediate([]() {
- std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+ std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
for (auto const& host : list)
if (dynamic_cast<simgrid::s4u::VirtualMachine*>(host) == nullptr) // Ignore virtual machines
host->extension<HostEnergy>()->update();
static void onSimulationEnd()
{
- std::vector<simgrid::s4u::Link*> links = simgrid::s4u::Engine::getInstance()->get_all_links();
+ std::vector<simgrid::s4u::Link*> links = simgrid::s4u::Engine::get_instance()->get_all_links();
double total_energy = 0.0; // Total dissipated energy (whole platform)
for (const auto link : links) {
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
- xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name),
+ xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name),
"Refusing to create a router named '%s': this name already describes a node.", name.c_str());
simgrid::kernel::routing::NetPoint* netpoint =
if (mount_list.empty())
XBT_DEBUG("Create a Mount list for %s", A_surfxml_host_id);
- mount_list.insert({mount->name, simgrid::s4u::Engine::getInstance()->storage_by_name(mount->storageId)->getImpl()});
+ mount_list.insert({mount->name, simgrid::s4u::Engine::get_instance()->storage_by_name(mount->storageId)->getImpl()});
}
void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route)
std::string msg = std::string("Cannot create actor '") + actor->function + "': host '" + actor->host +
"' does not exist\nExisting hosts: '";
- std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+ std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
for (auto const& host : list) {
msg += host->get_name();
}
if (current_routing == nullptr) { /* it is the first one */
- xbt_assert(simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ == nullptr,
+ xbt_assert(simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ == nullptr,
"All defined components must belong to a networking zone.");
- simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ = new_zone;
+ simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ = new_zone;
} else {
/* set the father behavior */
void check_disk_attachment()
{
- for (auto const& s : simgrid::s4u::Engine::getInstance()->get_all_storages()) {
+ for (auto const& s : simgrid::s4u::Engine::get_instance()->get_all_storages()) {
simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(s->getImpl()->getHost().c_str());
if (not host_elm)
surf_parse_error(std::string("Unable to attach storage ") + s->get_cname() + ": host " +
std::string msg = pre + hostname + post + " Existing netpoints: \n";
- std::vector<simgrid::kernel::routing::NetPoint*> list;
- simgrid::s4u::Engine::getInstance()->getNetpointList(&list);
- std::sort(list.begin(), list.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
- return a->get_name() < b->get_name();
- });
+ std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+ simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+ std::sort(netpoints.begin(), netpoints.end(),
+ [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
+ return a->get_name() < b->get_name();
+ });
bool first = true;
- for (auto const& np : list) {
+ for (auto const& np : netpoints) {
if (np->is_netzone())
continue;
{
if (ZONE_TAG) { // We need to retrieve the most recently opened zone
XBT_DEBUG("Set zone property %s -> %s", A_surfxml_prop_id, A_surfxml_prop_value);
- simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(A_surfxml_zone_id);
+ simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::get_instance()->getNetzoneByNameOrNull(A_surfxml_zone_id);
netzone->setProperty(A_surfxml_prop_id, A_surfxml_prop_value);
} else {
void STag_surfxml_random(){/* Nothing to do */}
void ETag_surfxml_random(){/* Nothing to do */}
void ETag_surfxml_trace___connect(){/* Nothing to do */}
-void STag_surfxml_trace(){/* Nothing to do */}
+void STag_surfxml_trace()
+{ /* Nothing to do */
+}
void ETag_surfxml_router(){/*Nothing to do*/}
void ETag_surfxml_host___link(){/* Nothing to do */}
void ETag_surfxml_cabinet(){/* Nothing to do */}
static void dump_platform_storages()
{
- std::vector<simgrid::s4u::Storage*> storages = simgrid::s4u::Engine::getInstance()->get_all_storages();
+ std::vector<simgrid::s4u::Storage*> storages = simgrid::s4u::Engine::get_instance()->get_all_storages();
for (auto const& s : storages) {
XBT_INFO("Storage %s is attached to %s", s->get_cname(), s->getHost()->get_cname());
static void dump_routers()
{
- std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
- simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
- std::sort(netcardList.begin(), netcardList.end(),
+ std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+ simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+ std::sort(netpoints.begin(), netpoints.end(),
[](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
return a->get_name() < b->get_name();
});
- for (auto const& srcCard : netcardList)
- if (srcCard->is_router())
- std::printf(" <router id=\"%s\"/>\n", srcCard->get_cname());
+ for (auto const& src : netpoints)
+ if (src->is_router())
+ std::printf(" <router id=\"%s\"/>\n", src->get_cname());
}
static void dump_routes()
sg_host_t* hosts = sg_host_list();
std::sort(hosts, hosts + totalHosts,
[](sg_host_t a, sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
- std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
- simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
- std::sort(netcardList.begin(), netcardList.end(),
+ std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+ simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+ std::sort(netpoints.begin(), netpoints.end(),
[](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
return a->get_name() < b->get_name();
});
for (unsigned int it_src = 0; it_src < totalHosts; it_src++) { // Routes from host
- simgrid::s4u::Host* host1 = hosts[it_src];
- simgrid::kernel::routing::NetPoint* netcardSrc = host1->pimpl_netpoint;
+ simgrid::s4u::Host* host1 = hosts[it_src];
+ simgrid::kernel::routing::NetPoint* src = host1->pimpl_netpoint;
for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
simgrid::s4u::Host* host2 = hosts[it_dst];
std::vector<simgrid::kernel::resource::LinkImpl*> route;
- simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
- simgrid::kernel::routing::NetZoneImpl::get_global_route(netcardSrc, netcardDst, route, nullptr);
+ simgrid::kernel::routing::NetPoint* dst = host2->pimpl_netpoint;
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
if (not route.empty()) {
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), host2->get_cname());
for (auto const& link : route)
}
}
- for (auto const& netcardDst : netcardList) { // to router
- if (netcardDst->is_router()) {
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), netcardDst->get_cname());
+ for (auto const& dst : netpoints) { // to router
+ if (dst->is_router()) {
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), dst->get_cname());
std::vector<simgrid::kernel::resource::LinkImpl*> route;
- simgrid::kernel::routing::NetZoneImpl::get_global_route(netcardSrc, netcardDst, route, nullptr);
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
for (auto const& link : route)
std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
std::printf("\n </route>\n");
}
}
- for (auto const& value1 : netcardList) { // Routes from router
+ for (auto const& value1 : netpoints) { // Routes from router
if (value1->is_router()) {
- for (auto const& value2 : netcardList) { // to router
+ for (auto const& value2 : netpoints) { // to router
if (value2->is_router()) {
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), value2->get_cname());
std::vector<simgrid::kernel::resource::LinkImpl*> route;
xbt_dynar_t hosts = sg_hosts_as_dynar();
std::printf("Host count: %zu, link number: %d\n", sg_host_count(), sg_link_count());
- std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
- simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
- std::sort(netcardList.begin(), netcardList.end(),
+ std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+ simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+ std::sort(netpoints.begin(), netpoints.end(),
[](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
return a->get_name() < b->get_name();
});
}
xbt_dynar_free(&hosts);
- std::printf("NetCards count: %zu\n", netcardList.size());
- for (auto const& nc : netcardList)
+ std::printf("NetCards count: %zu\n", netpoints.size());
+ for (auto const& nc : netpoints)
std::printf(" - Seen: \"%s\". Type: %s\n", nc->get_cname(),
nc->is_router() ? "router" : (nc->is_netzone() ? "netzone" : (nc->is_host() ? "host" : "buggy")));