From 7ef49c428ab0209965a09a36ab28b59789aaa4b5 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 6 Jul 2017 10:50:45 +0200 Subject: [PATCH] tend to the google coding standards in all S4U API --- .../s4u/actions-comm/s4u_actions-comm.cpp | 9 +-- .../actions-storage/s4u_actions-storage.cpp | 4 +- .../s4u/actor-create/s4u_actor-create.cpp | 2 +- .../actor-migration/s4u_actor-migration.cpp | 2 +- .../s4u/actor-suspend/s4u_actor-suspend.cpp | 4 +- .../app-masterworker/s4u_app-masterworker.cpp | 2 +- .../s4u/app-token-ring/s4u_app-token-ring.cpp | 12 ++-- examples/s4u/dht-chord/node.cpp | 15 ++-- examples/s4u/dht-chord/s4u_dht-chord.cpp | 2 +- examples/s4u/dht-chord/s4u_dht-chord.hpp | 5 +- examples/s4u/io/s4u_io.cpp | 26 +++---- examples/simdag/test/sd_test.cpp | 14 ++-- include/simgrid/s4u/Actor.hpp | 22 +++--- include/simgrid/s4u/Comm.hpp | 2 +- include/simgrid/s4u/Engine.hpp | 14 ++-- include/simgrid/s4u/File.hpp | 4 +- include/simgrid/s4u/Host.hpp | 22 +++--- include/simgrid/s4u/Mailbox.hpp | 4 +- include/simgrid/s4u/NetZone.hpp | 12 ++-- include/simgrid/s4u/Storage.hpp | 20 +++--- include/simgrid/s4u/VirtualMachine.hpp | 4 +- src/bindings/java/jmsg.cpp | 2 +- src/bindings/java/jmsg_as.cpp | 12 ++-- src/bindings/java/jmsg_host.cpp | 4 +- src/bindings/lua/lua_host.cpp | 2 +- src/instr/instr_paje_containers.cpp | 4 +- src/kernel/routing/NetPoint.cpp | 4 +- src/kernel/routing/NetZoneImpl.cpp | 12 ++-- src/kernel/routing/RoutedZone.cpp | 4 +- src/kernel/routing/VivaldiZone.cpp | 4 +- src/mc/mc_smx.cpp | 4 +- src/msg/instr_msg_process.cpp | 6 +- src/msg/msg_environment.cpp | 14 ++-- src/msg/msg_gos.cpp | 2 +- src/msg/msg_host.cpp | 8 +-- src/msg/msg_io.cpp | 56 +++++++-------- src/msg/msg_process.cpp | 4 +- src/msg/msg_vm.cpp | 69 ++++++++++--------- src/plugins/vm/VirtualMachineImpl.cpp | 26 +++---- src/plugins/vm/s4u_VirtualMachine.cpp | 8 +-- src/s4u/s4u_actor.cpp | 22 +++--- src/s4u/s4u_comm.cpp | 2 +- src/s4u/s4u_engine.cpp | 21 +++--- src/s4u/s4u_file.cpp | 10 +-- src/s4u/s4u_host.cpp | 26 ++++--- src/s4u/s4u_mailbox.cpp | 6 +- src/s4u/s4u_netzone.cpp | 12 ++-- src/s4u/s4u_storage.cpp | 23 ++++--- src/simdag/sd_global.cpp | 2 +- src/simdag/sd_task.cpp | 2 +- src/simgrid/host.cpp | 28 ++++---- src/simix/ActorImpl.cpp | 16 ++--- src/simix/libsmx.cpp | 2 +- src/simix/smx_global.cpp | 6 +- src/simix/smx_host.cpp | 18 ++--- src/simix/smx_io.cpp | 12 ++-- src/simix/smx_network.cpp | 22 +++--- src/smpi/SmpiHost.cpp | 6 +- src/smpi/smpi_dvfs.cpp | 2 +- src/smpi/smpi_pmpi.cpp | 6 +- src/smpi/smpi_request.cpp | 9 +-- src/surf/HostImpl.cpp | 8 +-- src/surf/cpu_interface.cpp | 10 +-- src/surf/instr_routing.cpp | 26 +++---- src/surf/network_cm02.cpp | 6 +- src/surf/network_ib.cpp | 6 +- src/surf/network_ns3.cpp | 2 +- src/surf/plugins/host_energy.cpp | 43 ++++++------ src/surf/plugins/host_load.cpp | 4 +- src/surf/sg_platf.cpp | 20 +++--- src/surf/xml/surfxml_sax_cb.cpp | 4 +- teshsuite/s4u/actor/actor.cpp | 19 ++--- teshsuite/s4u/concurrent_rw/concurrent_rw.cpp | 2 +- teshsuite/s4u/pid/pid.cpp | 2 +- .../storage_client_server.cpp | 38 +++++----- teshsuite/simdag/flatifier/flatifier.cpp | 14 ++-- teshsuite/simdag/is-router/is-router.cpp | 4 +- 77 files changed, 462 insertions(+), 445 deletions(-) diff --git a/examples/s4u/actions-comm/s4u_actions-comm.cpp b/examples/s4u/actions-comm/s4u_actions-comm.cpp index 644f266cce..2779185680 100644 --- a/examples/s4u/actions-comm/s4u_actions-comm.cpp +++ b/examples/s4u/actions-comm/s4u_actions-comm.cpp @@ -61,9 +61,9 @@ public: double size = std::stod(action[3]); char* payload = xbt_strdup(action[3]); double clock = simgrid::s4u::Engine::getClock(); - simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::name() + "_" + action[2]); + simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getName() + "_" + action[2]); ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME, size, - simgrid::s4u::this_actor::name().c_str(), to->name()); + simgrid::s4u::this_actor::getName().c_str(), to->getName()); to->put(payload, size); xbt_free(payload); @@ -74,9 +74,10 @@ public: { double clock = simgrid::s4u::Engine::getClock(); simgrid::s4u::MailboxPtr from = - simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::name()); + simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::getName()); - ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME, simgrid::s4u::this_actor::name().c_str(), from->name()); + ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME, simgrid::s4u::this_actor::getName().c_str(), + from->getName()); from->get(); log_action(action, simgrid::s4u::Engine::getClock() - clock); } diff --git a/examples/s4u/actions-storage/s4u_actions-storage.cpp b/examples/s4u/actions-storage/s4u_actions-storage.cpp index 3b4858160a..85e71e13f6 100644 --- a/examples/s4u/actions-storage/s4u_actions-storage.cpp +++ b/examples/s4u/actions-storage/s4u_actions-storage.cpp @@ -31,7 +31,7 @@ static void log_action(const char* const* action, double date) static simgrid::s4u::File* get_file_descriptor(const char* file_name) { - std::string full_name = simgrid::s4u::this_actor::name() + ":" + file_name; + std::string full_name = simgrid::s4u::this_actor::getName() + ":" + file_name; return opened_files.at(full_name); } @@ -62,7 +62,7 @@ public: { const char* file_name = action[2]; double clock = simgrid::s4u::Engine::getClock(); - std::string full_name = simgrid::s4u::this_actor::name() + ":" + file_name; + std::string full_name = simgrid::s4u::this_actor::getName() + ":" + file_name; ACT_DEBUG("Entering Open: %s (filename: %s)", NAME, file_name); simgrid::s4u::File* file = new simgrid::s4u::File(file_name, NULL); diff --git a/examples/s4u/actor-create/s4u_actor-create.cpp b/examples/s4u/actor-create/s4u_actor-create.cpp index 171935ac95..0d72402b20 100644 --- a/examples/s4u/actor-create/s4u_actor-create.cpp +++ b/examples/s4u/actor-create/s4u_actor-create.cpp @@ -72,7 +72,7 @@ public: } void operator()() { - XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->name()); + XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->getName()); char* msg1 = static_cast(mailbox->get()); char* msg2 = static_cast(mailbox->get()); diff --git a/examples/s4u/actor-migration/s4u_actor-migration.cpp b/examples/s4u/actor-migration/s4u_actor-migration.cpp index f0fe008570..102843c2cd 100644 --- a/examples/s4u/actor-migration/s4u_actor-migration.cpp +++ b/examples/s4u/actor-migration/s4u_actor-migration.cpp @@ -36,7 +36,7 @@ static void emigrant() simgrid::s4u::this_actor::suspend(); - XBT_INFO("I've been moved on this new host: %s", simgrid::s4u::this_actor::host()->cname()); + XBT_INFO("I've been moved on this new host: %s", simgrid::s4u::this_actor::getHost()->getCname()); XBT_INFO("Uh, nothing to do here. Stopping now"); } diff --git a/examples/s4u/actor-suspend/s4u_actor-suspend.cpp b/examples/s4u/actor-suspend/s4u_actor-suspend.cpp index 0c59d04d45..9d98a4a83b 100644 --- a/examples/s4u/actor-suspend/s4u_actor-suspend.cpp +++ b/examples/s4u/actor-suspend/s4u_actor-suspend.cpp @@ -32,7 +32,7 @@ static void lazy_guy() static void dream_master() { XBT_INFO("Let's create a lazy guy."); /* - Create a lazy_guy process */ - simgrid::s4u::ActorPtr lazy = simgrid::s4u::Actor::createActor("Lazy", simgrid::s4u::this_actor::host(), lazy_guy); + simgrid::s4u::ActorPtr lazy = simgrid::s4u::Actor::createActor("Lazy", simgrid::s4u::this_actor::getHost(), lazy_guy); XBT_INFO("Let's wait a little bit..."); simgrid::s4u::this_actor::sleep_for(10); /* - Wait for 10 seconds */ XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!"); @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) e->loadPlatform(argv[1]); /* - Load the platform description */ std::vector list; - e->hostList(&list); + e->getHostList(&list); simgrid::s4u::Actor::createActor("dream_master", list.front(), dream_master); e->run(); /* - Run the simulation */ diff --git a/examples/s4u/app-masterworker/s4u_app-masterworker.cpp b/examples/s4u/app-masterworker/s4u_app-masterworker.cpp index 66c380f244..8e13fc5a76 100644 --- a/examples/s4u/app-masterworker/s4u_app-masterworker.cpp +++ b/examples/s4u/app-masterworker/s4u_app-masterworker.cpp @@ -38,7 +38,7 @@ public: if (number_of_tasks < 10000 || i % 10000 == 0) XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", (std::string("Task_") + std::to_string(i)).c_str(), - number_of_tasks, mailbox->name()); + number_of_tasks, mailbox->getName()); /* - Send the task to the @ref worker */ char* payload = bprintf("%f", comp_size); diff --git a/examples/s4u/app-token-ring/s4u_app-token-ring.cpp b/examples/s4u/app-token-ring/s4u_app-token-ring.cpp index a5fc1670a1..05fa90995a 100644 --- a/examples/s4u/app-token-ring/s4u_app-token-ring.cpp +++ b/examples/s4u/app-token-ring/s4u_app-token-ring.cpp @@ -23,10 +23,10 @@ public: void operator()() { - rank = xbt_str_parse_int(simgrid::s4u::this_actor::name().c_str(), + rank = xbt_str_parse_int(simgrid::s4u::this_actor::getName().c_str(), "Any process of this example must have a numerical name, not %s"); my_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(rank)); - if (rank + 1 == simgrid::s4u::Engine::instance()->hostCount()) + if (rank + 1 == simgrid::s4u::Engine::getInstance()->getHostCount()) /* The last process, which sends the token back to rank 0 */ neighbor_mailbox = simgrid::s4u::Mailbox::byName("0"); else @@ -35,7 +35,7 @@ public: if (rank == 0) { /* The root process (rank 0) first sends the token then waits to receive it back */ - XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->name()); + XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->getName()); neighbor_mailbox->put(xbt_strdup("Token"), task_comm_size); char* res = static_cast(my_mailbox->get()); XBT_INFO("Host \"%u\" received \"%s\"", rank, res); @@ -43,7 +43,7 @@ public: } else { char* res = static_cast(my_mailbox->get()); XBT_INFO("Host \"%u\" received \"%s\"", rank, res); - XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->name()); + XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->getName()); neighbor_mailbox->put(res, task_comm_size); } } @@ -55,10 +55,10 @@ int main(int argc, char** argv) xbt_assert(argc > 1, "Usage: %s platform.xml\n", argv[0]); e->loadPlatform(argv[1]); - XBT_INFO("Number of hosts '%zu'", e->hostCount()); + XBT_INFO("Number of hosts '%zu'", e->getHostCount()); int id = 0; std::vector list; - e->hostList(&list); + e->getHostList(&list); for (auto host : list) { /* - Give a unique rank to each host and create a @ref relay_runner process on each */ simgrid::s4u::Actor::createActor((std::to_string(id)).c_str(), host, RelayRunner()); diff --git a/examples/s4u/dht-chord/node.cpp b/examples/s4u/dht-chord/node.cpp index 79aef929aa..184c1e3910 100644 --- a/examples/s4u/dht-chord/node.cpp +++ b/examples/s4u/dht-chord/node.cpp @@ -47,7 +47,7 @@ Node::Node(std::vector args) // initialize my node id_ = std::stoi(args[1]); - stream = simgrid::s4u::this_actor::host()->extension()->getStream(); + stream = simgrid::s4u::this_actor::getHost()->extension()->getStream(); mailbox_ = simgrid::s4u::Mailbox::byName(std::to_string(id_)); next_finger_to_fix = 0; fingers_ = new int[nb_bits]; @@ -230,7 +230,7 @@ void Node::checkPredecessor() } // receive the answer XBT_DEBUG("Sent 'Predecessor Alive' request to %d, waiting for the answer on my mailbox '%s'", pred_id_, - message->answer_to->name()); + message->answer_to->getName()); simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data); try { @@ -275,7 +275,7 @@ int Node::remoteGetPredecessor(int ask_to) // receive the answer XBT_DEBUG("Sent 'Get Predecessor' request to %d, waiting for the answer on my mailbox '%s'", ask_to, - message->answer_to->name()); + message->answer_to->getName()); simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data); try { @@ -430,7 +430,8 @@ void Node::handleMessage(ChordMessage* message) message->type = FIND_SUCCESSOR_ANSWER; message->answer_id = fingers_[0]; XBT_DEBUG("Sending back a 'Find Successor Answer' to %s (mailbox %s): the successor of %d is %d", - message->issuer_host_name.c_str(), message->answer_to->name(), message->request_id, message->answer_id); + message->issuer_host_name.c_str(), message->answer_to->getName(), message->request_id, + message->answer_id); message->answer_to->put_init(message, 10)->detach(); } else { // otherwise, forward the request to the closest preceding finger in my table @@ -447,7 +448,7 @@ void Node::handleMessage(ChordMessage* message) message->type = GET_PREDECESSOR_ANSWER; message->answer_id = pred_id_; XBT_DEBUG("Sending back a 'Get Predecessor Answer' to %s via mailbox '%s': my predecessor is %d", - message->issuer_host_name.c_str(), message->answer_to->name(), message->answer_id); + message->issuer_host_name.c_str(), message->answer_to->getName(), message->answer_id); message->answer_to->put_init(message, 10)->detach(); break; @@ -484,8 +485,8 @@ void Node::handleMessage(ChordMessage* message) case PREDECESSOR_ALIVE: XBT_DEBUG("Receiving a 'Predecessor Alive' request from %s", message->issuer_host_name.c_str()); message->type = PREDECESSOR_ALIVE_ANSWER; - XBT_DEBUG("Sending back a 'Predecessor Alive Answer' to %s (mailbox %s)", - message->issuer_host_name.c_str(), message->answer_to->name()); + XBT_DEBUG("Sending back a 'Predecessor Alive Answer' to %s (mailbox %s)", message->issuer_host_name.c_str(), + message->answer_to->getName()); message->answer_to->put_init(message, 10)->detach(); break; diff --git a/examples/s4u/dht-chord/s4u_dht-chord.cpp b/examples/s4u/dht-chord/s4u_dht-chord.cpp index 2c5ed697a4..1a9db78bf2 100644 --- a/examples/s4u/dht-chord/s4u_dht-chord.cpp +++ b/examples/s4u/dht-chord/s4u_dht-chord.cpp @@ -29,7 +29,7 @@ static void chord_init() HostChord::EXTENSION_ID = simgrid::s4u::Host::extension_create(); std::vector list; - simgrid::s4u::Engine::instance()->hostList(&list); + simgrid::s4u::Engine::getInstance()->getHostList(&list); for (auto host : list) host->extension_set(new HostChord(host)); } diff --git a/examples/s4u/dht-chord/s4u_dht-chord.hpp b/examples/s4u/dht-chord/s4u_dht-chord.hpp index 77981dfa71..04f0c224e2 100644 --- a/examples/s4u/dht-chord/s4u_dht-chord.hpp +++ b/examples/s4u/dht-chord/s4u_dht-chord.hpp @@ -32,7 +32,7 @@ public: explicit HostChord(simgrid::s4u::Host* ptr) : host(ptr) { - std::string descr = std::string("RngSream<") + host->cname() + ">"; + std::string descr = std::string("RngSream<") + host->getCname() + ">"; stream_ = RngStream_CreateStream(descr.c_str()); } @@ -63,7 +63,8 @@ public: int answer_id = -1; // answer (used by some types of messages) simgrid::s4u::MailboxPtr answer_to; // mailbox to send an answer to (if any) - explicit ChordMessage(e_message_type_t type) : type(type), issuer_host_name(simgrid::s4u::this_actor::host()->name()) + explicit ChordMessage(e_message_type_t type) + : type(type), issuer_host_name(simgrid::s4u::this_actor::getHost()->getName()) { } diff --git a/examples/s4u/io/s4u_io.cpp b/examples/s4u/io/s4u_io.cpp index a09685da12..378f271419 100644 --- a/examples/s4u/io/s4u_io.cpp +++ b/examples/s4u/io/s4u_io.cpp @@ -13,25 +13,25 @@ class MyHost { public: void show_info(std::unordered_map const& mounts) { - XBT_INFO("Storage info on %s:", simgrid::s4u::Host::current()->cname()); + XBT_INFO("Storage info on %s:", simgrid::s4u::Host::current()->getCname()); for (const auto&kv : mounts) { const char* mountpoint = kv.first.c_str(); simgrid::s4u::Storage* storage = kv.second; // Retrieve disk's information - sg_size_t free_size = storage->sizeFree(); - sg_size_t used_size = storage->sizeUsed(); - sg_size_t size = storage->size(); + sg_size_t free_size = storage->getSizeFree(); + sg_size_t used_size = storage->getSizeUsed(); + sg_size_t size = storage->getSize(); - XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", storage->name(), mountpoint, used_size, free_size, + XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", storage->getName(), mountpoint, used_size, free_size, size); } } void operator()() { std::unordered_map const& mounts = - simgrid::s4u::Host::current()->mountedStorages(); + simgrid::s4u::Host::current()->getMountedStorages(); show_info(mounts); @@ -59,25 +59,25 @@ public: // Now rename file from ./tmp/data.txt to ./tmp/simgrid.readme const char *newpath = "/home/tmp/simgrid.readme"; - XBT_INFO("Move '%s' to '%s'", file->path(), newpath); + XBT_INFO("Move '%s' to '%s'", file->getPath(), newpath); file->move(newpath); // Test attaching some user data to the file file->setUserdata(xbt_strdup("777")); - XBT_INFO("User data attached to the file: %s", (char*)file->userdata()); - xbt_free(file->userdata()); + XBT_INFO("User data attached to the file: %s", (char*)file->getUserdata()); + xbt_free(file->getUserdata()); // Close the file delete file; // Now attach some user data to disk1 - XBT_INFO("Get/set data for storage element: %s", storage->name()); - XBT_INFO(" Uninitialized storage data: '%s'", (char*)storage->userdata()); + XBT_INFO("Get/set data for storage element: %s", storage->getName()); + XBT_INFO(" Uninitialized storage data: '%s'", (char*)storage->getUserdata()); storage->setUserdata(xbt_strdup("Some user data")); - XBT_INFO(" Set and get data: '%s'", (char*)storage->userdata()); + XBT_INFO(" Set and get data: '%s'", (char*)storage->getUserdata()); - xbt_free(storage->userdata()); + xbt_free(storage->getUserdata()); } }; diff --git a/examples/simdag/test/sd_test.cpp b/examples/simdag/test/sd_test.cpp index 0a698f8611..5ba0bc0dd0 100644 --- a/examples/simdag/test/sd_test.cpp +++ b/examples/simdag/test/sd_test.cpp @@ -34,10 +34,10 @@ int main(int argc, char **argv) double comp_amount2 = 1000000; double comm_amount12 = 2000000; double comm_amount21 = 3000000; - XBT_INFO("Computation time for %f flops on %s: %f", comp_amount1, h1->cname(), comp_amount1/h1->speed()); - XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, h2->cname(), comp_amount2/h2->speed()); + XBT_INFO("Computation time for %f flops on %s: %f", comp_amount1, h1->getCname(), comp_amount1 / h1->getSpeed()); + XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, h2->getCname(), comp_amount2 / h2->getSpeed()); - XBT_INFO("Route between %s and %s:", h1->cname(), h2->cname()); + XBT_INFO("Route between %s and %s:", h1->getCname(), h2->getCname()); std::vector route; double latency = 0; h1->routeTo(h2, &route, &latency); @@ -47,10 +47,10 @@ int main(int argc, char **argv) sg_link_bandwidth(link)); XBT_INFO("Route latency = %f, route bandwidth = %f", latency, sg_host_route_bandwidth(h1, h2)); - XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount12, h1->cname(), h2->cname(), - sg_host_route_latency(h1, h2) + comm_amount12 / sg_host_route_bandwidth(h1, h2)); - XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount21, h2->cname(), h1->cname(), - sg_host_route_latency(h2, h1) + comm_amount21 / sg_host_route_bandwidth(h2, h1)); + XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount12, h1->getCname(), h2->getCname(), + sg_host_route_latency(h1, h2) + comm_amount12 / sg_host_route_bandwidth(h1, h2)); + XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount21, h2->getCname(), h1->getCname(), + sg_host_route_latency(h2, h1) + comm_amount21 / sg_host_route_bandwidth(h2, h1)); /* creation of the tasks and their dependencies */ SD_task_t taskA = SD_task_create("Task A", NULL, 10.0); diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index eec45c1760..960118c128 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -198,19 +198,19 @@ public: void daemonize(); /** Retrieves the name of that actor as a C string */ - const char* cname(); + const char* getCname(); /** Retrieves the name of that actor as a C++ string */ - simgrid::xbt::string name(); + simgrid::xbt::string getName(); /** Retrieves the host on which that actor is running */ - s4u::Host* host(); + s4u::Host* getHost(); /** Retrieves the PID of that actor * * actor_id_t is an alias for unsigned long */ - aid_t pid(); + aid_t getPid(); /** Retrieves the PPID of that actor * * actor_id_t is an alias for unsigned long */ - aid_t ppid(); + aid_t getPpid(); /** Suspend an actor by suspending the task on which it was waiting for the completion. */ void suspend(); @@ -232,7 +232,7 @@ public: /** Sets the time at which that actor should be killed */ void setKillTime(double time); /** Retrieves the time at which that actor will be killed (or -1 if not set) */ - double killTime(); + double getKillTime(); void migrate(Host * new_host); @@ -267,7 +267,7 @@ public: simix::ActorImpl* getImpl(); /** Retrieve the property value (or nullptr if not set) */ - const char* property(const char* key); + const char* getProperty(const char* key); void setProperty(const char* key, const char* value); }; @@ -325,16 +325,16 @@ template inline void sleep_for(std::chrono::duration * whereTo); + size_t getHostCount(); + void getHostList(std::vector * whereTo); /** @brief Run the simulation */ void run(); @@ -66,17 +66,17 @@ public: static double getClock(); /** @brief Retrieve the engine singleton */ - static s4u::Engine* instance(); + static s4u::Engine* getInstance(); /** @brief Retrieve the root netzone, containing all others */ - simgrid::s4u::NetZone* netRoot(); + simgrid::s4u::NetZone* getNetRoot(); /** @brief Retrieve the netzone of the given name (or nullptr if not found) */ - simgrid::s4u::NetZone* netzoneByNameOrNull(const char* name); + simgrid::s4u::NetZone* getNetzoneByNameOrNull(const char* name); /** @brief Retrieve the netcard of the given name (or nullptr if not found) */ - simgrid::kernel::routing::NetPoint* netpointByNameOrNull(const char* name); - void netpointList(std::vector * list); + simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(const char* name); + void getNetpointList(std::vector * list); void netpointRegister(simgrid::kernel::routing::NetPoint * card); void netpointUnregister(simgrid::kernel::routing::NetPoint * card); diff --git a/include/simgrid/s4u/File.hpp b/include/simgrid/s4u/File.hpp index d6cd734f67..5c3dc743e9 100644 --- a/include/simgrid/s4u/File.hpp +++ b/include/simgrid/s4u/File.hpp @@ -30,7 +30,7 @@ public: ~File(); /** Retrieves the path to the file */ - const char* path() { return path_; } + const char* getPath() { return path_; } /** Simulates a read action. Returns the size of data actually read * @@ -46,7 +46,7 @@ public: /** Allows to store user data on that host */ void setUserdata(void* data) { userdata_ = data; } /** Retrieves the previously stored data */ - void* userdata() { return userdata_; } + void* getUserdata() { return userdata_; } /** Retrieve the datasize */ sg_size_t size(); diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index 31ecd57f3e..d43c985fcf 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -66,8 +66,8 @@ public: /** Retrieves the host on which the current actor is running */ static s4u::Host* current(); - simgrid::xbt::string const& name() const { return name_; } - const char* cname() { return name_.c_str(); } + simgrid::xbt::string const& getName() const { return name_; } + const char* getCname() { return name_.c_str(); } void actorList(std::vector * whereto); @@ -84,23 +84,23 @@ public: /** Returns if that host is currently down and offline */ bool isOff() { return not isOn(); } - double speed(); - int coreCount(); - xbt_dict_t properties(); - const char* property(const char* key); + double getSpeed(); + int getCoreCount(); + xbt_dict_t getProperties(); + const char* getProperty(const char* key); void setProperty(const char* key, const char* value); - void processes(std::vector * list); + void getProcesses(std::vector * list); double getPstateSpeed(int pstate_index); - int pstatesCount() const; + int getPstatesCount() const; void setPstate(int pstate_index); - int pstate(); - void attachedStorages(std::vector * storages); + int getPstate(); + void getAttachedStorages(std::vector * storages); /** Get an associative list [mount point]->[Storage] of all local mount points. * * This is defined in the platform file, and cannot be modified programatically (yet). */ - std::unordered_map const& mountedStorages(); + std::unordered_map const& getMountedStorages(); void routeTo(Host * dest, std::vector * links, double* latency); void routeTo(Host * dest, std::vector * links, double* latency); diff --git a/include/simgrid/s4u/Mailbox.hpp b/include/simgrid/s4u/Mailbox.hpp index 42e08f7bbd..f7797dd75b 100644 --- a/include/simgrid/s4u/Mailbox.hpp +++ b/include/simgrid/s4u/Mailbox.hpp @@ -121,7 +121,7 @@ public: kernel::activity::MailboxImpl* getImpl() { return pimpl_; } /** Gets the name of that mailbox */ - const char *name(); + const char* getName(); /** Retrieve the mailbox associated to the given C string */ static MailboxPtr byName(const char *name); @@ -147,7 +147,7 @@ public: void setReceiver(ActorPtr actor); /** Return the actor declared as permanent receiver, or nullptr if none **/ - ActorPtr receiver(); + ActorPtr getReceiver(); /** Creates (but don't start) an emission to that mailbox */ CommPtr put_init(); diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index fe9d878cbb..cb9d1ee3c9 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -44,17 +44,17 @@ protected: public: /** @brief Seal your netzone once you're done adding content, and before routing stuff through it */ virtual void seal(); - char* name(); - NetZone* father(); + char* getCname(); + NetZone* getFather(); - std::vector* children(); // Sub netzones - void hosts(std::vector * whereto); // retrieve my content as a vector of hosts + std::vector* getChildren(); // Sub netzones + void getHosts(std::vector * whereto); // retrieve my content as a vector of hosts /** Get the properties assigned to a host */ - std::unordered_map* properties(); + std::unordered_map* getProperties(); /** Retrieve the property value (or nullptr if not set) */ - const char* property(const char* key); + const char* getProperty(const char* key); void setProperty(const char* key, const char* value); /* Add content to the netzone, at parsing time. It should be sealed afterward. */ diff --git a/include/simgrid/s4u/Storage.hpp b/include/simgrid/s4u/Storage.hpp index f366c3a982..615e3e7588 100644 --- a/include/simgrid/s4u/Storage.hpp +++ b/include/simgrid/s4u/Storage.hpp @@ -29,21 +29,21 @@ public: virtual ~Storage() = default; /** Retrieve a Storage by its name. It must exist in the platform file */ static Storage* byName(const char* name); - const char* name(); - const char* type(); - Host* host(); - sg_size_t sizeFree(); - sg_size_t sizeUsed(); + const char* getName(); + const char* getType(); + Host* getHost(); + sg_size_t getSizeFree(); + sg_size_t getSizeUsed(); /** Retrieve the total amount of space of this storage element */ - sg_size_t size(); + sg_size_t getSize(); - xbt_dict_t properties(); - const char* property(const char* key); + xbt_dict_t getProperties(); + const char* getProperty(const char* key); void setProperty(const char* key, char* value); - std::map* content(); + std::map* getContent(); void setUserdata(void* data) { userdata_ = data; } - void* userdata() { return userdata_; } + void* getUserdata() { return userdata_; } /* The signals */ /** @brief Callback signal fired when a new Link is created */ diff --git a/include/simgrid/s4u/VirtualMachine.hpp b/include/simgrid/s4u/VirtualMachine.hpp index d9d3ba72a6..b5dbf216d7 100644 --- a/include/simgrid/s4u/VirtualMachine.hpp +++ b/include/simgrid/s4u/VirtualMachine.hpp @@ -47,10 +47,10 @@ private: public: bool isMigrating(); - void parameters(vm_params_t params); + void getParameters(vm_params_t params); void setParameters(vm_params_t params); double getRamsize(); - simgrid::s4u::Host* pm(); + simgrid::s4u::Host* getPm(); e_surf_vm_state_t getState(); diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index b73264969a..4f766198a6 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -285,7 +285,7 @@ static int java_main(int argc, char *argv[]) for (int i = 1; i < argc; i++) env->SetObjectArrayElement(args,i - 1, env->NewStringUTF(argv[i])); //Retrieve the host for the process. - jstring jhostName = env->NewStringUTF(MSG_host_self()->cname()); + jstring jhostName = env->NewStringUTF(MSG_host_self()->getCname()); jobject jhost = Java_org_simgrid_msg_Host_getByName(env, nullptr, jhostName); //creates the process jobject jprocess = env->NewObject(class_Process, constructor_Process, jhost, jname, args); diff --git a/src/bindings/java/jmsg_as.cpp b/src/bindings/java/jmsg_as.cpp index af1aa6fd08..cd344be661 100644 --- a/src/bindings/java/jmsg_as.cpp +++ b/src/bindings/java/jmsg_as.cpp @@ -58,7 +58,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_As_nativeInit(JNIEnv* env, jclass cl JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject jas) { simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas); - return env->NewStringUTF(as->name()); + return env->NewStringUTF(as->getCname()); } JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, jobject jas) { @@ -71,14 +71,14 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, job if (not cls) return nullptr; - jtable = env->NewObjectArray(static_cast(self_as->children()->size()), cls, nullptr); + jtable = env->NewObjectArray(static_cast(self_as->getChildren()->size()), cls, nullptr); if (not jtable) { jxbt_throw_jni(env, "Hosts table allocation failed"); return nullptr; } - for (auto tmp_as : *self_as->children()) { + for (auto tmp_as : *self_as->getChildren()) { jobject tmp_jas = jnetzone_new_instance(env); if (not tmp_jas) { jxbt_throw_jni(env, "java As instantiation failed"); @@ -130,7 +130,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo return nullptr; std::vector table; - as->hosts(&table); + as->getHosts(&table); jtable = env->NewObjectArray(static_cast(table.size()), cls, nullptr); @@ -143,11 +143,11 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo for (auto host : table) { jhost = static_cast(host->extension(JAVA_HOST_LEVEL)); if (not jhost) { - jname = env->NewStringUTF(host->cname()); + jname = env->NewStringUTF(host->getCname()); jhost = Java_org_simgrid_msg_Host_getByName(env, cls, jname); - env->ReleaseStringUTFChars(static_cast(jname), host->cname()); + env->ReleaseStringUTFChars(static_cast(jname), host->getCname()); } env->SetObjectArrayElement(jtable, index, jhost); diff --git a/src/bindings/java/jmsg_host.cpp b/src/bindings/java/jmsg_host.cpp index 3f41bfdc18..fc8db650c8 100644 --- a/src/bindings/java/jmsg_host.cpp +++ b/src/bindings/java/jmsg_host.cpp @@ -122,7 +122,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost(JNIEnv * env, jc return nullptr; } /* Sets the host name */ - jobject jname = env->NewStringUTF(host->cname()); + jobject jname = env->NewStringUTF(host->getCname()); env->SetObjectField(jhost, jhost_field_Host_name, jname); /* Bind & store it */ jhost_bind(jhost, host, env); @@ -319,7 +319,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_all(JNIEnv * env, jclas jobject jhost = static_cast(host->extension(JAVA_HOST_LEVEL)); if (not jhost) { - jstring jname = env->NewStringUTF(host->cname()); + jstring jname = env->NewStringUTF(host->getCname()); jhost = Java_org_simgrid_msg_Host_getByName(env, cls_arg, jname); } diff --git a/src/bindings/lua/lua_host.cpp b/src/bindings/lua/lua_host.cpp index 4d4eac910a..9220e67f21 100644 --- a/src/bindings/lua/lua_host.cpp +++ b/src/bindings/lua/lua_host.cpp @@ -77,7 +77,7 @@ static int l_host_get_by_name(lua_State * L) static int l_host_get_name(lua_State * L) { sg_host_t ht = sglua_check_host(L, 1); - lua_pushstring(L, ht->cname()); + lua_pushstring(L, ht->getCname()); return 1; } diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index c2b651568a..b5d980047f 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -66,11 +66,11 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe xbt_assert(newContainer->netpoint, "Element '%s' not found", name); break; case INSTR_ROUTER: - newContainer->netpoint = simgrid::s4u::Engine::instance()->netpointByNameOrNull(name); + newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name); xbt_assert(newContainer->netpoint, "Element '%s' not found", name); break; case INSTR_AS: - newContainer->netpoint = simgrid::s4u::Engine::instance()->netpointByNameOrNull(name); + newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name); xbt_assert(newContainer->netpoint, "Element '%s' not found", name); break; default: diff --git a/src/kernel/routing/NetPoint.cpp b/src/kernel/routing/NetPoint.cpp index 054b8b4e3b..3670c7099c 100644 --- a/src/kernel/routing/NetPoint.cpp +++ b/src/kernel/routing/NetPoint.cpp @@ -21,7 +21,7 @@ NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl* { if (netzone_p != nullptr) id_ = netzone_p->addComponent(this); - simgrid::s4u::Engine::instance()->netpointRegister(this); + simgrid::s4u::Engine::getInstance()->netpointRegister(this); simgrid::kernel::routing::NetPoint::onCreation(this); } } @@ -34,5 +34,5 @@ NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl* */ simgrid::kernel::routing::NetPoint* sg_netpoint_by_name_or_null(const char* name) { - return simgrid::s4u::Engine::instance()->netpointByNameOrNull(name); + return simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name); } diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index dc907922b4..2b4a84d6aa 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -28,7 +28,7 @@ public: NetZoneImpl::NetZoneImpl(NetZone* father, const char* name) : NetZone(father, name) { - xbt_assert(nullptr == simgrid::s4u::Engine::instance()->netpointByNameOrNull(name), + xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name), "Refusing to create a second NetZone called '%s'.", name); netpoint_ = new NetPoint(name, NetPoint::Type::NetZone, static_cast(father)); @@ -39,7 +39,7 @@ NetZoneImpl::~NetZoneImpl() for (auto& kv : bypassRoutes_) delete kv.second; - simgrid::s4u::Engine::instance()->netpointUnregister(netpoint_); + simgrid::s4u::Engine::getInstance()->netpointUnregister(netpoint_); } simgrid::s4u::Host* NetZoneImpl::createHost(const char* name, std::vector* speedPerPstate, int coreAmount, @@ -167,13 +167,13 @@ static void find_common_ancestors(NetPoint* src, NetPoint* dst, NetZoneImpl* current = src->netzone(); while (current != nullptr) { path_src.push_back(current); - current = static_cast(current->father()); + current = static_cast(current->getFather()); } std::vector path_dst; current = dst->netzone(); while (current != nullptr) { path_dst.push_back(current); - current = static_cast(current->father()); + current = static_cast(current->getFather()); } /* (3) find the common father. @@ -319,8 +319,8 @@ void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst, NetZoneImpl *src_ancestor; NetZoneImpl *dst_ancestor; find_common_ancestors(src, dst, &common_ancestor, &src_ancestor, &dst_ancestor); - XBT_DEBUG("elements_father: common ancestor '%s' src ancestor '%s' dst ancestor '%s'", common_ancestor->name(), - src_ancestor->name(), dst_ancestor->name()); + XBT_DEBUG("elements_father: common ancestor '%s' src ancestor '%s' dst ancestor '%s'", common_ancestor->getCname(), + src_ancestor->getCname(), dst_ancestor->getCname()); /* Check whether a direct bypass is defined. If so, use it and bail out */ if (common_ancestor->getBypassRoute(src, dst, links, latency)) diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index c8d4bae8a9..d947b4a2b4 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -165,11 +165,11 @@ void RoutedZone::getRouteCheckParams(NetPoint* src, NetPoint* dst) 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.", - src->cname(), src_as->name(), dst->cname(), dst_as->name()); + src->cname(), src_as->getCname(), dst->cname(), dst_as->getCname()); xbt_assert(this == dst_as, "Internal error: route destination %s@%s is not in netzone %s as expected (route source: " "%s@%s). Please report that bug.", - src->cname(), dst->cname(), src_as->name(), dst_as->name(), name()); + src->cname(), dst->cname(), src_as->getCname(), dst_as->getCname(), getCname()); } void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route) { diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index e2ec817fd7..ddc4b6d788 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -78,8 +78,8 @@ void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba if (src->isNetZone()) { std::string srcName = "router_" + src->name(); std::string dstName = "router_" + dst->name(); - route->gw_src = simgrid::s4u::Engine::instance()->netpointByNameOrNull(srcName.c_str()); - route->gw_dst = simgrid::s4u::Engine::instance()->netpointByNameOrNull(dstName.c_str()); + route->gw_src = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(srcName.c_str()); + route->gw_dst = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(dstName.c_str()); } /* Retrieve the private links */ diff --git a/src/mc/mc_smx.cpp b/src/mc/mc_smx.cpp index eaa7df96f4..0bcc7ea4ec 100644 --- a/src/mc/mc_smx.cpp +++ b/src/mc/mc_smx.cpp @@ -145,7 +145,7 @@ smx_actor_t MC_smx_simcall_get_issuer(s_smx_simcall_t const* req) const char* MC_smx_actor_get_host_name(smx_actor_t actor) { if (mc_model_checker == nullptr) - return actor->host->cname(); + return actor->host->getCname(); simgrid::mc::Process* process = &mc_model_checker->process(); @@ -165,7 +165,7 @@ const char* MC_smx_actor_get_host_name(smx_actor_t actor) ~fake_host() {} }; fake_host foo; - const size_t offset = (char*) &foo.host.name() - (char*) &foo.host; + const size_t offset = (char*)&foo.host.getName() - (char*)&foo.host; // Read the simgrid::xbt::string in the MCed process: simgrid::mc::ActorInformation* info = actor_info_cast(actor); diff --git a/src/msg/instr_msg_process.cpp b/src/msg/instr_msg_process.cpp index 9d695b55a1..21a13553d0 100644 --- a/src/msg/instr_msg_process.cpp +++ b/src/msg/instr_msg_process.cpp @@ -12,7 +12,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg_process, instr, "MSG process"); char *instr_process_id (msg_process_t proc, char *str, int len) { - return instr_process_id_2 (proc->cname(), proc->pid(), str, len); + return instr_process_id_2(proc->getCname(), proc->getPid(), str, len); } char *instr_process_id_2 (const char *process_name, int process_pid, char *str, int len) @@ -59,7 +59,7 @@ void TRACE_msg_process_create (const char *process_name, int process_pid, msg_ho int len = INSTR_DEFAULT_STR_SIZE; char str[INSTR_DEFAULT_STR_SIZE]; - container_t host_container = PJ_container_get(host->cname()); + container_t host_container = PJ_container_get(host->getCname()); PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container); } } @@ -82,7 +82,7 @@ void TRACE_msg_process_kill(smx_process_exit_status_t status, msg_process_t proc { if (TRACE_msg_process_is_enabled() && status==SMX_EXIT_FAILURE){ //kill means that this process no longer exists, let's destroy it - TRACE_msg_process_destroy(process->cname(), process->pid()); + TRACE_msg_process_destroy(process->getCname(), process->getPid()); } } diff --git a/src/msg/msg_environment.cpp b/src/msg/msg_environment.cpp index 1a62573380..1114b49594 100644 --- a/src/msg/msg_environment.cpp +++ b/src/msg/msg_environment.cpp @@ -38,29 +38,29 @@ void MSG_create_environment(const char *file) msg_netzone_t MSG_zone_get_root() { - return simgrid::s4u::Engine::instance()->netRoot(); + return simgrid::s4u::Engine::getInstance()->getNetRoot(); } const char* MSG_zone_get_name(msg_netzone_t netzone) { - return netzone->name(); + return netzone->getCname(); } msg_netzone_t MSG_zone_get_by_name(const char* name) { - return simgrid::s4u::Engine::instance()->netzoneByNameOrNull(name); + return simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(name); } void MSG_zone_get_sons(msg_netzone_t netzone, xbt_dict_t whereto) { - for (auto elem : *netzone->children()) { - xbt_dict_set(whereto, elem->name(), static_cast(elem), nullptr); + for (auto elem : *netzone->getChildren()) { + xbt_dict_set(whereto, elem->getCname(), static_cast(elem), nullptr); } } const char* MSG_zone_get_property_value(msg_netzone_t netzone, const char* name) { - return netzone->property(name); + return netzone->getProperty(name); } void MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value) @@ -72,7 +72,7 @@ void MSG_zone_get_hosts(msg_netzone_t netzone, xbt_dynar_t whereto) { /* converts vector to dynar */ std::vector hosts; - netzone->hosts(&hosts); + netzone->getHosts(&hosts); for (auto host : hosts) xbt_dynar_push(whereto, &host); } diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index bb023aae53..53ea92dd47 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -270,7 +270,7 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, d /* Try to receive it by calling SIMIX network layer */ try { simcall_comm_recv(MSG_process_self()->getImpl(), mailbox->getImpl(), task, nullptr, nullptr, nullptr, nullptr, timeout, rate); - XBT_DEBUG("Got task %s from %s",(*task)->name,mailbox->name()); + XBT_DEBUG("Got task %s from %s", (*task)->name, mailbox->getName()); (*task)->simdata->setNotUsed(); } catch (xbt_ex& e) { diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index 407e5a283e..285d76a06e 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -115,7 +115,7 @@ xbt_dynar_t MSG_hosts_as_dynar() { * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine. */ double MSG_host_get_speed(msg_host_t host) { - return host->speed(); + return host->getSpeed(); } /** \ingroup m_host_management @@ -134,7 +134,7 @@ double MSG_get_host_speed(msg_host_t host) { * \return the number of cores */ int MSG_host_get_core_number(msg_host_t host) { - return host->coreCount(); + return host->getCoreCount(); } /** \ingroup m_host_management @@ -174,7 +174,7 @@ const char *MSG_host_get_property_value(msg_host_t host, const char *name) xbt_dict_t MSG_host_get_properties(msg_host_t host) { xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)"); - return host->properties(); + return host->getProperties(); } /** \ingroup m_host_management @@ -264,7 +264,7 @@ xbt_dict_t MSG_host_get_storage_content(msg_host_t host) { xbt_assert((host != nullptr), "Invalid parameters"); xbt_dict_t contents = xbt_dict_new_homogeneous(nullptr); - for (auto elm : host->mountedStorages()) + for (auto elm : host->getMountedStorages()) xbt_dict_set(contents, elm.first.c_str(), MSG_storage_get_content(elm.second), nullptr); return contents; diff --git a/src/msg/msg_io.cpp b/src/msg/msg_io.cpp index 031d2dda4e..2c0b61bf3c 100644 --- a/src/msg/msg_io.cpp +++ b/src/msg/msg_io.cpp @@ -57,7 +57,7 @@ msg_error_t MSG_file_set_data(msg_file_t fd, void *data) */ void* MSG_file_get_data(msg_file_t fd) { - return fd->userdata(); + return fd->getUserdata(); } /** \ingroup msg_file @@ -73,7 +73,7 @@ void MSG_file_dump (msg_file_t fd){ "\t\tStorage Id: '%s'\n" "\t\tStorage Type: '%s'\n" "\t\tFile Descriptor Id: %d", - fd->path(), fd->size(), fd->mount_point.c_str(), fd->storageId, fd->storage_type, fd->desc_id); + fd->getPath(), fd->size(), fd->mount_point.c_str(), fd->storageId, fd->storage_type, fd->desc_id); } /** \ingroup msg_file @@ -92,12 +92,12 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size) /* Find the host where the file is physically located and read it */ msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId); - msg_host_t attached_host = storage_src->host(); + msg_host_t attached_host = storage_src->getHost(); read_size = fd->read(size); // TODO re-add attached_host; - if (strcmp(attached_host->cname(), MSG_host_self()->cname())) { + if (strcmp(attached_host->getCname(), MSG_host_self()->getCname())) { /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */ - XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->cname(), read_size); + XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->getCname(), read_size); msg_host_t m_host_list[] = {MSG_host_self(), attached_host}; double flops_amount[] = {0, 0}; double bytes_amount[] = {0, 0, static_cast(read_size), 0}; @@ -109,7 +109,7 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size) if(transfer != MSG_OK){ if (transfer == MSG_HOST_FAILURE) - XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->cname()); + XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->getCname()); if (transfer == MSG_TASK_CANCELED) XBT_WARN("Transfer error, task has been canceled!"); @@ -133,11 +133,11 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) /* Find the host where the file is physically located (remote or local)*/ msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId); - msg_host_t attached_host = storage_src->host(); + msg_host_t attached_host = storage_src->getHost(); - if (strcmp(attached_host->cname(), MSG_host_self()->cname())) { + if (strcmp(attached_host->getCname(), MSG_host_self()->getCname())) { /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */ - XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->cname(), size); + XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->getCname(), size); msg_host_t m_host_list[] = {MSG_host_self(), attached_host}; double flops_amount[] = {0, 0}; double bytes_amount[] = {0, static_cast(size), 0, 0}; @@ -149,7 +149,7 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) if(transfer != MSG_OK){ if (transfer == MSG_HOST_FAILURE) - XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->cname()); + XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->getCname()); if (transfer == MSG_TASK_CANCELED) XBT_WARN("Transfer error, task has been canceled!"); @@ -202,7 +202,7 @@ msg_error_t MSG_file_unlink(msg_file_t fd) { /* Find the host where the file is physically located (remote or local)*/ msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId); - msg_host_t attached_host = storage_src->host(); + msg_host_t attached_host = storage_src->getHost(); fd->unlink(attached_host); delete fd; return MSG_OK; @@ -252,7 +252,7 @@ sg_size_t MSG_file_tell(msg_file_t fd) const char *MSG_file_get_name(msg_file_t fd) { xbt_assert((fd != nullptr), "Invalid parameters"); - return fd->path(); + return fd->getPath(); } /** @@ -278,7 +278,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa { /* Find the host where the file is physically located and read it */ msg_storage_t storage_src = simgrid::s4u::Storage::byName(file->storageId); - msg_host_t src_host = storage_src->host(); + msg_host_t src_host = storage_src->getHost(); MSG_file_seek(file, 0, SEEK_SET); sg_size_t read_size = file->read(file->size()); @@ -287,7 +287,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa msg_host_t dst_host; size_t longest_prefix_length = 0; - for (auto elm : host->mountedStorages()) { + for (auto elm : host->getMountedStorages()) { std::string mount_point = std::string(fullpath).substr(0, elm.first.size()); if (mount_point == elm.first && elm.first.length() > longest_prefix_length) { /* The current mount name is found in the full path and is bigger than the previous*/ @@ -298,14 +298,14 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa if (storage_dest != nullptr) { /* Mount point found, retrieve the host the storage is attached to */ - dst_host = storage_dest->host(); + dst_host = storage_dest->getHost(); }else{ - XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->cname()); + XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->getCname()); return MSG_TASK_CANCELED; } - XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, src_host->cname(), - storage_dest->host()->cname()); + XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, src_host->getCname(), + storage_dest->getHost()->getCname()); msg_host_t m_host_list[] = {src_host, dst_host}; double flops_amount[] = {0, 0}; double bytes_amount[] = {0, static_cast(read_size), 0, 0}; @@ -317,7 +317,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa if (err != MSG_OK) { if (err == MSG_HOST_FAILURE) - XBT_WARN("Transfer error, %s remote host just turned off!", storage_dest->host()->cname()); + XBT_WARN("Transfer error, %s remote host just turned off!", storage_dest->getHost()->getCname()); if (err == MSG_TASK_CANCELED) XBT_WARN("Transfer error, task has been canceled!"); @@ -360,7 +360,7 @@ msg_error_t MSG_file_rmove (msg_file_t file, msg_host_t host, const char* fullpa const char* MSG_storage_get_name(msg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters"); - return storage->name(); + return storage->getName(); } /** \ingroup msg_storage_management @@ -370,7 +370,7 @@ const char* MSG_storage_get_name(msg_storage_t storage) */ sg_size_t MSG_storage_get_free_size(msg_storage_t storage) { - return storage->sizeFree(); + return storage->getSizeFree(); } /** \ingroup msg_storage_management @@ -380,7 +380,7 @@ sg_size_t MSG_storage_get_free_size(msg_storage_t storage) */ sg_size_t MSG_storage_get_used_size(msg_storage_t storage) { - return storage->sizeUsed(); + return storage->getSizeUsed(); } /** \ingroup msg_storage_management @@ -391,7 +391,7 @@ sg_size_t MSG_storage_get_used_size(msg_storage_t storage) xbt_dict_t MSG_storage_get_properties(msg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters (storage is nullptr)"); - return storage->properties(); + return storage->getProperties(); } /** \ingroup msg_storage_management @@ -415,7 +415,7 @@ void MSG_storage_set_property_value(msg_storage_t storage, const char* name, cha */ const char *MSG_storage_get_property_value(msg_storage_t storage, const char *name) { - return storage->property(name); + return storage->getProperty(name); } /** \ingroup msg_storage_management @@ -461,7 +461,7 @@ msg_error_t MSG_storage_set_data(msg_storage_t storage, void *data) void *MSG_storage_get_data(msg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters"); - return storage->userdata(); + return storage->getUserdata(); } /** \ingroup msg_storage_management @@ -472,7 +472,7 @@ void *MSG_storage_get_data(msg_storage_t storage) */ xbt_dict_t MSG_storage_get_content(msg_storage_t storage) { - std::map* content = storage->content(); + std::map* content = storage->getContent(); xbt_dict_t content_dict = xbt_dict_new_homogeneous(&free); for (auto entry : *content) { @@ -491,7 +491,7 @@ xbt_dict_t MSG_storage_get_content(msg_storage_t storage) */ sg_size_t MSG_storage_get_size(msg_storage_t storage) { - return storage->size(); + return storage->getSize(); } /** \ingroup msg_storage_management @@ -503,7 +503,7 @@ sg_size_t MSG_storage_get_size(msg_storage_t storage) const char* MSG_storage_get_host(msg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters"); - return storage->host()->cname(); + return storage->getHost()->getCname(); } SG_END_DECL() diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index 24ae88250f..14d00971f0 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -164,7 +164,7 @@ msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host, /* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */ smx_actor_t process = - SIMIX_process_attach(name, new simgrid::msg::ActorExt(data), host->cname(), properties, nullptr); + SIMIX_process_attach(name, new simgrid::msg::ActorExt(data), host->getCname(), properties, nullptr); if (not process) xbt_die("Could not attach"); simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process); @@ -343,7 +343,7 @@ int MSG_process_get_PPID(msg_process_t process) */ const char *MSG_process_get_name(msg_process_t process) { - return process->cname(); + return process->getCname(); } /** \ingroup m_process_management diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 4f725e7084..cc2d536718 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -52,7 +52,7 @@ void MSG_vm_set_params(msg_vm_t vm, vm_params_t params) */ void MSG_vm_get_params(msg_vm_t vm, vm_params_t params) { - static_cast(vm)->parameters(params); + static_cast(vm)->getParameters(params); } /* **** Check state of a VM **** */ @@ -158,7 +158,7 @@ msg_vm_t MSG_vm_create_multicore(msg_host_t pm, const char* name, int coreAmount void MSG_vm_destroy(msg_vm_t vm) { if (MSG_vm_is_migrating(vm)) - THROWF(vm_error, 0, "Cannot destroy VM '%s', which is migrating.", vm->cname()); + THROWF(vm_error, 0, "Cannot destroy VM '%s', which is migrating.", vm->getCname()); /* First, terminate all processes on the VM if necessary */ if (MSG_vm_is_running(vm)) @@ -170,7 +170,7 @@ void MSG_vm_destroy(msg_vm_t vm) }); if (TRACE_msg_vm_is_enabled()) { - container_t container = PJ_container_get(vm->cname()); + container_t container = PJ_container_get(vm->getCname()); PJ_container_remove_from_parent(container); PJ_container_free(container); } @@ -204,8 +204,8 @@ void MSG_vm_start(msg_vm_t vm) if (vm_ramsize > pm_ramsize - total_ramsize_of_vms) { XBT_WARN("cannnot start %s@%s due to memory shortage: vm_ramsize %ld, free %ld, pm_ramsize %ld (bytes).", - vm->cname(), pm->cname(), vm_ramsize, pm_ramsize - total_ramsize_of_vms, pm_ramsize); - THROWF(vm_error, 0, "Memory shortage on host '%s', VM '%s' cannot be started", pm->cname(), vm->cname()); + vm->getCname(), pm->getCname(), vm_ramsize, pm_ramsize - total_ramsize_of_vms, pm_ramsize); + THROWF(vm_error, 0, "Memory shortage on host '%s', VM '%s' cannot be started", pm->getCname(), vm->getCname()); } } @@ -213,7 +213,7 @@ void MSG_vm_start(msg_vm_t vm) }); if (TRACE_msg_vm_is_enabled()) { - container_t vm_container = PJ_container_get(vm->cname()); + container_t vm_container = PJ_container_get(vm->getCname()); type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type); val_t value = PJ_value_get_or_new("start", "0 0 1", type); // start is blue new PushStateEvent(MSG_get_clock(), vm_container, type, value); @@ -241,17 +241,17 @@ void MSG_vm_shutdown(msg_vm_t vm) static inline char *get_mig_process_tx_name(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm) { - return bprintf("__pr_mig_tx:%s(%s-%s)", vm->cname(), src_pm->cname(), dst_pm->cname()); + return bprintf("__pr_mig_tx:%s(%s-%s)", vm->getCname(), src_pm->getCname(), dst_pm->getCname()); } static inline char *get_mig_process_rx_name(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm) { - return bprintf("__pr_mig_rx:%s(%s-%s)", vm->cname(), src_pm->cname(), dst_pm->cname()); + return bprintf("__pr_mig_rx:%s(%s-%s)", vm->getCname(), src_pm->getCname(), dst_pm->getCname()); } static inline char *get_mig_task_name(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm, int stage) { - return bprintf("__task_mig_stage%d:%s(%s-%s)", stage, vm->cname(), src_pm->cname(), dst_pm->cname()); + return bprintf("__task_mig_stage%d:%s(%s-%s)", stage, vm->getCname(), src_pm->getCname(), dst_pm->getCname()); } struct migration_session { @@ -317,7 +317,7 @@ static int migration_rx_fun(int argc, char *argv[]) // Now the VM is running on the new host (the migration is completed) (even if the SRC crash) vm->pimpl_vm_->isMigrating = false; - XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", ms->vm->cname(), ms->src_pm->cname(), ms->dst_pm->cname()); + XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", ms->vm->getCname(), ms->src_pm->getCname(), ms->dst_pm->getCname()); if (TRACE_msg_vm_is_enabled()) { static long long int counter = 0; @@ -326,20 +326,20 @@ static int migration_rx_fun(int argc, char *argv[]) counter++; // start link - container_t msg = PJ_container_get(vm->cname()); + container_t msg = PJ_container_get(vm->getCname()); type_t type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root()); new StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); // destroy existing container of this vm - container_t existing_container = PJ_container_get(vm->cname()); + container_t existing_container = PJ_container_get(vm->getCname()); PJ_container_remove_from_parent(existing_container); PJ_container_free(existing_container); // create new container on the new_host location - PJ_container_new(vm->cname(), INSTR_MSG_VM, PJ_container_get(ms->dst_pm->cname())); + PJ_container_new(vm->getCname(), INSTR_MSG_VM, PJ_container_get(ms->dst_pm->getCname())); // end link - msg = PJ_container_get(vm->cname()); + msg = PJ_container_get(vm->getCname()); type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root()); new EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); } @@ -394,7 +394,7 @@ static double get_computed(char *key, msg_vm_t vm, dirty_page_t dp, double remai double computed = dp->prev_remaining - remaining; double duration = clock - dp->prev_clock; - XBT_DEBUG("%s@%s: computed %f ops (remaining %f -> %f) in %f secs (%f -> %f)", key, vm->cname(), computed, + XBT_DEBUG("%s@%s: computed %f ops (remaining %f -> %f) in %f secs (%f -> %f)", key, vm->getCname(), computed, dp->prev_remaining, remaining, duration, dp->prev_clock, clock); return computed; @@ -453,7 +453,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task) pimpl->dp_objs = xbt_dict_new_homogeneous(nullptr); xbt_assert(xbt_dict_get_or_null(pimpl->dp_objs, key) == nullptr); xbt_dict_set(pimpl->dp_objs, key, dp, nullptr); - XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, host->cname(), remaining, pimpl->dp_enabled); + XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, host->getCname(), remaining, pimpl->dp_enabled); xbt_free(key); } @@ -483,7 +483,7 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task) xbt_dict_remove(pimpl->dp_objs, key); xbt_free(dp); - XBT_DEBUG("del %s on %s", key, host->cname()); + XBT_DEBUG("del %s on %s", key, host->getCname()); xbt_free(key); } @@ -514,13 +514,13 @@ static sg_size_t send_migration_data(msg_vm_t vm, msg_host_t src_pm, msg_host_t /* FIXME: why try-and-catch is used here? */ if(ret == MSG_HOST_FAILURE){ - XBT_DEBUG("SRC host failed during migration of %s (stage %d)", vm->cname(), stage); + XBT_DEBUG("SRC host failed during migration of %s (stage %d)", vm->getCname(), stage); MSG_task_destroy(task); - THROWF(host_error, 0, "SRC host failed during migration of %s (stage %d)", vm->cname(), stage); + THROWF(host_error, 0, "SRC host failed during migration of %s (stage %d)", vm->getCname(), stage); }else if(ret == MSG_TRANSFER_FAILURE){ - XBT_DEBUG("DST host failed during migration of %s (stage %d)", vm->cname(), stage); + XBT_DEBUG("DST host failed during migration of %s (stage %d)", vm->getCname(), stage); MSG_task_destroy(task); - THROWF(host_error, 0, "DST host failed during migration of %s (stage %d)", vm->cname(), stage); + THROWF(host_error, 0, "DST host failed during migration of %s (stage %d)", vm->getCname(), stage); } double clock_end = MSG_get_clock(); @@ -559,7 +559,7 @@ static int migration_tx_fun(int argc, char *argv[]) double host_speed = MSG_host_get_speed(MSG_vm_get_pm(ms->vm)); s_vm_params_t params; - static_cast(ms->vm)->parameters(¶ms); + static_cast(ms->vm)->getParameters(¶ms); const sg_size_t ramsize = params.ramsize; const sg_size_t devsize = params.devsize; const int skip_stage1 = params.skip_stage1; @@ -746,13 +746,13 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t dst_pm) msg_host_t src_pm = pimpl->getPm(); if (src_pm->isOff()) - THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->cname(), src_pm->cname()); + THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->getCname(), src_pm->getCname()); if (dst_pm->isOff()) - THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->cname(), dst_pm->cname()); + THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->getCname(), dst_pm->getCname()); if (not MSG_vm_is_running(vm)) - THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->cname()); + THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->getCname()); if (typedVm->isMigrating()) - THROWF(vm_error, 0, "Cannot migrate VM '%s' that is already migrating.", vm->cname()); + THROWF(vm_error, 0, "Cannot migrate VM '%s' that is already migrating.", vm->getCname()); pimpl->isMigrating = true; @@ -763,8 +763,8 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t dst_pm) /* We have two mailboxes. mbox is used to transfer migration data between source and destination PMs. mbox_ctl is used * to detect the completion of a migration. The names of these mailboxes must not conflict with others. */ - ms->mbox_ctl = bprintf("__mbox_mig_ctl:%s(%s-%s)", vm->cname(), src_pm->cname(), dst_pm->cname()); - ms->mbox = bprintf("__mbox_mig_src_dst:%s(%s-%s)", vm->cname(), src_pm->cname(), dst_pm->cname()); + ms->mbox_ctl = bprintf("__mbox_mig_ctl:%s(%s-%s)", vm->getCname(), src_pm->getCname(), dst_pm->getCname()); + ms->mbox = bprintf("__mbox_mig_src_dst:%s(%s-%s)", vm->getCname(), src_pm->getCname(), dst_pm->getCname()); char *pr_rx_name = get_mig_process_rx_name(vm, src_pm, dst_pm); char *pr_tx_name = get_mig_process_tx_name(vm, src_pm, dst_pm); @@ -796,12 +796,13 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t dst_pm) XBT_ERROR("SRC crashes, throw an exception (m-control)"); // MSG_process_kill(tx_process); // Adrien, I made a merge on Nov 28th 2014, I'm not sure whether this line is // required or not - THROWF(host_error, 0, "Source host '%s' failed during the migration of VM '%s'.", src_pm->cname(), vm->cname()); + THROWF(host_error, 0, "Source host '%s' failed during the migration of VM '%s'.", src_pm->getCname(), + vm->getCname()); } else if ((ret == MSG_TRANSFER_FAILURE) || (ret == MSG_TIMEOUT)) { // MSG_TIMEOUT here means that MSG_host_is_avail() returned false. XBT_ERROR("DST crashes, throw an exception (m-control)"); - THROWF(host_error, 0, "Destination host '%s' failed during the migration of VM '%s'.", dst_pm->cname(), - vm->cname()); + THROWF(host_error, 0, "Destination host '%s' failed during the migration of VM '%s'.", dst_pm->getCname(), + vm->getCname()); } char* expected_task_name = get_mig_task_name(vm, src_pm, dst_pm, 4); @@ -828,7 +829,7 @@ void MSG_vm_suspend(msg_vm_t vm) XBT_DEBUG("vm_suspend done"); if (TRACE_msg_vm_is_enabled()) { - container_t vm_container = PJ_container_get(vm->cname()); + container_t vm_container = PJ_container_get(vm->getCname()); type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type); val_t value = PJ_value_get_or_new("suspend", "1 0 0", type); // suspend is red new PushStateEvent(MSG_get_clock(), vm_container, type, value); @@ -845,7 +846,7 @@ void MSG_vm_resume(msg_vm_t vm) static_cast(vm)->pimpl_vm_->resume(); if (TRACE_msg_vm_is_enabled()) { - container_t vm_container = PJ_container_get(vm->cname()); + container_t vm_container = PJ_container_get(vm->getCname()); type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type); new PopStateEvent(MSG_get_clock(), vm_container, type); } @@ -856,7 +857,7 @@ void MSG_vm_resume(msg_vm_t vm) */ msg_host_t MSG_vm_get_pm(msg_vm_t vm) { - return static_cast(vm)->pm(); + return static_cast(vm)->getPm(); } /** @brief Set a CPU bound for a given VM. diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index ec2c1466c6..304a07f0d5 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -77,7 +77,7 @@ double VMModel::nextOccuringEvent(double now) double solved_value = ws_vm->pimpl_vm_->action_->getVariable() ->value; // this is X1 in comment above, what this VM got in the sharing on the PM - XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->cname(), ws_vm->pimpl_vm_->getPm()->cname()); + XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->getCname(), ws_vm->pimpl_vm_->getPm()->getCname()); // TODO: check lmm_update_constraint_bound() works fine instead of the below manual substitution. // cpu_cas01->constraint->bound = solved_value; @@ -111,7 +111,7 @@ VirtualMachineImpl::VirtualMachineImpl(simgrid::s4u::VirtualMachine* piface, sim /* Initialize the VM parameters */ params_.ramsize = 0; - XBT_VERB("Create VM(%s)@PM(%s)", piface->cname(), hostPM_->cname()); + XBT_VERB("Create VM(%s)@PM(%s)", piface->getCname(), hostPM_->getCname()); } extern "C" int @@ -159,14 +159,14 @@ void VirtualMachineImpl::setState(e_surf_vm_state_t state) void VirtualMachineImpl::suspend(smx_actor_t issuer) { if (isMigrating) - THROWF(vm_error, 0, "Cannot suspend VM '%s': it is migrating", piface_->cname()); + THROWF(vm_error, 0, "Cannot suspend VM '%s': it is migrating", piface_->getCname()); if (getState() != SURF_VM_STATE_RUNNING) - THROWF(vm_error, 0, "Cannot suspend VM %s: it is not running.", piface_->cname()); + THROWF(vm_error, 0, "Cannot suspend VM %s: it is not running.", piface_->getCname()); if (issuer->host == piface_) - THROWF(vm_error, 0, "Actor %s cannot suspend the VM %s in which it runs", issuer->cname(), piface_->cname()); + THROWF(vm_error, 0, "Actor %s cannot suspend the VM %s in which it runs", issuer->cname(), piface_->getCname()); xbt_swag_t process_list = piface_->extension()->process_list; - XBT_DEBUG("suspend VM(%s), where %d processes exist", piface_->cname(), xbt_swag_size(process_list)); + XBT_DEBUG("suspend VM(%s), where %d processes exist", piface_->getCname(), xbt_swag_size(process_list)); action_->suspend(); @@ -185,10 +185,10 @@ void VirtualMachineImpl::suspend(smx_actor_t issuer) void VirtualMachineImpl::resume() { if (getState() != SURF_VM_STATE_SUSPENDED) - THROWF(vm_error, 0, "Cannot resume VM %s: it was not suspended", piface_->cname()); + THROWF(vm_error, 0, "Cannot resume VM %s: it was not suspended", piface_->getCname()); xbt_swag_t process_list = piface_->extension()->process_list; - XBT_DEBUG("Resume VM %s, containing %d processes.", piface_->cname(), xbt_swag_size(process_list)); + XBT_DEBUG("Resume VM %s, containing %d processes.", piface_->getCname(), xbt_swag_size(process_list)); action_->resume(); @@ -227,11 +227,11 @@ void VirtualMachineImpl::shutdown(smx_actor_t issuer) THROW_IMPOSSIBLE; break; } - XBT_VERB("Shuting down the VM %s even if it's not running but %s", piface_->cname(), stateName); + XBT_VERB("Shuting down the VM %s even if it's not running but %s", piface_->getCname(), stateName); } xbt_swag_t process_list = piface_->extension()->process_list; - XBT_DEBUG("shutdown VM %s, that contains %d processes", piface_->cname(), xbt_swag_size(process_list)); + XBT_DEBUG("shutdown VM %s, that contains %d processes", piface_->getCname(), xbt_swag_size(process_list)); smx_actor_t smx_process; smx_actor_t smx_process_safe; @@ -257,9 +257,9 @@ s4u::Host* VirtualMachineImpl::getPm() */ void VirtualMachineImpl::setPm(s4u::Host* destination) { - const char* vm_name = piface_->cname(); - const char* pm_name_src = hostPM_->cname(); - const char* pm_name_dst = destination->cname(); + const char* vm_name = piface_->getCname(); + const char* pm_name_src = hostPM_->getCname(); + const char* pm_name_dst = destination->getCname(); /* update net_elm with that of the destination physical host */ piface_->pimpl_netpoint = destination->pimpl_netpoint; diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index ebae51c755..c874d48283 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -31,7 +31,7 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm, int coreAmount) extension_set(new simgrid::simix::Host()); if (TRACE_msg_vm_is_enabled()) { - container_t host_container = PJ_container_get(pm->cname()); + container_t host_container = PJ_container_get(pm->getCname()); PJ_container_new(name, INSTR_MSG_VM, host_container); } } @@ -40,7 +40,7 @@ VirtualMachine::~VirtualMachine() { onDestruction(*this); - XBT_DEBUG("destroy %s", cname()); + XBT_DEBUG("destroy %s", getCname()); /* FIXME: this is really strange that everything fails if the next line is removed. * This is as if we shared these data with the PM, which definitely should not be the case... @@ -62,7 +62,7 @@ double VirtualMachine::getRamsize() { return pimpl_vm_->params_.ramsize; } -simgrid::s4u::Host* VirtualMachine::pm() +simgrid::s4u::Host* VirtualMachine::getPm() { return pimpl_vm_->getPm(); } @@ -73,7 +73,7 @@ e_surf_vm_state_t VirtualMachine::getState() /** @brief Retrieve a copy of the parameters of that VM/PM * @details The ramsize and overcommit fields are used on the PM too */ -void VirtualMachine::parameters(vm_params_t params) +void VirtualMachine::getParameters(vm_params_t params) { pimpl_vm_->getParams(params); } diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 81d3323e0e..b8c5c27a66 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -75,7 +75,7 @@ void Actor::migrate(Host* new_host) simgrid::simix::kernelImmediate([this, new_host]() { pimpl_->new_host = new_host; }); } -s4u::Host* Actor::host() +s4u::Host* Actor::getHost() { return this->pimpl_->host; } @@ -85,22 +85,22 @@ void Actor::daemonize() simgrid::simix::kernelImmediate([this]() { pimpl_->daemonize(); }); } -const char* Actor::cname() +const char* Actor::getCname() { return this->pimpl_->name.c_str(); } -simgrid::xbt::string Actor::name() +simgrid::xbt::string Actor::getName() { return this->pimpl_->name; } -aid_t Actor::pid() +aid_t Actor::getPid() { return this->pimpl_->pid; } -aid_t Actor::ppid() +aid_t Actor::getPpid() { return this->pimpl_->ppid; } @@ -125,7 +125,7 @@ void Actor::setKillTime(double time) { } /** \brief Get the kill time of an actor(or 0 if unset). */ -double Actor::killTime() +double Actor::getKillTime() { return SIMIX_timer_get_date(pimpl_->kill_timer); } @@ -172,7 +172,7 @@ void Actor::killAll(int resetPid) } /** Retrieve the property value (or nullptr if not set) */ -const char* Actor::property(const char* key) +const char* Actor::getProperty(const char* key) { return (char*)xbt_dict_get_or_null(simcall_process_get_properties(pimpl_), key); } @@ -250,22 +250,22 @@ CommPtr irecv(MailboxPtr chan, void** data) return chan->get_async(data); } -aid_t pid() +aid_t getPid() { return SIMIX_process_self()->pid; } -aid_t ppid() +aid_t getPpid() { return SIMIX_process_self()->ppid; } -std::string name() +std::string getName() { return SIMIX_process_self()->name; } -Host* host() +Host* getHost() { return SIMIX_process_self()->host; } diff --git a/src/s4u/s4u_comm.cpp b/src/s4u/s4u_comm.cpp index 95a5a8712d..abc76c9fc1 100644 --- a/src/s4u/s4u_comm.cpp +++ b/src/s4u/s4u_comm.cpp @@ -165,7 +165,7 @@ bool Comm::test() return false; } -MailboxPtr Comm::mailbox() +MailboxPtr Comm::getMailbox() { return mailbox_; } diff --git a/src/s4u/s4u_engine.cpp b/src/s4u/s4u_engine.cpp index 64bb8826d4..2e7de0a7d3 100644 --- a/src/s4u/s4u_engine.cpp +++ b/src/s4u/s4u_engine.cpp @@ -45,7 +45,8 @@ Engine::~Engine() s4u::Engine::instance_ = nullptr; } -Engine *Engine::instance() { +Engine* Engine::getInstance() +{ if (s4u::Engine::instance_ == nullptr) new Engine(0,nullptr); return s4u::Engine::instance_; @@ -80,12 +81,12 @@ void Engine::loadDeployment(const char *deploy) // FIXME: The following duplicates the content of s4u::Host extern std::map host_list; /** @brief Returns the amount of hosts in the platform */ -size_t Engine::hostCount() +size_t Engine::getHostCount() { return host_list.size(); } /** @brief Fills the passed list with all hosts found in the platform */ -void Engine::hostList(std::vector* list) +void Engine::getHostList(std::vector* list) { for (auto kv : host_list) list->push_back(kv.second); @@ -99,17 +100,17 @@ void Engine::run() { } } -s4u::NetZone* Engine::netRoot() +s4u::NetZone* Engine::getNetRoot() { return pimpl->netRoot_; } static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* name) { - if (not strcmp(current->name(), name)) + if (not strcmp(current->getCname(), name)) return current; - for (auto elem : *(current->children())) { + for (auto elem : *(current->getChildren())) { simgrid::s4u::NetZone* tmp = netzoneByNameRecursive(elem, name); if (tmp != nullptr) { return tmp; @@ -119,20 +120,20 @@ static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* n } /** @brief Retrieve the NetZone of the given name (or nullptr if not found) */ -NetZone* Engine::netzoneByNameOrNull(const char* name) +NetZone* Engine::getNetzoneByNameOrNull(const char* name) { - return netzoneByNameRecursive(netRoot(), name); + return netzoneByNameRecursive(getNetRoot(), name); } /** @brief Retrieve the netpoint of the given name (or nullptr if not found) */ -simgrid::kernel::routing::NetPoint* Engine::netpointByNameOrNull(const char* name) +simgrid::kernel::routing::NetPoint* Engine::getNetpointByNameOrNull(const char* name) { if (pimpl->netpoints_.find(name) == pimpl->netpoints_.end()) return nullptr; return pimpl->netpoints_.at(name); } /** @brief Fill the provided vector with all existing netpoints */ -void Engine::netpointList(std::vector* list) +void Engine::getNetpointList(std::vector* list) { for (auto kv : pimpl->netpoints_) list->push_back(kv.second); diff --git a/src/s4u/s4u_file.cpp b/src/s4u/s4u_file.cpp index 64753e8571..37b4f3ae48 100644 --- a/src/s4u/s4u_file.cpp +++ b/src/s4u/s4u_file.cpp @@ -25,9 +25,9 @@ File::File(const char* fullpath, sg_host_t host, void* userdata) : path_(fullpat Storage* st = nullptr; size_t longest_prefix_length = 0; std::string path; - XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, host->cname()); + XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, host->getCname()); - for (auto mnt : host->mountedStorages()) { + for (auto mnt : host->getMountedStorages()) { XBT_DEBUG("See '%s'", mnt.first.c_str()); mount_point = std::string(fullpath).substr(0, mnt.first.size()); @@ -41,11 +41,11 @@ File::File(const char* fullpath, sg_host_t host, void* userdata) : path_(fullpat mount_point = std::string(fullpath).substr(0, longest_prefix_length); path = std::string(fullpath).substr(longest_prefix_length, strlen(fullpath)); } else - xbt_die("Can't find mount point for '%s' on '%s'", fullpath, host->cname()); + xbt_die("Can't find mount point for '%s' on '%s'", fullpath, host->getCname()); pimpl_ = simcall_file_open(mount_point.c_str(), path.c_str(), st); - storage_type = st->type(); - storageId = st->name(); + storage_type = st->getType(); + storageId = st->getName(); } File::~File() diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index b131fe6085..a1520f952b 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -54,7 +54,7 @@ Host::~Host() delete pimpl_; if (pimpl_netpoint != nullptr) // not removed yet by a children class - simgrid::s4u::Engine::instance()->netpointUnregister(pimpl_netpoint); + simgrid::s4u::Engine::getInstance()->netpointUnregister(pimpl_netpoint); delete pimpl_cpu; delete mounts; } @@ -123,7 +123,8 @@ bool Host::isOn() { return this->pimpl_cpu->isOn(); } -int Host::pstatesCount() const { +int Host::getPstatesCount() const +{ return this->pimpl_cpu->getNbPStates(); } @@ -166,7 +167,7 @@ void Host::routeTo(Host* dest, std::vector* links, double* late { simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(pimpl_netpoint, dest->pimpl_netpoint, links, latency); if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) { - XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", cname(), dest->cname(), + XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", getCname(), dest->getCname(), (latency == nullptr ? -1 : *latency)); for (auto link : *links) XBT_CDEBUG(surf_route, "Link %s", link->cname()); @@ -174,14 +175,15 @@ void Host::routeTo(Host* dest, std::vector* links, double* late } /** Get the properties assigned to a host */ -xbt_dict_t Host::properties() { +xbt_dict_t Host::getProperties() +{ return simgrid::simix::kernelImmediate([this] { return this->pimpl_->getProperties(); }); } /** Retrieve the property value (or nullptr if not set) */ -const char* Host::property(const char* key) +const char* Host::getProperty(const char* key) { return this->pimpl_->getProperty(key); } @@ -192,7 +194,7 @@ void Host::setProperty(const char* key, const char* value) } /** Get the processes attached to the host */ -void Host::processes(std::vector* list) +void Host::getProcesses(std::vector* list) { smx_actor_t actor = NULL; xbt_swag_foreach(actor, this->extension()->process_list) { @@ -209,12 +211,14 @@ double Host::getPstateSpeed(int pstate_index) } /** @brief Get the peak processor speed (in flops/s), at the current pstate */ -double Host::speed() { +double Host::getSpeed() +{ return pimpl_cpu->getSpeed(1.0); } /** @brief Returns the number of core of the processor. */ -int Host::coreCount() { +int Host::getCoreCount() +{ return pimpl_cpu->coreCount(); } @@ -226,7 +230,7 @@ void Host::setPstate(int pstate_index) }); } /** @brief Retrieve the pstate at which the host is currently running */ -int Host::pstate() +int Host::getPstate() { return this->pimpl_cpu->getPState(); } @@ -236,14 +240,14 @@ int Host::pstate() * \brief Returns the list of storages attached to an host. * \return a vector containing all storages attached to the host */ -void Host::attachedStorages(std::vector* storages) +void Host::getAttachedStorages(std::vector* storages) { simgrid::simix::kernelImmediate([this, storages] { this->pimpl_->getAttachedStorageList(storages); }); } -std::unordered_map const& Host::mountedStorages() +std::unordered_map const& Host::getMountedStorages() { if (mounts == nullptr) { mounts = new std::unordered_map(); diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index f514ce5356..b29cfcdcba 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -16,7 +16,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_channel,s4u,"S4U Communication Mailboxes"); namespace simgrid { namespace s4u { -const char *Mailbox::name() { +const char* Mailbox::getName() +{ return pimpl_->name_; } @@ -58,7 +59,8 @@ void Mailbox::setReceiver(ActorPtr actor) { } /** @brief get the receiver (process associated to the mailbox) */ -ActorPtr Mailbox::receiver() { +ActorPtr Mailbox::getReceiver() +{ if (pimpl_->permanent_receiver == nullptr) return ActorPtr(); return pimpl_->permanent_receiver->iface(); diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index 1eec476116..33dbf91c0a 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -41,7 +41,7 @@ NetZone::~NetZone() xbt_free(name_); } -std::unordered_map* NetZone::properties() +std::unordered_map* NetZone::getProperties() { return simgrid::simix::kernelImmediate([this] { return &properties_; @@ -49,7 +49,7 @@ std::unordered_map* NetZone::properties() } /** Retrieve the property value (or nullptr if not set) */ -const char* NetZone::property(const char* key) +const char* NetZone::getProperty(const char* key) { return properties_.at(key).c_str(); } @@ -60,20 +60,20 @@ void NetZone::setProperty(const char* key, const char* value) }); } -std::vector* NetZone::children() +std::vector* NetZone::getChildren() { return children_; } -char* NetZone::name() +char* NetZone::getCname() { return name_; } -NetZone* NetZone::father() +NetZone* NetZone::getFather() { return father_; } -void NetZone::hosts(std::vector* whereto) +void NetZone::getHosts(std::vector* whereto) { for (auto card : vertices_) { s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->name()); diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index d10a19d886..694466c9a4 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -30,51 +30,52 @@ Storage* Storage::byName(const char* name) return &res->piface_; } -const char* Storage::name() +const char* Storage::getName() { return pimpl_->cname(); } -const char* Storage::type() +const char* Storage::getType() { return pimpl_->typeId_.c_str(); } -Host* Storage::host() +Host* Storage::getHost() { return attached_to_; } -sg_size_t Storage::sizeFree() +sg_size_t Storage::getSizeFree() { return simgrid::simix::kernelImmediate([this] { return pimpl_->getFreeSize(); }); } -sg_size_t Storage::sizeUsed() +sg_size_t Storage::getSizeUsed() { return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); }); } -sg_size_t Storage::size() { +sg_size_t Storage::getSize() +{ return pimpl_->size_; } -xbt_dict_t Storage::properties() +xbt_dict_t Storage::getProperties() { return simgrid::simix::kernelImmediate([this] { return pimpl_->getProperties(); }); } -const char* Storage::property(const char* key) +const char* Storage::getProperty(const char* key) { - return static_cast(xbt_dict_get_or_null(this->properties(), key)); + return static_cast(xbt_dict_get_or_null(this->getProperties(), key)); } void Storage::setProperty(const char* key, char* value) { - xbt_dict_set(this->properties(), key, value, nullptr); + xbt_dict_set(this->getProperties(), key, value, nullptr); } -std::map* Storage::content() +std::map* Storage::getContent() { return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); }); } diff --git a/src/simdag/sd_global.cpp b/src/simdag/sd_global.cpp index 61fdcf53b0..805dd0e092 100644 --- a/src/simdag/sd_global.cpp +++ b/src/simdag/sd_global.cpp @@ -199,7 +199,7 @@ void SD_config(const char *key, const char *value){ */ void SD_create_environment(const char *platform_file) { - simgrid::s4u::Engine::instance()->loadPlatform(platform_file); + simgrid::s4u::Engine::getInstance()->loadPlatform(platform_file); XBT_DEBUG("Host number: %zu, link number: %d", sg_host_count(), sg_link_count()); #if SIMGRID_HAVE_JEDULE diff --git a/src/simdag/sd_task.cpp b/src/simdag/sd_task.cpp index 8ea5cc145a..0dee8e1aa2 100644 --- a/src/simdag/sd_task.cpp +++ b/src/simdag/sd_task.cpp @@ -685,7 +685,7 @@ double SD_task_get_execution_time(SD_task_t task, int host_count, const sg_host_ for (int i = 0; i < host_count; i++) { double time = 0.0; if (flops_amount != nullptr) - time = flops_amount[i] / host_list[i]->speed(); + time = flops_amount[i] / host_list[i]->getSpeed(); if (bytes_amount != nullptr) for (int j = 0; j < host_count; j++) diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 5db33f1c39..1deab79569 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -38,7 +38,7 @@ void sg_host_exit() */ std::vector names = std::vector(); for (auto kv : simgrid::s4u::host_list) - names.push_back(kv.second->name()); + names.push_back(kv.second->getName()); std::sort(names.begin(), names.end()); @@ -69,7 +69,7 @@ sg_host_t *sg_host_list() { const char *sg_host_get_name(sg_host_t host) { - return host->cname(); + return host->getCname(); } void* sg_host_extension_get(sg_host_t host, size_t ext) @@ -89,8 +89,8 @@ sg_host_t sg_host_by_name(const char *name) static int hostcmp_voidp(const void* pa, const void* pb) { - return strcmp((*static_cast(pa))->cname(), - (*static_cast(pb))->cname()); + return strcmp((*static_cast(pa))->getCname(), + (*static_cast(pb))->getCname()); } xbt_dynar_t sg_hosts_as_dynar() @@ -123,10 +123,10 @@ void sg_host_user_destroy(sg_host_t host) { xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){ xbt_assert((host != nullptr), "Invalid parameters"); xbt_dict_t res = xbt_dict_new_homogeneous(nullptr); - for (auto elm : host->mountedStorages()) { + for (auto elm : host->getMountedStorages()) { const char* mount_name = elm.first.c_str(); sg_storage_t storage = elm.second; - xbt_dict_set(res, mount_name, (void*)storage->name(), nullptr); + xbt_dict_set(res, mount_name, (void*)storage->getName(), nullptr); } return res; @@ -135,7 +135,7 @@ xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){ xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){ std::vector* storage_vector = new std::vector(); xbt_dynar_t storage_dynar = xbt_dynar_new(sizeof(const char*), nullptr); - host->attachedStorages(storage_vector); + host->getAttachedStorages(storage_vector); for (auto name : *storage_vector) xbt_dynar_push(storage_dynar, &name); delete storage_vector; @@ -147,7 +147,7 @@ xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){ /** @brief Returns the total speed of a host */ double sg_host_speed(sg_host_t host) { - return host->speed(); + return host->getSpeed(); } double sg_host_get_available_speed(sg_host_t host) @@ -160,7 +160,7 @@ double sg_host_get_available_speed(sg_host_t host) * See also @ref plugin_energy. */ int sg_host_get_nb_pstates(sg_host_t host) { - return host->pstatesCount(); + return host->getPstatesCount(); } /** @brief Gets the pstate at which that host currently runs. @@ -168,7 +168,7 @@ int sg_host_get_nb_pstates(sg_host_t host) { * See also @ref plugin_energy. */ int sg_host_get_pstate(sg_host_t host) { - return host->pstate(); + return host->getPstate(); } /** @brief Sets the pstate at which that host should run. * @@ -180,7 +180,7 @@ void sg_host_set_pstate(sg_host_t host,int pstate) { /** @brief Get the properties of an host */ xbt_dict_t sg_host_get_properties(sg_host_t host) { - return host->properties(); + return host->getProperties(); } /** \ingroup m_host_management @@ -246,10 +246,10 @@ void sg_host_dump(sg_host_t host) { xbt_dict_t props; - XBT_INFO("Displaying host %s", host->cname()); - XBT_INFO(" - speed: %.0f", host->speed()); + XBT_INFO("Displaying host %s", host->getCname()); + XBT_INFO(" - speed: %.0f", host->getSpeed()); XBT_INFO(" - available speed: %.2f", sg_host_get_available_speed(host)); - props = host->properties(); + props = host->getProperties(); if (not xbt_dict_is_empty(props)) { XBT_INFO(" - properties:"); diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index a9cbed4c42..79356f08b6 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -231,10 +231,10 @@ smx_actor_t SIMIX_process_create(const char* name, std::function code, v xbt_dict_t properties, smx_actor_t parent_process) { - XBT_DEBUG("Start process %s on host '%s'", name, host->cname()); + XBT_DEBUG("Start process %s on host '%s'", name, host->getCname()); if (host->isOff()) { - XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, host->cname()); + XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, host->getCname()); return nullptr; } @@ -281,7 +281,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function code, v /* Now insert it in the global process list and in the process to run list */ simix_global->process_list[process->pid] = process; - XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->cname()); + XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->getCname()); xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process); intrusive_ptr_add_ref(process); @@ -345,7 +345,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn /* Now insert it in the global process list and in the process to run list */ simix_global->process_list[process->pid] = process; - XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->cname()); + XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->getCname()); xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process); /* Tracing the process creation */ @@ -410,7 +410,7 @@ void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_actor_t process) { */ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) { - XBT_DEBUG("Killing process %s@%s", process->cname(), process->host->cname()); + XBT_DEBUG("Killing process %s@%s", process->cname(), process->host->getCname()); process->context->iwannadie = 1; process->blocked = 0; @@ -709,7 +709,7 @@ smx_activity_t SIMIX_process_sleep(smx_actor_t process, double duration) sg_host_t host = process->host; if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->cname()); + THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->getCname()); simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl(); synchro->host = host; @@ -768,7 +768,7 @@ void SIMIX_process_yield(smx_actor_t self) self->properties, self->auto_restart); } - XBT_DEBUG("Process %s@%s is dead", self->cname(), self->host->cname()); + XBT_DEBUG("Process %s@%s is dead", self->cname(), self->host->getCname()); self->context->stop(); } @@ -857,7 +857,7 @@ smx_actor_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_actor_t p } /** @brief Restart a process, starting it again from the beginning. */ smx_actor_t SIMIX_process_restart(smx_actor_t process, smx_actor_t issuer) { - XBT_DEBUG("Restarting process %s on %s", process->cname(), process->host->cname()); + XBT_DEBUG("Restarting process %s on %s", process->cname(), process->host->getCname()); //retrieve the arguments of the old process //FIXME: Factorize this with SIMIX_host_add_auto_restart_process ? diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index c3bfd8dab7..3ebb020edd 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -241,7 +241,7 @@ void simcall_process_set_kill_time(smx_actor_t process, double kill_time) if (kill_time <= SIMIX_get_clock() || simix_global->kill_process_function == nullptr) return; - XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->cname(), process->host->cname()); + XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->cname(), process->host->getCname()); process->kill_timer = SIMIX_timer_set(kill_time, [=] { simix_global->kill_process_function(process); process->kill_timer=nullptr; diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 202f269f3e..376c1b9177 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -540,7 +540,7 @@ void SIMIX_run() /* Autorestart all process */ for (auto host: host_that_restart) { - XBT_INFO("Restart processes on host %s", host->cname()); + XBT_INFO("Restart processes on host %s", host->getCname()); SIMIX_host_autorestart(host); } host_that_restart.clear(); @@ -681,11 +681,11 @@ void SIMIX_display_process_status() */ XBT_INFO("Process %lu (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid, - process->cname(), process->host->cname(), synchro_description, process->waiting_synchro.get(), + process->cname(), process->host->getCname(), synchro_description, process->waiting_synchro.get(), process->waiting_synchro->name.c_str(), (int)process->waiting_synchro->state); } else { - XBT_INFO("Process %lu (%s@%s)", process->pid, process->cname(), process->host->cname()); + XBT_INFO("Process %lu (%s@%s)", process->pid, process->cname(), process->host->getCname()); } } } diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 4a695aacac..18e9829064 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -57,7 +57,7 @@ namespace simgrid { void Host::turnOn() { for (auto arg : boot_processes) { - XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->cname()); + XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->getCname()); smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host, arg->properties, nullptr); if (arg->kill_time >= 0) @@ -84,11 +84,11 @@ void SIMIX_host_off(sg_host_t h, smx_actor_t issuer) smx_actor_t process = nullptr; xbt_swag_foreach(process, host->process_list) { SIMIX_process_kill(process, issuer); - XBT_DEBUG("Killing %s@%s on behalf of %s", process->cname(), process->host->cname(), issuer->cname()); + XBT_DEBUG("Killing %s@%s on behalf of %s", process->cname(), process->host->getCname(), issuer->cname()); } } } else { - XBT_INFO("Host %s is already off", h->cname()); + XBT_INFO("Host %s is already off", h->getCname()); } } @@ -105,7 +105,7 @@ const char* sg_host_self_get_name() if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process) return ""; - return host->cname(); + return host->getCname(); } /** @@ -128,9 +128,9 @@ void SIMIX_host_add_auto_restart_process( arg->properties = properties; arg->auto_restart = auto_restart; - if (host->isOff() && not xbt_dict_get_or_null(watched_hosts_lib, host->cname())) { - xbt_dict_set(watched_hosts_lib, host->cname(), host, nullptr); - XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF", host->cname()); + if (host->isOff() && not xbt_dict_get_or_null(watched_hosts_lib, host->getCname())) { + xbt_dict_set(watched_hosts_lib, host->getCname(), host, nullptr); + XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF", host->getCname()); } host->extension()->auto_restart_processes.push_back(arg); } @@ -141,7 +141,7 @@ void SIMIX_host_autorestart(sg_host_t host) host->extension()->auto_restart_processes; for (auto arg : process_list) { - XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->cname()); + XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->getCname()); smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host, arg->properties, nullptr); if (arg->kill_time >= 0) @@ -278,7 +278,7 @@ void SIMIX_execution_finish(simgrid::kernel::activity::ExecImplPtr exec) break; case SIMIX_FAILED: - XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->cname()); + XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->getCname()); simcall->issuer->context->iwannadie = 1; SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); break; diff --git a/src/simix/smx_io.cpp b/src/simix/smx_io.cpp index 50897316fe..cfd7f33179 100644 --- a/src/simix/smx_io.cpp +++ b/src/simix/smx_io.cpp @@ -35,7 +35,7 @@ smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size, sg_host_t host) { /* check if the host is active */ if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname()); + THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname()); simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl(); synchro->host = host; @@ -58,7 +58,7 @@ void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t smx_activity_t SIMIX_file_write(surf_file_t file, sg_size_t size, sg_host_t host) { if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname()); + THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname()); simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl(); synchro->host = host; @@ -79,11 +79,11 @@ void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* mount, const c smx_activity_t SIMIX_file_open(const char* mount, const char* path, sg_storage_t st) { - if (st->host()->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", st->host()->cname()); + if (st->getHost()->isOff()) + THROWF(host_error, 0, "Host %s failed, you cannot call this function", st->getHost()->getCname()); simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl(); - synchro->host = st->host(); + synchro->host = st->getHost(); synchro->surf_io = st->pimpl_->open(mount, path); synchro->surf_io->setData(synchro); XBT_DEBUG("Create io synchro %p", synchro); @@ -102,7 +102,7 @@ void simcall_HANDLER_file_close(smx_simcall_t simcall, surf_file_t fd, sg_host_t smx_activity_t SIMIX_file_close(surf_file_t file, sg_host_t host) { if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname()); + THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname()); simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl(); synchro->host = host; diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 151a5772fa..2d5a76a944 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -458,13 +458,13 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm) comm->surf_comm->setData(comm.get()); comm->state = SIMIX_RUNNING; - XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->cname(), - receiver->cname(), comm->surf_comm); + XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->getCname(), + receiver->getCname(), comm->surf_comm); /* If a link is failed, detect it immediately */ if (comm->surf_comm->getState() == simgrid::surf::Action::State::failed) { - XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->cname(), - receiver->cname()); + XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->getCname(), + receiver->getCname()); comm->state = SIMIX_LINK_FAILURE; comm->cleanupSurf(); } @@ -475,11 +475,11 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm) if (comm->src_proc->isSuspended()) XBT_DEBUG("The communication is suspended on startup because src (%s@%s) was suspended since it initiated the " "communication", - comm->src_proc->cname(), comm->src_proc->host->cname()); + comm->src_proc->cname(), comm->src_proc->host->getCname()); else XBT_DEBUG("The communication is suspended on startup because dst (%s@%s) was suspended since it initiated the " "communication", - comm->dst_proc->cname(), comm->dst_proc->host->cname()); + comm->dst_proc->cname(), comm->dst_proc->host->getCname()); comm->surf_comm->suspend(); } @@ -562,9 +562,9 @@ void SIMIX_comm_finish(smx_activity_t synchro) case SIMIX_LINK_FAILURE: XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) " "detached:%d", - synchro.get(), comm->src_proc ? comm->src_proc->host->cname() : nullptr, - comm->dst_proc ? comm->dst_proc->host->cname() : nullptr, simcall->issuer->cname(), simcall->issuer, - comm->detached); + synchro.get(), comm->src_proc ? comm->src_proc->host->getCname() : nullptr, + comm->dst_proc ? comm->dst_proc->host->getCname() : nullptr, simcall->issuer->cname(), + simcall->issuer, comm->detached); if (comm->src_proc == simcall->issuer) { XBT_DEBUG("I'm source"); } else if (comm->dst_proc == simcall->issuer) { @@ -686,8 +686,8 @@ void SIMIX_comm_copy_data(smx_activity_t synchro) return; XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", comm.get(), - comm->src_proc ? comm->src_proc->host->cname() : "a finished process", comm->src_buff, - comm->dst_proc ? comm->dst_proc->host->cname() : "a finished process", comm->dst_buff, buff_size); + comm->src_proc ? comm->src_proc->host->getCname() : "a finished process", comm->src_buff, + comm->dst_proc ? comm->dst_proc->host->getCname() : "a finished process", comm->dst_buff, buff_size); /* Copy at most dst_buff_size bytes of the message to receiver's buffer */ if (comm->dst_buff_size) diff --git a/src/smpi/SmpiHost.cpp b/src/smpi/SmpiHost.cpp index c7b8dbaa97..cc9a814877 100644 --- a/src/smpi/SmpiHost.cpp +++ b/src/smpi/SmpiHost.cpp @@ -91,21 +91,21 @@ SmpiHost::SmpiHost(simgrid::s4u::Host *ptr) : host(ptr) if (not SmpiHost::EXTENSION_ID.valid()) SmpiHost::EXTENSION_ID = simgrid::s4u::Host::extension_create(); - const char* orecv_string = host->property("smpi/or"); + const char* orecv_string = host->getProperty("smpi/or"); if (orecv_string != nullptr) { orecv_parsed_values = parse_factor(orecv_string); } else { orecv_parsed_values = parse_factor(xbt_cfg_get_string("smpi/or")); } - const char* osend_string = host->property("smpi/os"); + const char* osend_string = host->getProperty("smpi/os"); if (osend_string != nullptr) { osend_parsed_values = parse_factor(osend_string); } else { osend_parsed_values = parse_factor(xbt_cfg_get_string("smpi/os")); } - const char* oisend_string = host->property("smpi/ois"); + const char* oisend_string = host->getProperty("smpi/ois"); if (oisend_string != nullptr) { oisend_parsed_values = parse_factor(oisend_string); } else { diff --git a/src/smpi/smpi_dvfs.cpp b/src/smpi/smpi_dvfs.cpp index c19e14e825..f83165f541 100644 --- a/src/smpi/smpi_dvfs.cpp +++ b/src/smpi/smpi_dvfs.cpp @@ -34,7 +34,7 @@ double smpi_get_host_power_peak_at(int pstate_index) */ double smpi_get_host_current_power_peak() { - return sg_host_self()->speed(); + return sg_host_self()->getSpeed(); } /** diff --git a/src/smpi/smpi_pmpi.cpp b/src/smpi/smpi_pmpi.cpp index 6a1b4d3242..c48bdcf59e 100644 --- a/src/smpi/smpi_pmpi.cpp +++ b/src/smpi/smpi_pmpi.cpp @@ -2153,9 +2153,9 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype int PMPI_Get_processor_name(char *name, int *resultlen) { - strncpy(name, sg_host_self()->cname(), strlen(sg_host_self()->cname()) < MPI_MAX_PROCESSOR_NAME - 1 - ? strlen(sg_host_self()->cname()) + 1 - : MPI_MAX_PROCESSOR_NAME - 1); + strncpy(name, sg_host_self()->getCname(), strlen(sg_host_self()->getCname()) < MPI_MAX_PROCESSOR_NAME - 1 + ? strlen(sg_host_self()->getCname()) + 1 + : MPI_MAX_PROCESSOR_NAME - 1); *resultlen = strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name); return MPI_SUCCESS; diff --git a/src/smpi/smpi_request.cpp b/src/smpi/smpi_request.cpp index 0e8c01b053..41fe4bd82c 100644 --- a/src/smpi/smpi_request.cpp +++ b/src/smpi/smpi_request.cpp @@ -419,8 +419,8 @@ void Request::start() if (detached_ != 0 || ((flags_ & (ISEND | SSEND)) != 0)) { // issend should be treated as isend // isend and send timings may be different sleeptime = ((flags_ & ISEND) != 0) - ? simgrid::s4u::Actor::self()->host()->extension()->oisend(size_) - : simgrid::s4u::Actor::self()->host()->extension()->osend(size_); + ? simgrid::s4u::Actor::self()->getHost()->extension()->oisend(size_) + : simgrid::s4u::Actor::self()->getHost()->extension()->osend(size_); } if(sleeptime > 0.0){ @@ -626,7 +626,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* // nsleeps is a multiplier to the sleeptime, to increase speed of execution, each failed iprobe will increase it // This can speed up the execution of certain applications by an order of magnitude, such as HPL static int nsleeps = 1; - double speed = simgrid::s4u::Actor::self()->host()->speed(); + double speed = simgrid::s4u::Actor::self()->getHost()->getSpeed(); double maxrate = xbt_cfg_get_double("smpi/iprobe-cpu-usage"); MPI_Request request = new Request(nullptr, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->index(source), comm->rank(), tag, comm, PERSISTENT | RECV); @@ -726,7 +726,8 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status) } if(req->detached_sender_ != nullptr){ //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0 - double sleeptime = simgrid::s4u::Actor::self()->host()->extension()->orecv(req->real_size()); + double sleeptime = + simgrid::s4u::Actor::self()->getHost()->extension()->orecv(req->real_size()); if(sleeptime > 0.0){ simcall_process_sleep(sleeptime); XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime); diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index 9e03407e87..f14700b3d3 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -102,9 +102,9 @@ HostImpl::HostImpl(s4u::Host* host) : piface_(host) simgrid::surf::StorageImpl* HostImpl::findStorageOnMountList(const char* mount) { - XBT_DEBUG("Search for storage name '%s' on '%s'", mount, piface_->cname()); + XBT_DEBUG("Search for storage name '%s' on '%s'", mount, piface_->getCname()); if (storage_.find(mount) == storage_.end()) - xbt_die("Can't find mount '%s' for '%s'", mount, piface_->cname()); + xbt_die("Can't find mount '%s' for '%s'", mount, piface_->getCname()); return storage_.at(mount); } @@ -112,8 +112,8 @@ simgrid::surf::StorageImpl* HostImpl::findStorageOnMountList(const char* mount) void HostImpl::getAttachedStorageList(std::vector* storages) { for (auto s : storage_) - if (s.second->attach_ == piface_->cname()) - storages->push_back(s.second->piface_.name()); + if (s.second->attach_ == piface_->getCname()) + storages->push_back(s.second->piface_.getName()); } Action* HostImpl::close(surf_file_t fd) diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 282b59fda6..955de3a1bc 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -100,14 +100,14 @@ Cpu::Cpu(Model *model, simgrid::s4u::Host *host, std::vector *speedPerPs Cpu::Cpu(Model* model, simgrid::s4u::Host* host, lmm_constraint_t constraint, std::vector* speedPerPstate, int core) - : Resource(model, host->cname(), constraint), coresAmount_(core), host_(host) + : Resource(model, host->getCname(), constraint), coresAmount_(core), host_(host) { - xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->cname()); + xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->getCname()); speed_.peak = speedPerPstate->front(); speed_.scale = 1; host->pimpl_cpu = this; - xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->cname()); + xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->getCname()); // Copy the power peak array: for (double value : *speedPerPstate) { @@ -170,13 +170,13 @@ int Cpu::coreCount() void Cpu::setStateTrace(tmgr_trace_t trace) { - xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Host %s", host_->cname()); + xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Host %s", host_->getCname()); stateEvent_ = future_evt_set->add_trace(trace, this); } void Cpu::setSpeedTrace(tmgr_trace_t trace) { - xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->cname()); + xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->getCname()); speed_.event = future_evt_set->add_trace(trace, this); } diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index 1dd0268074..d6e4f93fee 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -132,11 +132,11 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t XBT_DEBUG("Graph extraction disabled by user."); return; } - XBT_DEBUG("Graph extraction for NetZone = %s", netzone->name()); - if (not netzone->children()->empty()) { + XBT_DEBUG("Graph extraction for NetZone = %s", netzone->getCname()); + if (not netzone->getChildren()->empty()) { //bottom-up recursion - for (auto nz_son : *netzone->children()) { - container_t child_container = static_cast(xbt_dict_get(container->children, nz_son->name())); + for (auto nz_son : *netzone->getChildren()) { + container_t child_container = static_cast(xbt_dict_get(container->children, nz_son->getCname())); recursiveGraphExtraction(nz_son, child_container, filter); } } @@ -165,7 +165,7 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t */ static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone) { - const char* id = netzone.name(); + const char* id = netzone.getCname(); if (PJ_container_get_root() == nullptr){ PJ_container_alloc (); @@ -237,7 +237,7 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link) static void sg_instr_new_host(simgrid::s4u::Host& host) { container_t father = currentContainer.back(); - container_t container = PJ_container_new(host.cname(), INSTR_HOST, father); + container_t container = PJ_container_new(host.getCname(), INSTR_HOST, father); if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_speed())) { type_t speed = PJ_type_get_or_null ("power", container->type); @@ -245,7 +245,7 @@ static void sg_instr_new_host(simgrid::s4u::Host& host) speed = PJ_type_variable_new ("power", nullptr, container->type); } - double current_speed_state = host.speed(); + double current_speed_state = host.getSpeed(); new SetVariableEvent (0, container, speed, current_speed_state); } if (TRACE_uncategorized()){ @@ -310,7 +310,7 @@ static void instr_routing_parse_end_platform () currentContainer.clear(); xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free_f); XBT_DEBUG ("Starting graph extraction."); - recursiveGraphExtraction(simgrid::s4u::Engine::instance()->netRoot(), PJ_container_get_root(), filter); + recursiveGraphExtraction(simgrid::s4u::Engine::getInstance()->getNetRoot(), PJ_container_get_root(), filter); XBT_DEBUG ("Graph extraction finished."); xbt_dict_free(&filter); platform_created = 1; @@ -429,10 +429,11 @@ int instr_platform_traced () static void recursiveXBTGraphExtraction(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges, sg_netzone_t netzone, container_t container) { - if (not netzone->children()->empty()) { + if (not netzone->getChildren()->empty()) { //bottom-up recursion - for (auto netzone_child : *netzone->children()) { - container_t child_container = static_cast(xbt_dict_get(container->children, netzone_child->name())); + for (auto netzone_child : *netzone->getChildren()) { + container_t child_container = + static_cast(xbt_dict_get(container->children, netzone_child->getCname())); recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container); } } @@ -445,7 +446,8 @@ xbt_graph_t instr_routing_platform_graph () xbt_graph_t ret = xbt_graph_new_graph (0, nullptr); xbt_dict_t nodes = xbt_dict_new_homogeneous(nullptr); xbt_dict_t edges = xbt_dict_new_homogeneous(nullptr); - recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::instance()->netRoot(), PJ_container_get_root()); + recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::getInstance()->getNetRoot(), + PJ_container_get_root()); xbt_dict_free (&nodes); xbt_dict_free (&edges); return ret; diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 4e6c8aad4f..4a771e92ad 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -276,12 +276,12 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz std::vector* back_route = nullptr; std::vector* route = new std::vector(); - XBT_IN("(%s,%s,%g,%g)", src->cname(), dst->cname(), size, rate); + XBT_IN("(%s,%s,%g,%g)", src->getCname(), dst->getCname(), size, rate); src->routeTo(dst, route, &latency); xbt_assert(not route->empty() || latency, "You're trying to send data from %s to %s but there is no connecting path between these two hosts.", - src->cname(), dst->cname()); + src->getCname(), dst->getCname()); for (auto link: *route) if (link->isOff()) @@ -322,7 +322,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz "Using a model with a gap (e.g., SMPI) with a platform without links (e.g. vivaldi)!!!"); gapAppend(size, route->at(0), action); - XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->cname(), dst->cname(), action->senderGap_, + XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->getCname(), dst->getCname(), action->senderGap_, action->latency_); } diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 48b9c1e4da..e3f1898673 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -28,7 +28,7 @@ static void IB_create_host_callback(simgrid::s4u::Host& host){ IBNode* act = new IBNode(id); id++; - xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes, host.cname(), act, nullptr); + xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes, host.getCname(), act, nullptr); } static void IB_action_state_changed_callback(simgrid::surf::NetworkAction* action) @@ -52,10 +52,10 @@ static void IB_action_init_callback(simgrid::surf::NetworkAction* action, simgri { simgrid::surf::NetworkIBModel* ibModel = (simgrid::surf::NetworkIBModel*)surf_network_model; - simgrid::surf::IBNode* act_src = (simgrid::surf::IBNode*)xbt_dict_get_or_null(ibModel->active_nodes, src->cname()); + simgrid::surf::IBNode* act_src = (simgrid::surf::IBNode*)xbt_dict_get_or_null(ibModel->active_nodes, src->getCname()); xbt_assert(act_src, "could not find src node active comms !"); - simgrid::surf::IBNode* act_dst = (simgrid::surf::IBNode*)xbt_dict_get_or_null(ibModel->active_nodes, dst->cname()); + simgrid::surf::IBNode* act_dst = (simgrid::surf::IBNode*)xbt_dict_get_or_null(ibModel->active_nodes, dst->getCname()); xbt_assert(act_dst, "could not find dst node active comms !"); ibModel->active_comms[action]=std::make_pair(act_src, act_dst); diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 9404d6bc43..928f3da55f 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -300,7 +300,7 @@ void LinkNS3::setLatencyTrace(tmgr_trace_t trace) { NetworkNS3Action::NetworkNS3Action(Model* model, double size, s4u::Host* src, s4u::Host* dst) : NetworkAction(model, size, false) { - XBT_DEBUG("Communicate from %s to %s", src->cname(), dst->cname()); + XBT_DEBUG("Communicate from %s to %s", src->getCname(), dst->getCname()); src_ = src; dst_ = dst; diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index 2b88fb032c..3096d22d72 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -166,7 +166,7 @@ void HostEnergy::update() { double start_time = this->last_updated; double finish_time = surf_get_clock(); - double current_speed = host->speed(); + double current_speed = host->getSpeed(); if (start_time < finish_time) { double cpu_load; @@ -214,20 +214,21 @@ void HostEnergy::update() XBT_DEBUG("[update_energy of %s] period=[%.2f-%.2f]; current power peak=%.0E flop/s; consumption change: %.2f J -> " "%.2f J", - host->cname(), start_time, finish_time, host->pimpl_cpu->speed_.peak, previous_energy, energy_this_step); + host->getCname(), start_time, finish_time, host->pimpl_cpu->speed_.peak, previous_energy, + energy_this_step); } /* Save data for the upcoming time interval: whether it's on/off and the pstate if it's on */ - this->pstate = host->isOn() ? host->pstate() : -1; + this->pstate = host->isOn() ? host->getPstate() : -1; } HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host(ptr), last_updated(surf_get_clock()) { initWattsRangeList(); - const char* off_power_str = host->property("watt_off"); + const char* off_power_str = host->getProperty("watt_off"); if (off_power_str != nullptr) { - char* msg = bprintf("Invalid value for property watt_off of host %s: %%s", host->cname()); + char* msg = bprintf("Invalid value for property watt_off of host %s: %%s", host->getCname()); this->watts_off = xbt_str_parse_double(off_power_str, msg); xbt_free(msg); } @@ -238,20 +239,20 @@ HostEnergy::~HostEnergy() = default; double HostEnergy::getWattMinAt(int pstate) { - xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname()); + xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->getCname()); return power_range_watts_list[pstate].min; } double HostEnergy::getWattMaxAt(int pstate) { - xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname()); + xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->getCname()); return power_range_watts_list[pstate].max; } /** @brief Computes the power consumed by the host according to the current pstate and processor load */ double HostEnergy::getCurrentWattsValue(double cpu_load) { - xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname()); + xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->getCname()); /* min_power corresponds to the power consumed when only one core is active */ /* max_power is the power consumed at 100% cpu load */ @@ -276,7 +277,7 @@ double HostEnergy::getCurrentWattsValue(double cpu_load) * (maxCpuLoad is by definition 1) */ double power_slope; - int coreCount = host->coreCount(); + int coreCount = host->getCoreCount(); double coreReciprocal = static_cast(1) / static_cast(coreCount); if (coreCount > 1) power_slope = (max_power - min_power) / (1 - coreReciprocal); @@ -304,24 +305,24 @@ double HostEnergy::getConsumedEnergy() void HostEnergy::initWattsRangeList() { - const char* all_power_values_str = host->property("watt_per_state"); + const char* all_power_values_str = host->getProperty("watt_per_state"); if (all_power_values_str == nullptr) return; std::vector all_power_values; boost::split(all_power_values, all_power_values_str, boost::is_any_of(",")); - XBT_DEBUG("%s: profile: %s, cores: %d", host->cname(), all_power_values_str, host->coreCount()); + XBT_DEBUG("%s: profile: %s, cores: %d", host->getCname(), all_power_values_str, host->getCoreCount()); int i = 0; for (auto current_power_values_str : all_power_values) { /* retrieve the power values associated with the current pstate */ std::vector current_power_values; boost::split(current_power_values, current_power_values_str, boost::is_any_of(":")); - if (host->coreCount() == 1) { + if (host->getCoreCount() == 1) { xbt_assert(current_power_values.size() == 2 || current_power_values.size() == 3, "Power properties incorrectly defined for host %s." "It should be 'Idle:FullSpeed' power values because you have one core only.", - host->cname()); + host->getCname()); if (current_power_values.size() == 2) { // In this case, 1core == AllCores current_power_values.push_back(current_power_values.at(1)); @@ -331,20 +332,20 @@ void HostEnergy::initWattsRangeList() "The energy profile of mono-cores should be formated as 'Idle:FullSpeed' only.\n" "If you go for a 'Idle:OneCore:AllCores' power profile on mono-cores, then OneCore and AllCores " "must be equal.", - host->cname()); + host->getCname()); } } else { xbt_assert(current_power_values.size() == 3, "Power properties incorrectly defined for host %s." "It should be 'Idle:OneCore:AllCores' power values because you have more than one core.", - host->cname()); + host->getCname()); } /* min_power corresponds to the idle power (cpu load = 0) */ /* max_power is the power consumed at 100% cpu load */ - char* msg_idle = bprintf("Invalid idle value for pstate %d on host %s: %%s", i, host->cname()); - char* msg_min = bprintf("Invalid OneCore value for pstate %d on host %s: %%s", i, host->cname()); - char* msg_max = bprintf("Invalid AllCores value for pstate %d on host %s: %%s", i, host->cname()); + char* msg_idle = bprintf("Invalid idle value for pstate %d on host %s: %%s", i, host->getCname()); + char* msg_min = bprintf("Invalid OneCore value for pstate %d on host %s: %%s", i, host->getCname()); + char* msg_max = bprintf("Invalid AllCores value for pstate %d on host %s: %%s", i, host->getCname()); PowerRange range(xbt_str_parse_double((current_power_values.at(0)).c_str(), msg_idle), xbt_str_parse_double((current_power_values.at(1)).c_str(), msg_min), xbt_str_parse_double((current_power_values.at(2)).c_str(), msg_max)); @@ -410,7 +411,7 @@ static void onHostDestruction(simgrid::s4u::Host& host) HostEnergy* host_energy = host.extension(); host_energy->update(); - XBT_INFO("Energy consumption of host %s: %f Joules", host.cname(), host_energy->getConsumedEnergy()); + XBT_INFO("Energy consumption of host %s: %f Joules", host.getCname(), host_energy->getConsumedEnergy()); } static void onSimulationEnd() @@ -466,7 +467,7 @@ void sg_host_energy_update_all() { simgrid::simix::kernelImmediate([]() { std::vector list; - simgrid::s4u::Engine::instance()->hostList(&list); + simgrid::s4u::Engine::getInstance()->getHostList(&list); for (auto host : list) if (dynamic_cast(host) == nullptr) // Ignore virtual machines host->extension()->update(); @@ -513,7 +514,7 @@ double sg_host_get_current_consumption(sg_host_t host) { xbt_assert(HostEnergy::EXTENSION_ID.valid(), "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - double cpu_load = lmm_constraint_get_usage(host->pimpl_cpu->constraint()) / host->speed(); + double cpu_load = lmm_constraint_get_usage(host->pimpl_cpu->constraint()) / host->getSpeed(); return host->extension()->getCurrentWattsValue(cpu_load); } diff --git a/src/surf/plugins/host_load.cpp b/src/surf/plugins/host_load.cpp index 7005e62e6d..71ccf350ea 100644 --- a/src/surf/plugins/host_load.cpp +++ b/src/surf/plugins/host_load.cpp @@ -76,12 +76,12 @@ void HostLoad::update() double HostLoad::getCurrentLoad() { - return current_flops / (host->speed() * host->coreCount()); + return current_flops / (host->getSpeed() * host->getCoreCount()); } double HostLoad::getAverageLoad() { - return getComputedFlops() / (host->speed() * host->coreCount() * (surf_get_clock() - last_reset)); + return getComputedFlops() / (host->getSpeed() * host->getCoreCount() * (surf_get_clock() - last_reset)); } double HostLoad::getComputedFlops() diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 5c4105df3e..663f8c8d50 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -110,7 +110,7 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const char* name, const 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::instance()->netpointByNameOrNull(name), + xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name), "Refusing to create a router named '%s': this name already describes a node.", name); simgrid::kernel::routing::NetPoint* netpoint = @@ -322,10 +322,10 @@ void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb) dynamic_cast(current_routing); xbt_assert(cluster, "Only hosts from Cluster can get a backbone."); - xbt_assert(nullptr == cluster->backbone_, "Cluster %s already has a backbone link!", cluster->name()); + xbt_assert(nullptr == cluster->backbone_, "Cluster %s already has a backbone link!", cluster->getCname()); cluster->backbone_ = bb; - XBT_DEBUG("Add a backbone to AS '%s'", current_routing->name()); + XBT_DEBUG("Add a backbone to AS '%s'", current_routing->getCname()); } void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet) @@ -444,7 +444,7 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process) "' does not exist\nExisting hosts: '"; for (auto kv : simgrid::s4u::host_list) { simgrid::s4u::Host* host = kv.second; - msg += host->name(); + msg += host->getName(); msg += "', '"; if (msg.length() > 1024) { msg.pop_back(); // remove trailing quote @@ -486,7 +486,7 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process) arg->kill_time = kill_time; arg->properties = current_property_set; - XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->cname(), start_time); + XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->getCname(), start_time); SIMIX_timer_set(start_time, [arg, auto_restart]() { smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), std::move(arg->code), arg->data, arg->host, arg->properties, nullptr); @@ -497,7 +497,7 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process) delete arg; }); } else { // start_time <= SIMIX_get_clock() - XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->cname()); + XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->getCname()); smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), std::move(code), nullptr, host, current_property_set, nullptr); @@ -644,16 +644,16 @@ simgrid::s4u::NetZone* sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS) } if (current_routing == nullptr) { /* it is the first one */ - xbt_assert(simgrid::s4u::Engine::instance()->pimpl->netRoot_ == nullptr, + xbt_assert(simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ == nullptr, "All defined components must belong to a networking zone."); - simgrid::s4u::Engine::instance()->pimpl->netRoot_ = new_as; + simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ = new_as; } else { /* set the father behavior */ if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset) current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::recursive; /* add to the sons dictionary */ - current_routing->children()->push_back(static_cast(new_as)); + current_routing->getChildren()->push_back(static_cast(new_as)); } /* set the new current component of the tree */ @@ -675,7 +675,7 @@ void sg_platf_new_AS_seal() xbt_assert(current_routing, "Cannot seal the current AS: none under construction"); current_routing->seal(); simgrid::s4u::NetZone::onSeal(*current_routing); - current_routing = static_cast(current_routing->father()); + current_routing = static_cast(current_routing->getFather()); } /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */ diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 72e5825570..e304c1ffb5 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -65,7 +65,7 @@ void surf_parse_assert_netpoint(char* hostname, const char* pre, const char* pos msg += " Existing netpoints: \n"; std::vector list; - simgrid::s4u::Engine::instance()->netpointList(&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->name() < b->name(); @@ -519,7 +519,7 @@ void STag_surfxml_prop() { 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::instance()->netzoneByNameOrNull(A_surfxml_zone_id); + simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(A_surfxml_zone_id); netzone->setProperty(A_surfxml_prop_id, A_surfxml_prop_value); } diff --git a/teshsuite/s4u/actor/actor.cpp b/teshsuite/s4u/actor/actor.cpp index c742c2b41e..6d8c6d5871 100644 --- a/teshsuite/s4u/actor/actor.cpp +++ b/teshsuite/s4u/actor/actor.cpp @@ -10,7 +10,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example") static void worker() { simgrid::s4u::this_actor::sleep_for(.5); - XBT_INFO("Worker started (PID:%lu, PPID:%lu)", simgrid::s4u::this_actor::pid(), simgrid::s4u::this_actor::ppid()); + XBT_INFO("Worker started (PID:%lu, PPID:%lu)", simgrid::s4u::this_actor::getPid(), + simgrid::s4u::this_actor::getPpid()); while (1) { XBT_INFO("Plop i am %ssuspended", simgrid::s4u::this_actor::isSuspended() ? "" : "not "); simgrid::s4u::this_actor::sleep_for(1); @@ -22,28 +23,28 @@ static void master() { simgrid::s4u::this_actor::sleep_for(1); std::vector* actor_list = new std::vector(); - simgrid::s4u::this_actor::host()->actorList(actor_list); + simgrid::s4u::this_actor::getHost()->actorList(actor_list); for (auto actor : *actor_list) { - XBT_INFO("Actor (pid=%lu, ppid=%lu, name=%s)", actor->pid(), actor->ppid(), actor->name().c_str()); - if (simgrid::s4u::this_actor::pid() != actor->pid()) + XBT_INFO("Actor (pid=%lu, ppid=%lu, name=%s)", actor->getPid(), actor->getPpid(), actor->getName().c_str()); + if (simgrid::s4u::this_actor::getPid() != actor->getPid()) actor->kill(); } simgrid::s4u::ActorPtr actor = - simgrid::s4u::Actor::createActor("worker from master", simgrid::s4u::this_actor::host(), worker); + simgrid::s4u::Actor::createActor("worker from master", simgrid::s4u::this_actor::getHost(), worker); simgrid::s4u::this_actor::sleep_for(2); - XBT_INFO("Suspend Actor (pid=%lu)", actor->pid()); + XBT_INFO("Suspend Actor (pid=%lu)", actor->getPid()); actor->suspend(); - XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->pid(), actor->isSuspended() ? "" : "not "); + XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not "); simgrid::s4u::this_actor::sleep_for(2); - XBT_INFO("Resume Actor (pid=%lu)", actor->pid()); + XBT_INFO("Resume Actor (pid=%lu)", actor->getPid()); actor->resume(); - XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->pid(), actor->isSuspended() ? "" : "not "); + XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not "); simgrid::s4u::this_actor::sleep_for(2); actor->kill(); diff --git a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp index 692701a3e4..217a166490 100644 --- a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp +++ b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp @@ -13,7 +13,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u test"); static void host() { char name[2048]; - int id = simgrid::s4u::this_actor::pid(); + int id = simgrid::s4u::this_actor::getPid(); snprintf(name, 2048, "%s%i", FILENAME1, id); simgrid::s4u::File* file = new simgrid::s4u::File(name, NULL); XBT_INFO("process %d is writing!", id); diff --git a/teshsuite/s4u/pid/pid.cpp b/teshsuite/s4u/pid/pid.cpp index 2624b07990..86dcc627dc 100644 --- a/teshsuite/s4u/pid/pid.cpp +++ b/teshsuite/s4u/pid/pid.cpp @@ -16,7 +16,7 @@ static int my_onexit(smx_process_exit_status_t status, int* pid) static void sendpid() { simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox"); - int pid = simgrid::s4u::this_actor::pid(); + int pid = simgrid::s4u::this_actor::getPid(); double comm_size = 100000; simgrid::s4u::this_actor::onExit((int_f_pvoid_pvoid_t)my_onexit, &pid); diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.cpp b/teshsuite/s4u/storage_client_server/storage_client_server.cpp index 569b8cc98c..10ea0648e2 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.cpp +++ b/teshsuite/s4u/storage_client_server/storage_client_server.cpp @@ -10,9 +10,9 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(storage, "Messages specific for this simulation"); static void display_storage_properties(simgrid::s4u::Storage* storage) { - xbt_dict_t props = storage->properties(); + xbt_dict_t props = storage->getProperties(); if (xbt_dict_length(props) > 0) { - XBT_INFO("\tProperties of mounted storage: %s", storage->name()); + XBT_INFO("\tProperties of mounted storage: %s", storage->getName()); xbt_dict_cursor_t cursor = NULL; char* key; @@ -29,7 +29,7 @@ static sg_size_t write_local_file(const char* dest, sg_size_t file_size) simgrid::s4u::File* file = new simgrid::s4u::File(dest, nullptr); sg_size_t written = file->write(file_size); XBT_INFO("%llu bytes on %llu bytes have been written by %s on /sd1", written, file_size, - simgrid::s4u::Actor::self()->name().c_str()); + simgrid::s4u::Actor::self()->getName().c_str()); delete file; return written; } @@ -40,7 +40,7 @@ static sg_size_t read_local_file(const char* src) sg_size_t file_size = file->size(); sg_size_t read = file->read(file_size); - XBT_INFO("%s has read %llu on %s", simgrid::s4u::Actor::self()->name().c_str(), read, src); + XBT_INFO("%s has read %llu on %s", simgrid::s4u::Actor::self()->getName().c_str(), read, src); delete file; return read; @@ -53,7 +53,7 @@ static void hsm_put(const char* remote_host, const char* src, const char* dest) sg_size_t read_size = read_local_file(src); // Send file - XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::name().c_str(), read_size, remote_host); + XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::getName().c_str(), read_size, remote_host); char* payload = bprintf("%s %llu", dest, read_size); simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(remote_host); mailbox->put(payload, static_cast(read_size)); @@ -62,8 +62,8 @@ static void hsm_put(const char* remote_host, const char* src, const char* dest) static void display_storage_content(simgrid::s4u::Storage* storage) { - XBT_INFO("Print the content of the storage element: %s", storage->name()); - std::map* content = storage->content(); + XBT_INFO("Print the content of the storage element: %s", storage->getName()); + std::map* content = storage->getContent(); if (not content->empty()) { for (auto entry : *content) XBT_INFO("\t%s size: %llu bytes", entry.first.c_str(), entry.second); @@ -84,10 +84,10 @@ static void get_set_storage_data(const char* storage_name) XBT_INFO("*** GET/SET DATA for storage element: %s ***", storage_name); simgrid::s4u::Storage* storage = simgrid::s4u::Storage::byName(storage_name); - char* data = static_cast(storage->userdata()); + char* data = static_cast(storage->getUserdata()); XBT_INFO("Get data: '%s'", data); storage->setUserdata(xbt_strdup("Some data")); - data = static_cast(storage->userdata()); + data = static_cast(storage->getUserdata()); XBT_INFO("\tSet and get data: '%s'", data); xbt_free(data); } @@ -97,7 +97,7 @@ static void dump_platform_storages() std::map* storages = simgrid::s4u::allStorages(); for (auto storage : *storages) { - XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->host()->cname()); + XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->getHost()->getCname()); storage.second->setProperty("other usage", xbt_strdup("gpfs")); } delete storages; @@ -105,21 +105,21 @@ static void dump_platform_storages() static void storage_info(simgrid::s4u::Host* host) { - XBT_INFO("*** Storage info on %s ***", host->cname()); + XBT_INFO("*** Storage info on %s ***", host->getCname()); - for (auto elm : host->mountedStorages()) { + for (auto elm : host->getMountedStorages()) { const char* mount_name = elm.first.c_str(); simgrid::s4u::Storage* storage = elm.second; - XBT_INFO("\tStorage name: %s, mount name: %s", storage->name(), mount_name); + XBT_INFO("\tStorage name: %s, mount name: %s", storage->getName(), mount_name); - sg_size_t free_size = storage->sizeFree(); - sg_size_t used_size = storage->sizeUsed(); + sg_size_t free_size = storage->getSizeFree(); + sg_size_t used_size = storage->getSizeUsed(); XBT_INFO("\t\tFree size: %llu bytes", free_size); XBT_INFO("\t\tUsed size: %llu bytes", used_size); display_storage_properties(storage); - dump_storage_by_name(storage->name()); + dump_storage_by_name(storage->getName()); } } @@ -137,8 +137,8 @@ static void client() static void server() { - storage_info(simgrid::s4u::this_actor::host()); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::host()->cname()); + storage_info(simgrid::s4u::this_actor::getHost()); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getCname()); XBT_INFO("Server waiting for transfers ..."); while (1) { @@ -155,7 +155,7 @@ static void server() } } - storage_info(simgrid::s4u::this_actor::host()); + storage_info(simgrid::s4u::this_actor::getHost()); dump_platform_storages(); } diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index 7810dd2745..75a363c523 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -76,10 +76,10 @@ static void dump_platform() std::qsort((void*)hosts, totalHosts, sizeof(sg_host_t), name_compare_hosts); for (unsigned int i = 0; i < totalHosts; i++) { - std::printf(" cname(), sg_host_speed(hosts[i])); + std::printf(" getCname(), sg_host_speed(hosts[i])); props = sg_host_get_properties(hosts[i]); - if (hosts[i]->coreCount() > 1) { - std::printf(" core=\"%d\"", hosts[i]->coreCount()); + if (hosts[i]->getCoreCount() > 1) { + std::printf(" core=\"%d\"", hosts[i]->getCoreCount()); } if (props && not xbt_dict_is_empty(props)) { std::printf(">\n"); @@ -94,7 +94,7 @@ static void dump_platform() // Routers std::vector netcardList; - simgrid::s4u::Engine::instance()->netpointList(&netcardList); + simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList); std::sort(netcardList.begin(), netcardList.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { return a->name() < b->name(); @@ -131,7 +131,7 @@ static void dump_platform() simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr); if (not route.empty()) { - std::printf(" \n ", host1->cname(), host2->cname()); + std::printf(" \n ", host1->getCname(), host2->getCname()); for (auto link : route) std::printf("", link->cname()); std::printf("\n \n"); @@ -139,7 +139,7 @@ static void dump_platform() } for (auto netcardDst : netcardList) { // to router if (netcardDst->isRouter()) { - std::printf(" \n ", host1->cname(), netcardDst->cname()); + std::printf(" \n ", host1->getCname(), netcardDst->cname()); std::vector route; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr); for (auto link : route) @@ -163,7 +163,7 @@ static void dump_platform() } for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host simgrid::s4u::Host* host2 = hosts[it_dst]; - std::printf(" \n ", value1->cname(), host2->cname()); + std::printf(" \n ", value1->cname(), host2->getCname()); std::vector route; simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, &route, nullptr); diff --git a/teshsuite/simdag/is-router/is-router.cpp b/teshsuite/simdag/is-router/is-router.cpp index f5f11e0f37..0b09725c98 100644 --- a/teshsuite/simdag/is-router/is-router.cpp +++ b/teshsuite/simdag/is-router/is-router.cpp @@ -19,7 +19,7 @@ int main(int argc, char **argv) std::printf("Host count: %zu, link number: %d\n", sg_host_count(), sg_link_count()); std::vector netcardList; - simgrid::s4u::Engine::instance()->netpointList(&netcardList); + simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList); std::sort(netcardList.begin(), netcardList.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { return a->name() < b->name(); @@ -36,7 +36,7 @@ int main(int argc, char **argv) type = "netzone"; if (nc->isHost()) type = "host"; - std::printf(" - Seen: \"%s\". Type: %s\n", host->cname(), type); + std::printf(" - Seen: \"%s\". Type: %s\n", host->getCname(), type); } xbt_dynar_free(&hosts); -- 2.20.1