From: Martin Quinson Date: Mon, 2 Apr 2018 19:10:21 +0000 (+0200) Subject: convert getCname to get_cname X-Git-Tag: v3.20~554 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9caf173e476622d309cc5653a83d224d05787cc7 convert getCname to get_cname --- diff --git a/examples/s4u/actor-create/s4u-actor-create.cpp b/examples/s4u/actor-create/s4u-actor-create.cpp index 87530584fe..8757433184 100644 --- a/examples/s4u/actor-create/s4u-actor-create.cpp +++ b/examples/s4u/actor-create/s4u-actor-create.cpp @@ -73,7 +73,7 @@ public: } void operator()() { - XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->getCname()); + XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->get_cname()); std::string* msg1 = static_cast(mailbox->get()); std::string* 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 b9a3636f76..caa9d5df13 100644 --- a/examples/s4u/actor-migration/s4u-actor-migration.cpp +++ b/examples/s4u/actor-migration/s4u-actor-migration.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -25,17 +25,17 @@ static void worker(simgrid::s4u::Host* first, simgrid::s4u::Host* second) { double flopAmount = first->getSpeed() * 5 + second->getSpeed() * 5; - XBT_INFO("Let's move to %s to execute %.2f Mflops (5sec on %s and 5sec on %s)", first->getCname(), flopAmount / 1e6, - first->getCname(), second->getCname()); + XBT_INFO("Let's move to %s to execute %.2f Mflops (5sec on %s and 5sec on %s)", first->get_cname(), flopAmount / 1e6, + first->get_cname(), second->get_cname()); simgrid::s4u::this_actor::migrate(first); simgrid::s4u::this_actor::execute(flopAmount); - XBT_INFO("I wake up on %s. Let's suspend a bit", simgrid::s4u::this_actor::getHost()->getCname()); + XBT_INFO("I wake up on %s. Let's suspend a bit", simgrid::s4u::this_actor::getHost()->get_cname()); simgrid::s4u::this_actor::suspend(); - XBT_INFO("I wake up on %s", simgrid::s4u::this_actor::getHost()->getCname()); + XBT_INFO("I wake up on %s", simgrid::s4u::this_actor::getHost()->get_cname()); XBT_INFO("Done"); } @@ -49,11 +49,11 @@ static void monitor() simgrid::s4u::this_actor::sleep_for(5); - XBT_INFO("After 5 seconds, move the process to %s", jacquelin->getCname()); + XBT_INFO("After 5 seconds, move the process to %s", jacquelin->get_cname()); actor->migrate(jacquelin); simgrid::s4u::this_actor::sleep_until(15); - XBT_INFO("At t=15, move the process to %s and resume it.", fafard->getCname()); + XBT_INFO("At t=15, move the process to %s and resume it.", fafard->get_cname()); actor->migrate(fafard); actor->resume(); } diff --git a/examples/s4u/app-bittorrent/s4u-bittorrent.hpp b/examples/s4u/app-bittorrent/s4u-bittorrent.hpp index 61e64bda80..0125588b5d 100644 --- a/examples/s4u/app-bittorrent/s4u-bittorrent.hpp +++ b/examples/s4u/app-bittorrent/s4u-bittorrent.hpp @@ -92,7 +92,7 @@ public: explicit HostBittorrent(simgrid::s4u::Host* ptr) : host(ptr) { - std::string descr = std::string("RngSream<") + host->getCname() + ">"; + std::string descr = std::string("RngSream<") + host->get_cname() + ">"; stream_ = RngStream_CreateStream(descr.c_str()); } diff --git a/examples/s4u/app-bittorrent/s4u-peer.cpp b/examples/s4u/app-bittorrent/s4u-peer.cpp index 8f9bc799cc..d91a7450b5 100644 --- a/examples/s4u/app-bittorrent/s4u-peer.cpp +++ b/examples/s4u/app-bittorrent/s4u-peer.cpp @@ -129,13 +129,13 @@ void Peer::sendHandshakeToAllPeers() void Peer::sendMessage(simgrid::s4u::MailboxPtr mailbox, e_message_type type, uint64_t size) { const char* type_names[6] = {"HANDSHAKE", "CHOKE", "UNCHOKE", "INTERESTED", "NOTINTERESTED", "CANCEL"}; - XBT_DEBUG("Sending %s to %s", type_names[type], mailbox->getCname()); + XBT_DEBUG("Sending %s to %s", type_names[type], mailbox->get_cname()); mailbox->put_init(new Message(type, id, bitfield_, mailbox_), size)->detach(); } void Peer::sendBitfield(simgrid::s4u::MailboxPtr mailbox) { - XBT_DEBUG("Sending a BITFIELD to %s", mailbox->getCname()); + XBT_DEBUG("Sending a BITFIELD to %s", mailbox->get_cname()); mailbox ->put_init(new Message(MESSAGE_BITFIELD, id, bitfield_, mailbox_), MESSAGE_BITFIELD_SIZE + BITS_TO_BYTES(FILE_PIECES)) @@ -145,7 +145,7 @@ void Peer::sendBitfield(simgrid::s4u::MailboxPtr mailbox) void Peer::sendPiece(simgrid::s4u::MailboxPtr mailbox, unsigned int piece, int block_index, int block_length) { xbt_assert(not hasNotPiece(piece), "Tried to send a unavailable piece."); - XBT_DEBUG("Sending the PIECE %u (%d,%d) to %s", piece, block_index, block_length, mailbox->getCname()); + XBT_DEBUG("Sending the PIECE %u (%d,%d) to %s", piece, block_index, block_length, mailbox->get_cname()); mailbox->put_init(new Message(MESSAGE_PIECE, id, mailbox_, piece, block_index, block_length), BLOCK_SIZE)->detach(); } @@ -165,7 +165,7 @@ void Peer::sendRequestTo(Connection* remote_peer, unsigned int piece) int block_index = getFirstMissingBlockFrom(piece); if (block_index != -1) { int block_length = std::min(BLOCKS_REQUESTED, PIECES_BLOCKS - block_index); - XBT_DEBUG("Sending a REQUEST to %s for piece %u (%d,%d)", remote_peer->mailbox_->getCname(), piece, block_index, + XBT_DEBUG("Sending a REQUEST to %s for piece %u (%d,%d)", remote_peer->mailbox_->get_cname(), piece, block_index, block_length); remote_peer->mailbox_ ->put_init(new Message(MESSAGE_REQUEST, id, mailbox_, piece, block_index, block_length), MESSAGE_REQUEST_SIZE) @@ -234,7 +234,7 @@ void Peer::leech() /* Send a "handshake" message to all the peers it got (since it couldn't have gotten more than 50 peers) */ sendHandshakeToAllPeers(); - XBT_DEBUG("Starting main leech loop listening on mailbox: %s", mailbox_->getCname()); + XBT_DEBUG("Starting main leech loop listening on mailbox: %s", mailbox_->get_cname()); void* data = nullptr; while (simgrid::s4u::Engine::getClock() < deadline && countPieces(bitfield_) < FILE_PIECES) { @@ -300,7 +300,7 @@ void Peer::handleMessage() const char* type_names[10] = {"HANDSHAKE", "CHOKE", "UNCHOKE", "INTERESTED", "NOTINTERESTED", "HAVE", "BITFIELD", "REQUEST", "PIECE", "CANCEL"}; - XBT_DEBUG("Received a %s message from %s", type_names[message->type], message->return_mailbox->getCname()); + XBT_DEBUG("Received a %s message from %s", type_names[message->type], message->return_mailbox->get_cname()); auto known_peer = connected_peers.find(message->peer_id); Connection* remote_peer = (known_peer == connected_peers.end()) ? nullptr : known_peer->second; diff --git a/examples/s4u/app-chainsend/s4u-app-chainsend.cpp b/examples/s4u/app-chainsend/s4u-app-chainsend.cpp index 1cf5920fc0..0ea2afdb19 100644 --- a/examples/s4u/app-chainsend/s4u-app-chainsend.cpp +++ b/examples/s4u/app-chainsend/s4u-app-chainsend.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2010, 2012-2015, 2017. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -43,7 +42,7 @@ public: unsigned int received_pieces = 0; unsigned int total_pieces = 0; - Peer() { me = simgrid::s4u::Mailbox::byName(simgrid::s4u::Host::current()->getCname()); } + Peer() { me = simgrid::s4u::Mailbox::byName(simgrid::s4u::Host::current()->get_cname()); } ~Peer() = default; void joinChain() @@ -52,8 +51,8 @@ public: prev = msg->prev_; next = msg->next_; total_pieces = msg->num_pieces; - XBT_DEBUG("Peer %s got a 'BUILD_CHAIN' message (prev: %s / next: %s)", me->getCname(), - prev ? prev->getCname() : nullptr, next ? next->getCname() : nullptr); + XBT_DEBUG("Peer %s got a 'BUILD_CHAIN' message (prev: %s / next: %s)", me->get_cname(), + prev ? prev->get_cname() : nullptr, next ? next->get_cname() : nullptr); delete msg; } @@ -69,10 +68,10 @@ public: int idx = simgrid::s4u::Comm::wait_any(&pending_recvs); if (idx != -1) { comm = pending_recvs.at(idx); - XBT_DEBUG("Peer %s got a 'SEND_DATA' message", me->getCname()); + XBT_DEBUG("Peer %s got a 'SEND_DATA' message", me->get_cname()); pending_recvs.erase(pending_recvs.begin() + idx); if (next != nullptr) { - XBT_DEBUG("Sending (asynchronously) from %s to %s", me->getCname(), next->getCname()); + XBT_DEBUG("Sending (asynchronously) from %s to %s", me->get_cname(), next->get_cname()); simgrid::s4u::CommPtr send = next->put_async(received, MESSAGE_SEND_DATA_HEADER_SIZE + PIECE_SIZE); pending_sends.push_back(send); } else @@ -119,8 +118,8 @@ public: next = nullptr; XBT_DEBUG("Building chain--broadcaster:\"%s\" dest:\"%s\" prev:\"%s\" next:\"%s\"", - simgrid::s4u::Host::current()->getCname(), current_mailbox->getCname(), - prev ? prev->getCname() : nullptr, next ? next->getCname() : nullptr); + simgrid::s4u::Host::current()->get_cname(), current_mailbox->get_cname(), + prev ? prev->get_cname() : nullptr, next ? next->get_cname() : nullptr); /* Send message to current peer */ current_mailbox->put(new ChainMessage(prev, next, piece_count), MESSAGE_BUILD_CHAIN_SIZE); @@ -135,7 +134,7 @@ public: std::vector pending_sends; for (unsigned int current_piece = 0; current_piece < piece_count; current_piece++) { XBT_DEBUG("Sending (send) piece %u from %s into mailbox %s", current_piece, - simgrid::s4u::Host::current()->getCname(), first->getCname()); + simgrid::s4u::Host::current()->get_cname(), first->get_cname()); simgrid::s4u::CommPtr comm = first->put_async(new FilePiece(), MESSAGE_SEND_DATA_HEADER_SIZE + PIECE_SIZE); pending_sends.push_back(comm); } diff --git a/examples/s4u/app-masterworker/s4u-app-masterworker.cpp b/examples/s4u/app-masterworker/s4u-app-masterworker.cpp index 199299ae05..c17f3f005f 100644 --- a/examples/s4u/app-masterworker/s4u-app-masterworker.cpp +++ b/examples/s4u/app-masterworker/s4u-app-masterworker.cpp @@ -37,7 +37,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->getCname()); + number_of_tasks, mailbox->get_cname()); /* - Send the computation amount to the @ref worker */ mailbox->put(new double(comp_size), comm_size); diff --git a/examples/s4u/app-pingpong/s4u-app-pingpong.cpp b/examples/s4u/app-pingpong/s4u-app-pingpong.cpp index a644f694fd..9d42450660 100644 --- a/examples/s4u/app-pingpong/s4u-app-pingpong.cpp +++ b/examples/s4u/app-pingpong/s4u-app-pingpong.cpp @@ -21,7 +21,7 @@ static void pinger(std::vector args) simgrid::s4u::Mailbox::byName(args[0])->put(payload, 1); /* - ... then wait for the (large) pong */ double* sender_time = - static_cast(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getName())->get()); + static_cast(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->get_name())->get()); double communication_time = simgrid::s4u::Engine::getClock() - *sender_time; XBT_INFO("Task received : large communication (bandwidth bound)"); @@ -38,7 +38,7 @@ static void ponger(std::vector args) /* - Receive the (small) ping first ....*/ double* sender_time = - static_cast(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getName())->get()); + static_cast(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->get_name())->get()); double communication_time = simgrid::s4u::Engine::getClock() - *sender_time; XBT_INFO("Task received : small communication (latency bound)"); XBT_INFO(" Ping time (latency bound) %f", communication_time); 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 f9535065c1..d27e25f635 100644 --- a/examples/s4u/app-token-ring/s4u-app-token-ring.cpp +++ b/examples/s4u/app-token-ring/s4u-app-token-ring.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -23,7 +23,7 @@ public: void operator()() { try { - rank = std::stoi(simgrid::s4u::this_actor::getName()); + rank = std::stoi(simgrid::s4u::this_actor::get_name()); } catch (std::invalid_argument& ia) { throw std::invalid_argument(std::string("Processes of this example must have a numerical name, not ") + ia.what()); @@ -38,7 +38,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->getCname()); + XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->get_cname()); std::string msg = "Token"; neighbor_mailbox->put(&msg, task_comm_size); std::string* res = static_cast(my_mailbox->get()); @@ -46,7 +46,7 @@ public: } else { std::string* res = static_cast(my_mailbox->get()); XBT_INFO("Host \"%u\" received \"%s\"", rank, res->c_str()); - XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->getCname()); + XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->get_cname()); neighbor_mailbox->put(res, task_comm_size); } } diff --git a/examples/s4u/cloud-capping/s4u-cloud-capping.cpp b/examples/s4u/cloud-capping/s4u-cloud-capping.cpp index e8a9ec2c01..3c98edf7aa 100644 --- a/examples/s4u/cloud-capping/s4u-cloud-capping.cpp +++ b/examples/s4u/cloud-capping/s4u-cloud-capping.cpp @@ -46,7 +46,7 @@ static void worker_busy_loop(const char* name, double speed) simgrid::s4u::this_actor::sleep_for(100); double exec_remain_now = exec->getRemains(); double flops_per_sec = exec_remain_prev - exec_remain_now; - XBT_INFO("%s@%s: %.0f flops/s", name, simgrid::s4u::this_actor::getHost()->getCname(), flops_per_sec / 100); + XBT_INFO("%s@%s: %.0f flops/s", name, simgrid::s4u::this_actor::getHost()->get_cname(), flops_per_sec / 100); exec_remain_prev = exec_remain_now; simgrid::s4u::this_actor::sleep_for(1); } @@ -77,27 +77,27 @@ static void test_one_task(simgrid::s4u::Host* host) XBT_INFO("### Test: with/without MSG_task_set_bound"); - XBT_INFO("### Test: no bound for Task1@%s", host->getCname()); + XBT_INFO("### Test: no bound for Task1@%s", host->get_cname()); simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, false, 0); simgrid::s4u::this_actor::sleep_for(1000); - XBT_INFO("### Test: 50%% for Task1@%s", host->getCname()); + XBT_INFO("### Test: 50%% for Task1@%s", host->get_cname()); simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, true, cpu_speed / 2); simgrid::s4u::this_actor::sleep_for(1000); - XBT_INFO("### Test: 33%% for Task1@%s", host->getCname()); + XBT_INFO("### Test: 33%% for Task1@%s", host->get_cname()); simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, true, cpu_speed / 3); simgrid::s4u::this_actor::sleep_for(1000); - XBT_INFO("### Test: zero for Task1@%s (i.e., unlimited)", host->getCname()); + XBT_INFO("### Test: zero for Task1@%s (i.e., unlimited)", host->get_cname()); simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, true, 0); simgrid::s4u::this_actor::sleep_for(1000); - XBT_INFO("### Test: 200%% for Task1@%s (i.e., meaningless)", host->getCname()); + XBT_INFO("### Test: 200%% for Task1@%s (i.e., meaningless)", host->get_cname()); simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, true, cpu_speed * 2); simgrid::s4u::this_actor::sleep_for(1000); @@ -108,8 +108,8 @@ static void test_two_tasks(simgrid::s4u::Host* hostA, simgrid::s4u::Host* hostB) const double cpu_speed = hostA->getSpeed(); xbt_assert(cpu_speed == hostB->getSpeed()); const double computation_amount = cpu_speed * 10; - const char* hostA_name = hostA->getCname(); - const char* hostB_name = hostB->getCname(); + const char* hostA_name = hostA->get_cname(); + const char* hostB_name = hostB->get_cname(); XBT_INFO("### Test: no bound for Task1@%s, no bound for Task2@%s", hostA_name, hostB_name); simgrid::s4u::Actor::createActor("worker0", hostA, worker, computation_amount, false, 0); diff --git a/examples/s4u/cloud-migration/s4u-cloud-migration.cpp b/examples/s4u/cloud-migration/s4u-cloud-migration.cpp index 8fa4b17bd6..2471b44cc6 100644 --- a/examples/s4u/cloud-migration/s4u-cloud-migration.cpp +++ b/examples/s4u/cloud-migration/s4u-cloud-migration.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2015, 2017. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -17,7 +16,7 @@ static void vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst sg_vm_migrate(vm, dst_pm); double mig_end = simgrid::s4u::Engine::getClock(); - XBT_INFO("%s migrated: %s->%s in %g s", vm->getCname(), src_pm->getCname(), dst_pm->getCname(), mig_end - mig_sta); + XBT_INFO("%s migrated: %s->%s in %g s", vm->get_cname(), src_pm->get_cname(), dst_pm->get_cname(), mig_end - mig_sta); } static void vm_migrate_async(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm) diff --git a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp index 1ff8dd558c..b1fb9508dd 100644 --- a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp +++ b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp @@ -15,8 +15,8 @@ static void computation_fun() simgrid::s4u::this_actor::execute(1000000); double clock_end = simgrid::s4u::Engine::getClock(); - XBT_INFO("%s:%s task executed %g", simgrid::s4u::this_actor::getHost()->getCname(), - simgrid::s4u::this_actor::getCname(), clock_end - clock_sta); + XBT_INFO("%s:%s task executed %g", simgrid::s4u::this_actor::getHost()->get_cname(), + simgrid::s4u::this_actor::get_cname(), clock_end - clock_sta); } static void launch_computation_worker(s4u_Host* host) @@ -34,7 +34,7 @@ static void communication_tx_fun(std::vector args) { simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(args.at(0)); s_payload* payload = new s_payload; - payload->tx_actor_name = simgrid::s4u::Actor::self()->getCname(); + payload->tx_actor_name = simgrid::s4u::Actor::self()->get_cname(); payload->tx_host = simgrid::s4u::this_actor::getHost(); payload->clock_sta = simgrid::s4u::Engine::getClock(); @@ -43,14 +43,14 @@ static void communication_tx_fun(std::vector args) static void communication_rx_fun(std::vector args) { - const char* actor_name = simgrid::s4u::Actor::self()->getCname(); - const char* host_name = simgrid::s4u::this_actor::getHost()->getCname(); + const char* actor_name = simgrid::s4u::Actor::self()->get_cname(); + const char* host_name = simgrid::s4u::this_actor::getHost()->get_cname(); simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(args.at(0)); struct s_payload* payload = static_cast(mbox->get()); double clock_end = simgrid::s4u::Engine::getClock(); - XBT_INFO("%s:%s to %s:%s => %g sec", payload->tx_host->getCname(), payload->tx_actor_name, host_name, actor_name, + XBT_INFO("%s:%s to %s:%s => %g sec", payload->tx_host->get_cname(), payload->tx_actor_name, host_name, actor_name, clock_end - payload->clock_sta); delete payload; @@ -58,7 +58,7 @@ static void communication_rx_fun(std::vector args) static void launch_communication_worker(s4u_Host* tx_host, s4u_Host* rx_host) { - std::string mbox_name = std::string("MBOX:") + tx_host->getCname() + "-" + rx_host->getCname(); + std::string mbox_name = std::string("MBOX:") + tx_host->get_cname() + "-" + rx_host->get_cname(); std::vector args; args.push_back(mbox_name); diff --git a/examples/s4u/dht-chord/s4u-dht-chord-node.cpp b/examples/s4u/dht-chord/s4u-dht-chord-node.cpp index 4a73c0f4e1..9cc987fdfb 100644 --- a/examples/s4u/dht-chord/s4u-dht-chord-node.cpp +++ b/examples/s4u/dht-chord/s4u-dht-chord-node.cpp @@ -235,7 +235,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->getCname()); + message->answer_to->get_cname()); simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data); try { @@ -280,7 +280,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->getCname()); + message->answer_to->get_cname()); simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data); try { @@ -432,7 +432,7 @@ 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->getCname(), message->request_id, + message->issuer_host_name.c_str(), message->answer_to->get_cname(), message->request_id, message->answer_id); message->answer_to->put_init(message, 10)->detach(ChordMessage::destroy); } else { @@ -450,7 +450,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->getCname(), message->answer_id); + message->issuer_host_name.c_str(), message->answer_to->get_cname(), message->answer_id); message->answer_to->put_init(message, 10)->detach(ChordMessage::destroy); break; @@ -488,7 +488,7 @@ void Node::handleMessage(ChordMessage* message) 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->getCname()); + message->answer_to->get_cname()); message->answer_to->put_init(message, 10)->detach(ChordMessage::destroy); break; diff --git a/examples/s4u/dht-chord/s4u-dht-chord.hpp b/examples/s4u/dht-chord/s4u-dht-chord.hpp index ff05252d82..016cba3fda 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->getCname() + ">"; + std::string descr = std::string("RngSream<") + host->get_cname() + ">"; stream_ = RngStream_CreateStream(descr.c_str()); } @@ -64,7 +64,7 @@ public: 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::getHost()->getName()) + : type(type), issuer_host_name(simgrid::s4u::this_actor::getHost()->get_name()) { } diff --git a/examples/s4u/dht-kademlia/node.cpp b/examples/s4u/dht-kademlia/node.cpp index b5e10fec82..ba7f12f8bb 100644 --- a/examples/s4u/dht-kademlia/node.cpp +++ b/examples/s4u/dht-kademlia/node.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2010, 2012-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -83,7 +82,7 @@ void Node::sendFindNode(unsigned int id, unsigned int destination) simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id)); /* Build the task */ Message* msg = new Message(id_, destination, simgrid::s4u::Mailbox::byName(std::to_string(id_)), - simgrid::s4u::Host::current()->getCname()); + simgrid::s4u::Host::current()->get_cname()); /* Send the task */ mailbox->put_init(msg, 1)->detach(kademlia::destroy); @@ -217,7 +216,7 @@ bool Node::findNode(unsigned int id_to_find, bool count_in_stats) answers++; nodes_added = node_list->merge(msg->answer_); - XBT_DEBUG("Received an answer from %s (%s) with %zu nodes on it", msg->answer_to_->getCname(), + XBT_DEBUG("Received an answer from %s (%s) with %zu nodes on it", msg->answer_to_->get_cname(), msg->issuer_host_name_, msg->answer_->nodes.size()); } else { if (msg->answer_) { @@ -272,12 +271,12 @@ void Node::randomLookup() void Node::handleFindNode(Message* msg) { routingTableUpdate(msg->sender_id_); - XBT_VERB("Received a FIND_NODE from %s (%s), he's trying to find %08x", msg->answer_to_->getCname(), + XBT_VERB("Received a FIND_NODE from %s (%s), he's trying to find %08x", msg->answer_to_->get_cname(), msg->issuer_host_name_, msg->destination_id_); // Building the answer to the request Message* answer = new Message(id_, msg->destination_id_, findClosest(msg->destination_id_), - simgrid::s4u::Mailbox::byName(std::to_string(id_)), simgrid::s4u::Host::current()->getCname()); + simgrid::s4u::Mailbox::byName(std::to_string(id_)), simgrid::s4u::Host::current()->get_cname()); // Sending the answer msg->answer_to_->put_init(answer, 1)->detach(kademlia::destroy); } diff --git a/examples/s4u/exec-ptask/s4u-exec-ptask.cpp b/examples/s4u/exec-ptask/s4u-exec-ptask.cpp index 4f9b81ab07..a09f342fb9 100644 --- a/examples/s4u/exec-ptask/s4u-exec-ptask.cpp +++ b/examples/s4u/exec-ptask/s4u-exec-ptask.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -76,7 +76,7 @@ static void runner() communication_amounts = new double[hosts_count * hosts_count](); simgrid::s4u::this_actor::parallel_execute(hosts_count, hosts.data(), computation_amounts, communication_amounts); - XBT_INFO("Finally, trick the ptask to do a 'remote execution', on host %s", hosts[1]->getCname()); + XBT_INFO("Finally, trick the ptask to do a 'remote execution', on host %s", hosts[1]->get_cname()); computation_amounts = new double[1]{1e9}; simgrid::s4u::Host* remote[] = {hosts[1]}; diff --git a/examples/s4u/io-file-remote/s4u-io-file-remote.cpp b/examples/s4u/io-file-remote/s4u-io-file-remote.cpp index 2a2359034f..dca06d5625 100644 --- a/examples/s4u/io-file-remote/s4u-io-file-remote.cpp +++ b/examples/s4u/io-file-remote/s4u-io-file-remote.cpp @@ -35,11 +35,11 @@ static int host(int argc, char* argv[]) if (std::stoi(argv[5]) != 0) { XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename, remoteFile.size(), - simgrid::s4u::Host::current()->getCname(), argv[3]); + simgrid::s4u::Host::current()->get_cname(), argv[3]); remoteFile.remoteMove(simgrid::s4u::Host::by_name(argv[3]), argv[4]); } else { XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename, remoteFile.size(), - simgrid::s4u::Host::current()->getCname(), argv[3]); + simgrid::s4u::Host::current()->get_cname(), argv[3]); remoteFile.remoteCopy(simgrid::s4u::Host::by_name(argv[3]), argv[4]); } } @@ -58,14 +58,14 @@ int main(int argc, char** argv) for (auto const& s : allStorages) { XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA, - sg_storage_get_size_free(s) / INMEGA, s->getCname()); + sg_storage_get_size_free(s) / INMEGA, s->get_cname()); } e.run(); for (auto const& s : allStorages) { XBT_INFO("End: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA, - sg_storage_get_size_free(s) / INMEGA, s->getCname()); + sg_storage_get_size_free(s) / INMEGA, s->get_cname()); } XBT_INFO("Simulation time %g", simgrid::s4u::Engine::getClock()); diff --git a/examples/s4u/io-file-system/s4u-io-file-system.cpp b/examples/s4u/io-file-system/s4u-io-file-system.cpp index 832d267821..52311394eb 100644 --- a/examples/s4u/io-file-system/s4u-io-file-system.cpp +++ b/examples/s4u/io-file-system/s4u-io-file-system.cpp @@ -15,14 +15,14 @@ class MyHost { public: void show_info(std::unordered_map const& mounts) { - XBT_INFO("Storage info on %s:", simgrid::s4u::Host::current()->getCname()); + XBT_INFO("Storage info on %s:", simgrid::s4u::Host::current()->get_cname()); for (auto const& kv : mounts) { std::string mountpoint = kv.first; simgrid::s4u::Storage* storage = kv.second; // Retrieve disk's information - XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", storage->getCname(), mountpoint.c_str(), + XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", storage->get_cname(), mountpoint.c_str(), sg_storage_get_size_used(storage), sg_storage_get_size_free(storage), sg_storage_get_size(storage)); } } @@ -71,7 +71,7 @@ public: delete file; // Now attach some user data to disk1 - XBT_INFO("Get/set data for storage element: %s", storage->getCname()); + XBT_INFO("Get/set data for storage element: %s", storage->get_cname()); XBT_INFO(" Uninitialized storage data: '%s'", static_cast(storage->getUserdata())); storage->setUserdata(new std::string("Some user data")); diff --git a/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp b/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp index 7ab871bdba..17bf750a9b 100644 --- a/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp +++ b/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -12,7 +12,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(storage, "Messages specific for this simulation"); static void host() { /* - Display information on the disks mounted by the current host */ - XBT_INFO("*** Storage info on %s ***", simgrid::s4u::Host::current()->getCname()); + XBT_INFO("*** Storage info on %s ***", simgrid::s4u::Host::current()->get_cname()); /* - Retrieve all mount points of current host */ std::unordered_map const& storage_list = @@ -20,7 +20,7 @@ static void host() /* - For each disk mounted on host, display disk name and mount point */ for (auto const& kv : storage_list) - XBT_INFO("Storage name: %s, mount name: %s", kv.second->getCname(), kv.first.c_str()); + XBT_INFO("Storage name: %s, mount name: %s", kv.second->get_cname(), kv.first.c_str()); /* - Write 200,000 bytes on Disk4 */ simgrid::s4u::Storage* storage = simgrid::s4u::Storage::byName("Disk4"); diff --git a/examples/s4u/platform-properties/s4u-platform-properties.cpp b/examples/s4u/platform-properties/s4u-platform-properties.cpp index f2a948da4e..0194a22867 100644 --- a/examples/s4u/platform-properties/s4u-platform-properties.cpp +++ b/examples/s4u/platform-properties/s4u-platform-properties.cpp @@ -108,7 +108,7 @@ int main(int argc, char* argv[]) XBT_INFO("There are %zu hosts in the environment", totalHosts); std::vector hosts = e.getAllHosts(); for (unsigned int i = 0; i < hosts.size(); i++) - XBT_INFO("Host '%s' runs at %.0f flops/s", hosts[i]->getCname(), hosts[i]->getSpeed()); + XBT_INFO("Host '%s' runs at %.0f flops/s", hosts[i]->get_cname(), hosts[i]->getSpeed()); e.loadDeployment(argv[2]); e.run(); diff --git a/examples/s4u/replay-comm/s4u-replay-comm.cpp b/examples/s4u/replay-comm/s4u-replay-comm.cpp index 42c94811c0..c9ee2550c6 100644 --- a/examples/s4u/replay-comm/s4u-replay-comm.cpp +++ b/examples/s4u/replay-comm/s4u-replay-comm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2009-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -62,9 +62,9 @@ public: double size = std::stod(action[3]); std::string* payload = new std::string(action[3]); double clock = simgrid::s4u::Engine::getClock(); - simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getName() + "_" + action[2]); + simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::get_name() + "_" + action[2]); ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME.c_str(), size, - simgrid::s4u::this_actor::getCname(), to->getCname()); + simgrid::s4u::this_actor::get_cname(), to->get_cname()); to->put(payload, size); delete payload; @@ -75,10 +75,10 @@ public: { double clock = simgrid::s4u::Engine::getClock(); simgrid::s4u::MailboxPtr from = - simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::getName()); + simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::get_name()); - ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME.c_str(), simgrid::s4u::this_actor::getCname(), - from->getCname()); + ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME.c_str(), simgrid::s4u::this_actor::get_cname(), + from->get_cname()); from->get(); log_action(action, simgrid::s4u::Engine::getClock() - clock); } diff --git a/examples/s4u/replay-storage/s4u-replay-storage.cpp b/examples/s4u/replay-storage/s4u-replay-storage.cpp index 3d69a72462..9869aeee0d 100644 --- a/examples/s4u/replay-storage/s4u-replay-storage.cpp +++ b/examples/s4u/replay-storage/s4u-replay-storage.cpp @@ -31,7 +31,7 @@ static void log_action(simgrid::xbt::ReplayAction& action, double date) static simgrid::s4u::File* get_file_descriptor(std::string file_name) { - std::string full_name = simgrid::s4u::this_actor::getName() + ":" + file_name; + std::string full_name = simgrid::s4u::this_actor::get_name() + ":" + file_name; return opened_files.at(full_name); } @@ -62,7 +62,7 @@ public: { std::string file_name = action[2]; double clock = simgrid::s4u::Engine::getClock(); - std::string full_name = simgrid::s4u::this_actor::getName() + ":" + file_name; + std::string full_name = simgrid::s4u::this_actor::get_name() + ":" + file_name; ACT_DEBUG("Entering Open: %s (filename: %s)", NAME.c_str(), file_name.c_str()); simgrid::s4u::File* file = new simgrid::s4u::File(file_name, NULL); diff --git a/examples/s4u/routing-get-clusters/s4u-routing-get-clusters.cpp b/examples/s4u/routing-get-clusters/s4u-routing-get-clusters.cpp index f4a0b0b89c..f6fb2d9ad9 100644 --- a/examples/s4u/routing-get-clusters/s4u-routing-get-clusters.cpp +++ b/examples/s4u/routing-get-clusters/s4u-routing-get-clusters.cpp @@ -20,11 +20,11 @@ int main(int argc, char* argv[]) e.getNetzoneByType(clusters); for (auto c : *clusters) { - XBT_INFO("%s", c->getCname()); + XBT_INFO("%s", c->get_cname()); std::vector* hosts = new std::vector; c->getHosts(hosts); for (auto h : *hosts) - XBT_INFO(" %s", h->getCname()); + XBT_INFO(" %s", h->get_cname()); delete hosts; } @@ -37,7 +37,7 @@ int main(int argc, char* argv[]) if (not dragonfly_clusters->empty()) { for (auto d : *dragonfly_clusters) { - XBT_INFO("%s' dragonfly topology:", d->getCname()); + XBT_INFO("%s' dragonfly topology:", d->get_cname()); for (int i = 0; i < d->getHostCount(); i++) { unsigned int coords[4]; d->rankId_to_coords(i, &coords); diff --git a/examples/simdag/test/sd_test.cpp b/examples/simdag/test/sd_test.cpp index 63ccade699..ea379dc4e4 100644 --- a/examples/simdag/test/sd_test.cpp +++ b/examples/simdag/test/sd_test.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2006-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -34,10 +33,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->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("Computation time for %f flops on %s: %f", comp_amount1, h1->get_cname(), comp_amount1 / h1->getSpeed()); + XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, h2->get_cname(), comp_amount2 / h2->getSpeed()); - XBT_INFO("Route between %s and %s:", h1->getCname(), h2->getCname()); + XBT_INFO("Route between %s and %s:", h1->get_cname(), h2->get_cname()); std::vector route; double latency = 0; h1->routeTo(h2, route, &latency); @@ -47,9 +46,9 @@ 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->getCname(), h2->getCname(), + XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount12, h1->get_cname(), h2->get_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->getCname(), h1->getCname(), + XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount21, h2->get_cname(), h1->get_cname(), sg_host_route_latency(h2, h1) + comm_amount21 / sg_host_route_bandwidth(h2, h1)); /* creation of the tasks and their dependencies */ diff --git a/include/simgrid/kernel/resource/Resource.hpp b/include/simgrid/kernel/resource/Resource.hpp index 7c8c075da2..ee037cd3b7 100644 --- a/include/simgrid/kernel/resource/Resource.hpp +++ b/include/simgrid/kernel/resource/Resource.hpp @@ -38,9 +38,9 @@ public: Model* model() const; /** @brief Get the name of the current Resource */ - const std::string& getName() const; + const std::string& get_name() const; /** @brief Get the name of the current Resource */ - const char* getCname() const; + const char* get_cname() const; bool operator==(const Resource& other) const; @@ -95,7 +95,7 @@ template <> class hash { public: std::size_t operator()(const simgrid::kernel::resource::Resource& r) const { - return (std::size_t)xbt_str_hash(r.getCname()); + return (std::size_t)xbt_str_hash(r.get_cname()); } }; } // namespace std diff --git a/include/simgrid/kernel/routing/NetPoint.hpp b/include/simgrid/kernel/routing/NetPoint.hpp index fd2694753e..cc0d807982 100644 --- a/include/simgrid/kernel/routing/NetPoint.hpp +++ b/include/simgrid/kernel/routing/NetPoint.hpp @@ -31,8 +31,8 @@ public: // Our rank in the vertices_ array of the netzone that contains us. unsigned int id() { return id_; } - const std::string& getName() const { return name_; } - const char* getCname() const { return name_.c_str(); } + const std::string& get_name() const { return name_; } + const char* get_cname() const { return name_.c_str(); } /** @brief the NetZone in which this NetPoint is included */ NetZoneImpl* netzone() { return netzone_; } diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index e1b47f3697..6b37ba7b53 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -206,10 +206,16 @@ public: /** Returns whether or not this actor has been daemonized or not **/ bool isDaemon(); + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_name()") const simgrid::xbt::string& getName() const + { + return get_name(); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_cname()") const char* getCname() const { return get_cname(); } + /** Retrieves the name of that actor as a C++ string */ - const simgrid::xbt::string& getName() const; + const simgrid::xbt::string& get_name() const; /** Retrieves the name of that actor as a C string */ - const char* getCname() const; + const char* get_cname() const; /** Retrieves the host on which that actor is running */ s4u::Host* getHost(); /** Retrieves the PID of that actor @@ -328,10 +334,12 @@ XBT_PUBLIC aid_t getPid(); XBT_PUBLIC aid_t getPpid(); /** @brief Returns the name of the current actor. */ -XBT_PUBLIC std::string getName(); - +XBT_PUBLIC std::string get_name(); /** @brief Returns the name of the current actor as a C string. */ -XBT_PUBLIC const char* getCname(); +XBT_PUBLIC const char* get_cname(); + +XBT_ATTRIB_DEPRECATED_v323("Please use this_actor::get_name()") XBT_PUBLIC std::string getName(); +XBT_ATTRIB_DEPRECATED_v323("Please use this_actor::get_cname()") XBT_PUBLIC const char* getCname(); /** @brief Returns the name of the host on which the actor is running. */ XBT_PUBLIC Host* getHost(); diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index a87405b258..db09e0d4d5 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -65,10 +65,16 @@ public: /** Retrieves the host on which the current actor is running */ static s4u::Host* current(); + XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_name()") simgrid::xbt::string const& getName() const + { + return name_; + } + XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_cname()") const char* getCname() const { return name_.c_str(); } + /** Retrieves the name of that host as a C++ string */ - simgrid::xbt::string const& getName() const { return name_; } + simgrid::xbt::string const& get_name() const { return name_; } /** Retrieves the name of that host as a C string */ - const char* getCname() const { return name_.c_str(); } + const char* get_cname() const { return name_.c_str(); } void actorList(std::vector * whereto); diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index 83763044c9..d236911394 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -37,9 +37,12 @@ public: static Link* byName(const char* name); /** @brief Retrieves the name of that link as a C++ string */ - const std::string& getName() const; + const std::string& get_name() const; /** @brief Retrieves the name of that link as a C string */ - const char* getCname() const; + const char* get_cname() const; + + XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_name()") const std::string& getName() const { return get_name(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_cname()") const char* getCname() const { return get_cname(); } /** @brief Get the bandwidth in bytes per second of current Link */ double bandwidth(); @@ -89,7 +92,7 @@ public: /** @brief Callback signal fired when a communication changes it state (ready/done/cancel) */ static simgrid::xbt::signal onCommunicationStateChange; - XBT_ATTRIB_DEPRECATED_v321("Use getCname(): v3.21 will turn this warning into an error.") const char* name(); + XBT_ATTRIB_DEPRECATED_v321("Use get_cname(): v3.21 will turn this warning into an error.") const char* name(); }; } } diff --git a/include/simgrid/s4u/Mailbox.hpp b/include/simgrid/s4u/Mailbox.hpp index 642ce4a386..827bc8a19c 100644 --- a/include/simgrid/s4u/Mailbox.hpp +++ b/include/simgrid/s4u/Mailbox.hpp @@ -120,10 +120,16 @@ public: /** private function, do not use. FIXME: make me protected */ kernel::activity::MailboxImpl* getImpl() { return pimpl_; } + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_name()") const simgrid::xbt::string& getName() const + { + return get_name(); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_cname()") const char* getCname() const { return get_cname(); } + /** @brief Retrieves the name of that mailbox as a C++ string */ - const simgrid::xbt::string& getName() const; + const simgrid::xbt::string& get_name() const; /** @brief Retrieves the name of that mailbox as a C string */ - const char* getCname() const; + const char* get_cname() const; /** Retrieve the mailbox associated to the given C string */ static MailboxPtr byName(const char *name); diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index a1935b7b62..da36a0326c 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -39,11 +39,14 @@ public: /** @brief Seal your netzone once you're done adding content, and before routing stuff through it */ virtual void seal(); /** @brief Retrieves the name of that netzone as a C++ string */ - const std::string& getName() const { return name_; } + const std::string& get_name() const { return name_; } /** @brief Retrieves the name of that netzone as a C string */ - const char* getCname() const; + const char* get_cname() const; NetZone* getFather(); + XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_name()") const std::string& getName() const { return get_name(); } + XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_cname()") const char* getCname() const { return get_cname(); } + std::vector* getChildren(); // Sub netzones void getHosts(std::vector * whereto); // retrieve my content as a vector of hosts int getHostCount(); diff --git a/include/simgrid/s4u/Storage.hpp b/include/simgrid/s4u/Storage.hpp index dc9371074d..379648d5ae 100644 --- a/include/simgrid/s4u/Storage.hpp +++ b/include/simgrid/s4u/Storage.hpp @@ -32,10 +32,15 @@ public: virtual ~Storage() = default; /** Retrieve a Storage by its name. It must exist in the platform file */ static Storage* byName(std::string name); + + XBT_ATTRIB_DEPRECATED_v323("Please use Storage::get_name()") std::string const& getName() const { return get_name(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Storage::get_cname()") const char* getCname() const { return get_cname(); } + /** @brief Retrieves the name of that storage as a C++ string */ - std::string const& getName() const; + std::string const& get_name() const; /** @brief Retrieves the name of that storage as a C string */ - const char* getCname() const; + const char* get_cname() const; + const char* getType(); Host* getHost(); diff --git a/src/bindings/java/JavaContext.cpp b/src/bindings/java/JavaContext.cpp index 439c30b95e..87c5e9e229 100644 --- a/src/bindings/java/JavaContext.cpp +++ b/src/bindings/java/JavaContext.cpp @@ -130,7 +130,7 @@ void JavaContext::stop() // (as the ones created for the VM migration). The Java exception will not be catched anywhere. // Bad things happen currently if these actors get killed, unfortunately. jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", - std::string("Process ") + this->process()->getCname() + " killed from file JavaContext.cpp"); + std::string("Process ") + this->process()->get_cname() + " killed from file JavaContext.cpp"); // (remember that throwing a java exception from C does not break the C execution path. // Instead, it marks the exception to be raised when returning to the Java world and diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index 6ba8f4371b..6e5cbddce3 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -279,7 +279,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()->getCname()); + jstring jhostName = env->NewStringUTF(MSG_host_self()->get_cname()); 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 d921d3ef67..2bf2499b39 100644 --- a/src/bindings/java/jmsg_as.cpp +++ b/src/bindings/java/jmsg_as.cpp @@ -56,7 +56,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->getCname()); + return env->NewStringUTF(as->get_cname()); } JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, jobject jas) { @@ -141,11 +141,11 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo for (auto const& host : table) { jhost = static_cast(host->extension(JAVA_HOST_LEVEL)); if (not jhost) { - jname = env->NewStringUTF(host->getCname()); + jname = env->NewStringUTF(host->get_cname()); jhost = Java_org_simgrid_msg_Host_getByName(env, cls, jname); - env->ReleaseStringUTFChars(static_cast(jname), host->getCname()); + env->ReleaseStringUTFChars(static_cast(jname), host->get_cname()); } env->SetObjectArrayElement(jtable, index, jhost); diff --git a/src/bindings/java/jmsg_host.cpp b/src/bindings/java/jmsg_host.cpp index 6dc5b56364..166b570f59 100644 --- a/src/bindings/java/jmsg_host.cpp +++ b/src/bindings/java/jmsg_host.cpp @@ -121,7 +121,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost(JNIEnv * env, jc return nullptr; } /* Sets the host name */ - jobject jname = env->NewStringUTF(host->getCname()); + jobject jname = env->NewStringUTF(host->get_cname()); env->SetObjectField(jhost, jhost_field_Host_name, jname); /* Bind & store it */ jhost_bind(jhost, host, env); @@ -248,7 +248,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEn } for (auto const& elm : mounted_storages) { - jname = env->NewStringUTF(elm.second->getCname()); + jname = env->NewStringUTF(elm.second->get_cname()); jstorage = Java_org_simgrid_msg_Storage_getByName(env,cls,jname); env->SetObjectArrayElement(jtable, index, jstorage); index++; @@ -313,7 +313,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->getCname()); + jstring jname = env->NewStringUTF(host->get_cname()); 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 7f35793470..8f7cb8640f 100644 --- a/src/bindings/lua/lua_host.cpp +++ b/src/bindings/lua/lua_host.cpp @@ -75,7 +75,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->getCname()); + lua_pushstring(L, ht->get_cname()); return 1; } diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index b1ff48d7d3..96d7760e24 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -308,7 +308,7 @@ static void instr_user_srcdst_variable(double time, const char *src, const char std::vector route; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(src_elm, dst_elm, route, nullptr); for (auto const& link : route) - instr_user_variable(time, link->getCname(), variable, father_type, value, what, nullptr, &user_link_variables); + instr_user_variable(time, link->get_cname(), variable, father_type, value, what, nullptr, &user_link_variables); } /** \ingroup TRACE_API diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index 2f7a00fd47..97c2351414 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -39,7 +39,7 @@ NetZoneContainer::NetZoneContainer(std::string name, unsigned int level, NetZone xbt_assert(netpoint_, "Element '%s' not found", name.c_str()); if (father_) { type_ = father_->type_->getOrCreateContainerType(std::string("L") + std::to_string(level)); - father_->children_.insert({getName(), this}); + father_->children_.insert({get_name(), this}); logCreation(); } else { type_ = new ContainerType("0"); @@ -54,18 +54,18 @@ RouterContainer::RouterContainer(std::string name, Container* father) : Containe netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name); xbt_assert(netpoint_, "Element '%s' not found", name.c_str()); - trivaNodeTypes.insert(type_->getName()); + trivaNodeTypes.insert(type_->get_name()); } HostContainer::HostContainer(simgrid::s4u::Host& host, NetZoneContainer* father) - : Container::Container(host.getCname(), "HOST", father) + : Container::Container(host.get_cname(), "HOST", father) { xbt_assert(father, "Only the Root container has no father"); netpoint_ = host.pimpl_netpoint; - xbt_assert(netpoint_, "Element '%s' not found", host.getCname()); + xbt_assert(netpoint_, "Element '%s' not found", host.get_cname()); - trivaNodeTypes.insert(type_->getName()); + trivaNodeTypes.insert(type_->get_name()); } Container::Container(std::string name, std::string type_name, Container* father) : name_(name), father_(father) @@ -92,7 +92,7 @@ Container::Container(std::string name, std::string type_name, Container* father) //register NODE types for triva configuration if (type_name == "LINK") - trivaNodeTypes.insert(type_->getName()); + trivaNodeTypes.insert(type_->get_name()); } Container::~Container() @@ -137,7 +137,7 @@ Container* Container::byName(std::string name) void Container::removeFromParent() { if (father_) { - XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", getCname(), father_->getCname()); + XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", get_cname(), father_->get_cname()); father_->children_.erase(name_); } delete this; @@ -157,7 +157,7 @@ void Container::logCreation() stream << 0; else stream << timestamp; - stream << " " << id_ << " " << type_->getId() << " " << father_->id_ << " \"" << name_ << "\""; + stream << " " << id_ << " " << type_->get_id() << " " << father_->id_ << " \"" << name_ << "\""; XBT_DEBUG("Dump %s", stream.str().c_str()); fprintf(tracing_file, "%s\n", stream.str().c_str()); } else if (instr_fmt_type == instr_fmt_TI) { @@ -198,9 +198,9 @@ void Container::logDestruction() stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DestroyContainer << " "; /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */ if (timestamp < 1e-12) - stream << 0 << " " << type_->getId() << " " << id_; + stream << 0 << " " << type_->get_id() << " " << id_; else - stream << timestamp << " " << type_->getId() << " " << id_; + stream << timestamp << " " << type_->get_id() << " " << id_; XBT_DEBUG("Dump %s", stream.str().c_str()); fprintf(tracing_file, "%s\n", stream.str().c_str()); } else if (instr_fmt_type == instr_fmt_TI) { diff --git a/src/instr/instr_paje_containers.hpp b/src/instr/instr_paje_containers.hpp index 828024a97c..cada386a35 100644 --- a/src/instr/instr_paje_containers.hpp +++ b/src/instr/instr_paje_containers.hpp @@ -30,9 +30,9 @@ public: static Container* byNameOrNull(std::string name); static Container* byName(std::string name); - std::string getName() { return name_; } - const char* getCname() { return name_.c_str(); } - long long int getId() { return id_; } + std::string get_name() { return name_; } + const char* get_cname() { return name_.c_str(); } + long long int get_id() { return id_; } void removeFromParent(); void logCreation(); void logDestruction(); diff --git a/src/instr/instr_paje_events.cpp b/src/instr/instr_paje_events.cpp index c44aa81be3..c50abc0596 100644 --- a/src/instr/instr_paje_events.cpp +++ b/src/instr/instr_paje_events.cpp @@ -81,7 +81,7 @@ void NewEvent::print() stream << eventType_ << " " << 0 << " "; else stream << eventType_ << " " << timestamp_ << " "; - stream << getType()->getId() << " " << getContainer()->getId() << " " << val->getId(); + stream << getType()->get_id() << " " << getContainer()->get_id() << " " << val->getId(); XBT_DEBUG("Dump %s", stream.str().c_str()); fprintf(tracing_file, "%s\n", stream.str().c_str()); } @@ -94,11 +94,11 @@ void LinkEvent::print() if (instr_fmt_type != instr_fmt_paje) return; if (timestamp_ < 1e-12) - stream << eventType_ << " " << 0 << " " << getType()->getId() << " " << getContainer()->getId(); + stream << eventType_ << " " << 0 << " " << getType()->get_id() << " " << getContainer()->get_id(); else - stream << eventType_ << " " << timestamp_ << " " << getType()->getId() << " " << getContainer()->getId(); + stream << eventType_ << " " << timestamp_ << " " << getType()->get_id() << " " << getContainer()->get_id(); - stream << " " << value_ << " " << endpoint_->getId() << " " << key_; + stream << " " << value_ << " " << endpoint_->get_id() << " " << key_; if (TRACE_display_sizes()) { stream << " " << size_; @@ -119,7 +119,7 @@ void VariableEvent::print() stream << eventType_ << " " << 0 << " "; else stream << eventType_ << " " << timestamp_ << " "; - stream << getType()->getId() << " " << getContainer()->getId() << " " << value; + stream << getType()->get_id() << " " << getContainer()->get_id() << " " << value; XBT_DEBUG("Dump %s", stream.str().c_str()); fprintf(tracing_file, "%s\n", stream.str().c_str()); } @@ -131,9 +131,9 @@ void StateEvent::print() XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_); if (instr_fmt_type == instr_fmt_paje) { if (timestamp_ < 1e-12) - stream << eventType_ << " " << 0 << " " << getType()->getId() << " " << getContainer()->getId(); + stream << eventType_ << " " << 0 << " " << getType()->get_id() << " " << getContainer()->get_id(); else - stream << eventType_ << " " << timestamp_ << " " << getType()->getId() << " " << getContainer()->getId(); + stream << eventType_ << " " << timestamp_ << " " << getType()->get_id() << " " << getContainer()->get_id(); if (value != nullptr) // PAJE_PopState Event does not need to have a value stream << " " << value->getId(); @@ -155,11 +155,11 @@ void StateEvent::print() /* Unimplemented calls are: WAITANY, SENDRECV, SCAN, EXSCAN, SSEND, and ISSEND. */ // FIXME: dirty extract "rank-" from the name, as we want the bare process id here - if (getContainer()->getName().find("rank-") != 0) - stream << getContainer()->getName() << " " << extra_->print(); + if (getContainer()->get_name().find("rank-") != 0) + stream << getContainer()->get_name() << " " << extra_->print(); else /* Subtract -1 because this is the process id and we transform it to the rank id */ - stream << stoi(getContainer()->getName().erase(0, 5)) - 1 << " " << extra_->print(); + stream << stoi(getContainer()->get_name().erase(0, 5)) - 1 << " " << extra_->print(); fprintf(tracing_files.at(getContainer()), "%s\n", stream.str().c_str()); } else { diff --git a/src/instr/instr_paje_types.cpp b/src/instr/instr_paje_types.cpp index c0fa37271e..ffea6fc901 100644 --- a/src/instr/instr_paje_types.cpp +++ b/src/instr/instr_paje_types.cpp @@ -21,7 +21,7 @@ Type::Type(std::string name, std::string alias, std::string color, Type* father) if (father != nullptr){ father->children_.insert({alias, this}); - XBT_DEBUG("new type %s, child of %s", name_.c_str(), father->getCname()); + XBT_DEBUG("new type %s, child of %s", name_.c_str(), father->get_cname()); } } @@ -39,19 +39,19 @@ ValueType::~ValueType() ContainerType::ContainerType(std::string name, Type* father) : Type(name, name, "", father) { - XBT_DEBUG("ContainerType %s(%lld), child of %s(%lld)", getCname(), getId(), father->getCname(), father->getId()); + XBT_DEBUG("ContainerType %s(%lld), child of %s(%lld)", get_cname(), get_id(), father->get_cname(), father->get_id()); logDefinition(PAJE_DefineContainerType); } EventType::EventType(std::string name, Type* father) : ValueType(name, father) { - XBT_DEBUG("EventType %s(%lld), child of %s(%lld)", getCname(), getId(), father->getCname(), father->getId()); + XBT_DEBUG("EventType %s(%lld), child of %s(%lld)", get_cname(), get_id(), father->get_cname(), father->get_id()); logDefinition(PAJE_DefineEventType); } StateType::StateType(std::string name, Type* father) : ValueType(name, father) { - XBT_DEBUG("StateType %s(%lld), child of %s(%lld)", getCname(), getId(), father->getCname(), father->getId()); + XBT_DEBUG("StateType %s(%lld), child of %s(%lld)", get_cname(), get_id(), father->get_cname(), father->get_id()); logDefinition(PAJE_DefineStateType); } @@ -82,7 +82,7 @@ void StateType::popEvent() VariableType::VariableType(std::string name, std::string color, Type* father) : Type(name, name, color, father) { - XBT_DEBUG("VariableType %s(%lld), child of %s(%lld)", getCname(), getId(), father->getCname(), father->getId()); + XBT_DEBUG("VariableType %s(%lld), child of %s(%lld)", get_cname(), get_id(), father->get_cname(), father->get_id()); logDefinition(PAJE_DefineVariableType); } @@ -130,8 +130,8 @@ void Type::logDefinition(e_event_type event_type) return; std::stringstream stream; XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, event_type, TRACE_precision(), 0.); - stream << std::fixed << std::setprecision(TRACE_precision()) << event_type << " " << getId(); - stream << " " << father_->getId() << " " << getName(); + stream << std::fixed << std::setprecision(TRACE_precision()) << event_type << " " << get_id(); + stream << " " << father_->get_id() << " " << get_name(); if (isColored()) stream << " \"" << color_ << "\""; XBT_DEBUG("Dump %s", stream.str().c_str()); @@ -145,8 +145,8 @@ void Type::logDefinition(simgrid::instr::Type* source, simgrid::instr::Type* des return; std::stringstream stream; XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, PAJE_DefineLinkType, TRACE_precision(), 0.); - stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DefineLinkType << " " << getId(); - stream << " " << father_->getId() << " " << source->getId() << " " << dest->getId() << " " << getName(); + stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DefineLinkType << " " << get_id(); + stream << " " << father_->get_id() << " " << source->get_id() << " " << dest->get_id() << " " << get_name(); XBT_DEBUG("Dump %s", stream.str().c_str()); stream << std::endl; fprintf(tracing_file, "%s", stream.str().c_str()); @@ -165,7 +165,7 @@ Type* Type::byName(std::string name) } } if (ret == nullptr) - THROWF(tracing_error, 2, "type with name (%s) not found in father type (%s)", name.c_str(), getCname()); + THROWF(tracing_error, 2, "type with name (%s) not found in father type (%s)", name.c_str(), get_cname()); return ret; } @@ -183,7 +183,7 @@ void ValueType::addEntityValue(std::string name, std::string color) if (it == values_.end()) { EntityValue* new_val = new EntityValue(name, color, this); values_.insert({name, new_val}); - XBT_DEBUG("new value %s, child of %s", name.c_str(), getCname()); + XBT_DEBUG("new value %s, child of %s", name.c_str(), get_cname()); new_val->print(); } } @@ -192,7 +192,7 @@ EntityValue* ValueType::getEntityValue(std::string name) { auto ret = values_.find(name); if (ret == values_.end()) { - THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name.c_str(), getCname()); + THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name.c_str(), get_cname()); } return ret->second; } @@ -228,8 +228,8 @@ LinkType* Type::getOrCreateLinkType(std::string name, Type* source, Type* dest) auto it = children_.find(alias); if (it == children_.end()) { LinkType* ret = new LinkType(name, alias, this); - XBT_DEBUG("LinkType %s(%lld), child of %s(%lld) %s(%lld)->%s(%lld)", ret->getCname(), ret->getId(), getCname(), - getId(), source->getCname(), source->getId(), dest->getCname(), dest->getId()); + XBT_DEBUG("LinkType %s(%lld), child of %s(%lld) %s(%lld)->%s(%lld)", ret->get_cname(), ret->get_id(), get_cname(), + get_id(), source->get_cname(), source->get_id(), dest->get_cname(), dest->get_id()); ret->logDefinition(source, dest); return ret; } else diff --git a/src/instr/instr_paje_types.hpp b/src/instr/instr_paje_types.hpp index b07bc6575a..c50406477c 100644 --- a/src/instr/instr_paje_types.hpp +++ b/src/instr/instr_paje_types.hpp @@ -28,9 +28,9 @@ public: Type(std::string name, std::string alias, std::string color, Type* father); virtual ~Type(); - std::string getName() { return name_; } - const char* getCname() { return name_.c_str(); } - long long int getId() { return id_; } + std::string get_name() { return name_; } + const char* get_cname() { return name_.c_str(); } + long long int get_id() { return id_; } bool isColored() { return not color_.empty(); } Type* byName(std::string name); diff --git a/src/instr/instr_paje_values.cpp b/src/instr/instr_paje_values.cpp index 2a06dc2750..3e6253c155 100644 --- a/src/instr/instr_paje_values.cpp +++ b/src/instr/instr_paje_values.cpp @@ -22,7 +22,7 @@ void EntityValue::print() std::stringstream stream; XBT_DEBUG("%s: event_type=%u", __func__, PAJE_DefineEntityValue); stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DefineEntityValue; - stream << " " << id_ << " " << father_->getId() << " " << name_; + stream << " " << id_ << " " << father_->get_id() << " " << name_; if (not color_.empty()) stream << " \"" << color_ << "\""; XBT_DEBUG("Dump %s", stream.str().c_str()); diff --git a/src/instr/instr_resource_utilization.cpp b/src/instr/instr_resource_utilization.cpp index 19468d23d8..c55954971f 100644 --- a/src/instr/instr_resource_utilization.cpp +++ b/src/instr/instr_resource_utilization.cpp @@ -22,7 +22,7 @@ static void instr_event(double now, double delta, simgrid::instr::VariableType* */ // create a key considering the resource and variable - std::string key = resource->getName() + variable->getName(); + std::string key = resource->get_name() + variable->get_name(); // check if key exists: if it doesn't, set the variable to zero and mark this in the global map. if (platform_variables.find(key) == platform_variables.end()) { diff --git a/src/instr/jedule/jedule_platform.cpp b/src/instr/jedule/jedule_platform.cpp index cc3037e0ae..a352b80d93 100644 --- a/src/instr/jedule/jedule_platform.cpp +++ b/src/instr/jedule/jedule_platform.cpp @@ -72,7 +72,7 @@ void Container::createHierarchy(sg_netzone_t from_as) this->addResources(table); } else { for (auto const& nz : *from_as->getChildren()) { - jed_container_t child_container = new simgrid::jedule::Container(std::string(nz->getCname())); + jed_container_t child_container = new simgrid::jedule::Container(std::string(nz->get_cname())); this->addChild(child_container); child_container->createHierarchy(nz); } diff --git a/src/instr/jedule/jedule_sd_binding.cpp b/src/instr/jedule/jedule_sd_binding.cpp index c157f2bc06..751dd3b1f4 100644 --- a/src/instr/jedule/jedule_sd_binding.cpp +++ b/src/instr/jedule/jedule_sd_binding.cpp @@ -29,11 +29,11 @@ void jedule_log_sd_event(SD_task_t task) void jedule_sd_init() { sg_netzone_t root_comp = simgrid::s4u::Engine::getInstance()->getNetRoot(); - XBT_DEBUG("root name %s\n", root_comp->getCname()); + XBT_DEBUG("root name %s\n", root_comp->get_cname()); my_jedule = new simgrid::jedule::Jedule(); - jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->getCname())); + jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->get_cname())); root_container->createHierarchy(root_comp); my_jedule->root_container = root_container; } diff --git a/src/kernel/EngineImpl.cpp b/src/kernel/EngineImpl.cpp index abda1e2ded..12979fa570 100644 --- a/src/kernel/EngineImpl.cpp +++ b/src/kernel/EngineImpl.cpp @@ -26,7 +26,7 @@ EngineImpl::~EngineImpl() */ std::vector names; for (auto const& kv : hosts_) - names.push_back(kv.second->getName()); + names.push_back(kv.second->get_name()); std::sort(names.begin(), names.end()); diff --git a/src/kernel/activity/MailboxImpl.cpp b/src/kernel/activity/MailboxImpl.cpp index 8a68981583..63fdfb4866 100644 --- a/src/kernel/activity/MailboxImpl.cpp +++ b/src/kernel/activity/MailboxImpl.cpp @@ -76,14 +76,14 @@ void MailboxImpl::remove(smx_activity_t activity) boost::static_pointer_cast(activity); xbt_assert(comm->mbox == this, "Comm %p is in mailbox %s, not mailbox %s", comm.get(), - (comm->mbox ? comm->mbox->getCname() : "(null)"), this->getCname()); + (comm->mbox ? comm->mbox->get_cname() : "(null)"), this->get_cname()); comm->mbox = nullptr; for (auto it = this->comm_queue.begin(); it != this->comm_queue.end(); it++) if (*it == comm) { this->comm_queue.erase(it); return; } - xbt_die("Comm %p not found in mailbox %s", comm.get(), this->getCname()); + xbt_die("Comm %p not found in mailbox %s", comm.get(), this->get_cname()); } } } diff --git a/src/kernel/activity/MailboxImpl.hpp b/src/kernel/activity/MailboxImpl.hpp index 4bfffe8b18..695a970cf7 100644 --- a/src/kernel/activity/MailboxImpl.hpp +++ b/src/kernel/activity/MailboxImpl.hpp @@ -27,8 +27,8 @@ class MailboxImpl { } public: - const simgrid::xbt::string& getName() const { return name_; } - const char* getCname() const { return name_.c_str(); } + const simgrid::xbt::string& get_name() const { return name_; } + const char* get_cname() const { return name_.c_str(); } static MailboxImpl* byNameOrNull(const char* name); static MailboxImpl* byNameOrCreate(const char* name); void setReceiver(s4u::ActorPtr actor); diff --git a/src/kernel/activity/MutexImpl.cpp b/src/kernel/activity/MutexImpl.cpp index 7d90c8a7aa..066bfb23a9 100644 --- a/src/kernel/activity/MutexImpl.cpp +++ b/src/kernel/activity/MutexImpl.cpp @@ -82,7 +82,7 @@ void MutexImpl::unlock(smx_actor_t issuer) /* If the mutex is not owned by the issuer, that's not good */ if (issuer != this->owner) THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%ld), not by you.", - this->owner->getCname(), this->owner->pid); + this->owner->get_cname(), this->owner->pid); if (not this->sleeping.empty()) { /*process to wake up */ diff --git a/src/kernel/resource/Resource.cpp b/src/kernel/resource/Resource.cpp index 427a6b1aa9..6b9ffe17a2 100644 --- a/src/kernel/resource/Resource.cpp +++ b/src/kernel/resource/Resource.cpp @@ -47,12 +47,12 @@ Model* Resource::model() const return model_; } -const std::string& Resource::getName() const +const std::string& Resource::get_name() const { return name_; } -const char* Resource::getCname() const +const char* Resource::get_cname() const { return name_.c_str(); } diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index d5da9066a6..057b651e57 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -23,7 +23,7 @@ ClusterZone::ClusterZone(NetZone* father, std::string name) : NetZoneImpl(father void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) { - XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); + XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id()); xbt_assert(not private_links_.empty(), "Cluster routing: no links attached to the source node - did you use host_link tag?"); @@ -79,22 +79,22 @@ void ClusterZone::getGraph(xbt_graph_t graph, std::map* "Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph."); /* create the router */ - xbt_node_t routerNode = new_xbt_graph_node(graph, router_->getCname(), nodes); + xbt_node_t routerNode = new_xbt_graph_node(graph, router_->get_cname(), nodes); xbt_node_t backboneNode = nullptr; if (backbone_) { - backboneNode = new_xbt_graph_node(graph, backbone_->getCname(), nodes); + backboneNode = new_xbt_graph_node(graph, backbone_->get_cname(), nodes); new_xbt_graph_edge(graph, routerNode, backboneNode, edges); } for (auto const& src : getVertices()) { if (not src->isRouter()) { - xbt_node_t previous = new_xbt_graph_node(graph, src->getCname(), nodes); + xbt_node_t previous = new_xbt_graph_node(graph, src->get_cname(), nodes); std::pair info = private_links_.at(src->id()); if (info.first) { // link up - xbt_node_t current = new_xbt_graph_node(graph, info.first->getCname(), nodes); + xbt_node_t current = new_xbt_graph_node(graph, info.first->get_cname(), nodes); new_xbt_graph_edge(graph, previous, current, edges); if (backbone_) { @@ -105,7 +105,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, std::map* } if (info.second) { // link down - xbt_node_t current = new_xbt_graph_node(graph, info.second->getCname(), nodes); + xbt_node_t current = new_xbt_graph_node(graph, info.second->get_cname(), nodes); new_xbt_graph_edge(graph, previous, current, edges); if (backbone_) { diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index b29e67886c..42a622ccfb 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -146,7 +146,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs xbt_edge_t edge = xbt_graph_get_edge(route_graph_, node_s_v, node_e_v); if (edge == nullptr) - THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname()); + THROWF(arg_error, 0, "No route from '%s' to '%s'", src->get_cname(), dst->get_cname()); RouteCreationArgs* e_route = static_cast(xbt_graph_edge_get_data(edge)); @@ -216,7 +216,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs xbt_edge_t edge = xbt_graph_get_edge(route_graph_, node_pred_v, node_v); if (edge == nullptr) - THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname()); + THROWF(arg_error, 0, "No route from '%s' to '%s'", src->get_cname(), dst->get_cname()); RouteCreationArgs* e_route = static_cast(xbt_graph_edge_get_data(edge)); @@ -227,7 +227,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs if (v == dst_node_id) first_gw = gw_dst; - if (hierarchy_ == RoutingMode::recursive && v != dst_node_id && gw_dst->getName() != prev_gw_src->getName()) { + if (hierarchy_ == RoutingMode::recursive && v != dst_node_id && gw_dst->get_name() != prev_gw_src->get_name()) { std::vector e_route_as_to_as; NetPoint* gw_dst_net_elm = nullptr; @@ -273,8 +273,8 @@ void DijkstraZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::Net kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, std::vector& link_list, bool symmetrical) { - const char* srcName = src->getCname(); - const char* dstName = dst->getCname(); + const char* srcName = src->get_cname(); + const char* dstName = dst->get_cname(); addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical); @@ -302,10 +302,10 @@ void DijkstraZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::Net if (edge) THROWF(arg_error, 0, "Route from %s to %s already exists", dstName, srcName); } else { - XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, gw_dst->getCname(), srcName, gw_src->getCname()); + XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, gw_dst->get_cname(), srcName, gw_src->get_cname()); if (edge) - THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, gw_dst->getCname(), srcName, - gw_src->getCname()); + THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, gw_dst->get_cname(), srcName, + gw_src->get_cname()); } if (gw_dst && gw_src) { diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index 3ad8df8a71..7ae3e78d0b 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -270,7 +270,8 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArg if (dst->isRouter() || src->isRouter()) return; - XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); + XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), + dst->id()); if ((src->id() == dst->id()) && has_loopback_) { std::pair info = private_links_.at(nodePosition(src->id())); diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index 2c59ed92b6..e81439a927 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -67,16 +67,16 @@ void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* /* Let's find the source and the destination in our internal structure */ auto searchedNode = this->compute_nodes_.find(src->id()); xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the source %s [%u] in the fat tree", - src->getCname(), src->id()); + src->get_cname(), src->id()); FatTreeNode* source = searchedNode->second; searchedNode = this->compute_nodes_.find(dst->id()); xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the destination %s [%u] in the fat tree", - dst->getCname(), dst->id()); + dst->get_cname(), dst->id()); FatTreeNode* destination = searchedNode->second; - XBT_VERB("Get route and latency from '%s' [%u] to '%s' [%u] in a fat tree", src->getCname(), src->id(), - dst->getCname(), dst->id()); + XBT_VERB("Get route and latency from '%s' [%u] to '%s' [%u] in a fat tree", src->get_cname(), src->id(), + dst->get_cname(), dst->id()); /* In case destination is the source, and there is a loopback, let's use it instead of going up to a switch */ if (source->id == destination->id && this->has_loopback_) { diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 20c340db13..63214ee3a6 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -56,7 +56,7 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* r do { int pred = TO_FLOYD_PRED(src->id(), cur); if (pred == -1) - THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname()); + THROWF(arg_error, 0, "No route from '%s' to '%s'", src->get_cname(), dst->get_cname()); route_stack.push_back(TO_FLOYD_LINK(pred, cur)); cur = pred; } while (cur != src->id()); @@ -71,7 +71,7 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* r RouteCreationArgs* e_route = route_stack.back(); route_stack.pop_back(); if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != nullptr && - prev_dst_gw->getCname() != e_route->gw_src->getCname()) { + prev_dst_gw->get_cname() != e_route->gw_src->get_cname()) { getGlobalRoute(prev_dst_gw, e_route->gw_src, route->link_list, lat); } @@ -113,11 +113,11 @@ void FloydZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoi if (gw_dst) // netzone route (to adapt the error message, if any) xbt_assert(nullptr == TO_FLOYD_LINK(src->id(), dst->id()), "The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).", - src->getCname(), gw_src->getCname(), dst->getCname(), gw_dst->getCname()); + src->get_cname(), gw_src->get_cname(), dst->get_cname(), gw_dst->get_cname()); else xbt_assert(nullptr == TO_FLOYD_LINK(src->id(), dst->id()), - "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->getCname(), - dst->getCname()); + "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->get_cname(), + dst->get_cname()); TO_FLOYD_LINK(src->id(), dst->id()) = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1); @@ -129,11 +129,11 @@ void FloydZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoi xbt_assert( nullptr == TO_FLOYD_LINK(dst->id(), src->id()), "The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.", - dst->getCname(), gw_dst->getCname(), src->getCname(), gw_src->getCname()); + dst->get_cname(), gw_dst->get_cname(), src->get_cname(), gw_src->get_cname()); else xbt_assert(nullptr == TO_FLOYD_LINK(dst->id(), src->id()), "The route between %s and %s already exists. You should not declare the reverse path as symmetrical.", - dst->getCname(), src->getCname()); + dst->get_cname(), src->get_cname()); if (gw_dst && gw_src) { NetPoint* gw_tmp = gw_src; @@ -142,10 +142,10 @@ void FloydZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoi } if (not gw_src || not gw_dst) - XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst->getCname(), src->getCname()); + XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst->get_cname(), src->get_cname()); else - XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", dst->getCname(), gw_src->getCname(), src->getCname(), - gw_dst->getCname()); + XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", dst->get_cname(), gw_src->get_cname(), + src->get_cname(), gw_dst->get_cname()); TO_FLOYD_LINK(dst->id(), src->id()) = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 0); diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index 5f4b90c0db..c2ca632556 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -54,7 +54,7 @@ FullZone::~FullZone() void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* res, double* lat) { - XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); + XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id()); unsigned int table_size = getTableSize(); RouteCreationArgs* e_route = TO_ROUTE_FULL(src->id(), dst->id()); @@ -85,11 +85,11 @@ void FullZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoin if (gw_dst) // inter-zone route (to adapt the error message, if any) xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()), "The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).", - src->getCname(), gw_src->getCname(), dst->getCname(), gw_dst->getCname()); + src->get_cname(), gw_src->get_cname(), dst->get_cname(), gw_dst->get_cname()); else xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()), - "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->getCname(), - dst->getCname()); + "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->get_cname(), + dst->get_cname()); /* Add the route to the base */ TO_ROUTE_FULL(src->id(), dst->id()) = @@ -105,11 +105,11 @@ void FullZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoin xbt_assert( nullptr == TO_ROUTE_FULL(dst->id(), src->id()), "The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.", - dst->getCname(), gw_dst->getCname(), src->getCname(), gw_src->getCname()); + dst->get_cname(), gw_dst->get_cname(), src->get_cname(), gw_src->get_cname()); else xbt_assert(nullptr == TO_ROUTE_FULL(dst->id(), src->id()), "The route between %s and %s already exists. You should not declare the reverse path as symmetrical.", - dst->getCname(), src->getCname()); + dst->get_cname(), src->get_cname()); TO_ROUTE_FULL(dst->id(), src->id()) = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, false); diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index f980bba4c8..2ec532bb14 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -69,19 +69,19 @@ void NetZoneImpl::addBypassRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, { /* Argument validity checks */ if (gw_dst) { - XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", src->getCname(), gw_src->getCname(), dst->getCname(), - gw_dst->getCname()); - xbt_assert(not link_list.empty(), "Bypass route between %s@%s and %s@%s cannot be empty.", src->getCname(), - gw_src->getCname(), dst->getCname(), gw_dst->getCname()); + XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", src->get_cname(), gw_src->get_cname(), dst->get_cname(), + gw_dst->get_cname()); + xbt_assert(not link_list.empty(), "Bypass route between %s@%s and %s@%s cannot be empty.", src->get_cname(), + gw_src->get_cname(), dst->get_cname(), gw_dst->get_cname()); xbt_assert(bypass_routes_.find({src, dst}) == bypass_routes_.end(), - "The bypass route between %s@%s and %s@%s already exists.", src->getCname(), gw_src->getCname(), - dst->getCname(), gw_dst->getCname()); + "The bypass route between %s@%s and %s@%s already exists.", src->get_cname(), gw_src->get_cname(), + dst->get_cname(), gw_dst->get_cname()); } else { - XBT_DEBUG("Load bypassRoute from %s to %s", src->getCname(), dst->getCname()); - xbt_assert(not link_list.empty(), "Bypass route between %s and %s cannot be empty.", src->getCname(), - dst->getCname()); + XBT_DEBUG("Load bypassRoute from %s to %s", src->get_cname(), dst->get_cname()); + xbt_assert(not link_list.empty(), "Bypass route between %s and %s cannot be empty.", src->get_cname(), + dst->get_cname()); xbt_assert(bypass_routes_.find({src, dst}) == bypass_routes_.end(), - "The bypass route between %s and %s already exists.", src->getCname(), dst->getCname()); + "The bypass route between %s and %s already exists.", src->get_cname(), dst->get_cname()); } /* Build a copy that will be stored in the dict */ @@ -161,8 +161,8 @@ static void find_common_ancestors(NetPoint* src, NetPoint* dst, NetZoneImpl* src_as = src->netzone(); NetZoneImpl* dst_as = dst->netzone(); - xbt_assert(src_as, "Host %s must be in a netzone", src->getCname()); - xbt_assert(dst_as, "Host %s must be in a netzone", dst->getCname()); + xbt_assert(src_as, "Host %s must be in a netzone", src->get_cname()); + xbt_assert(dst_as, "Host %s must be in a netzone", dst->get_cname()); /* (2) find the path to the root routing component */ std::vector path_src; @@ -219,7 +219,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, if (latency) *latency += link->latency(); } - XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links", src->getCname(), dst->getCname(), + XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links", src->get_cname(), dst->get_cname(), bypassedRoute->links.size()); return true; } @@ -295,7 +295,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, if (bypassedRoute) { XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links. We may have to complete it with recursive " "calls to getRoute", - src->getCname(), dst->getCname(), bypassedRoute->links.size()); + src->get_cname(), dst->get_cname(), bypassedRoute->links.size()); if (src != key.first) getGlobalRoute(src, bypassedRoute->gw_src, links, latency); for (surf::LinkImpl* const& link : bypassedRoute->links) { @@ -307,7 +307,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, getGlobalRoute(bypassedRoute->gw_dst, dst, links, latency); return true; } - XBT_DEBUG("No bypass route from '%s' to '%s'.", src->getCname(), dst->getCname()); + XBT_DEBUG("No bypass route from '%s' to '%s'.", src->get_cname(), dst->get_cname()); return false; } @@ -316,15 +316,15 @@ void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst, { RouteCreationArgs route; - XBT_DEBUG("Resolve route from '%s' to '%s'", src->getCname(), dst->getCname()); + XBT_DEBUG("Resolve route from '%s' to '%s'", src->get_cname(), dst->get_cname()); /* Find how src and dst are interconnected */ NetZoneImpl *common_ancestor; 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->getCname(), - src_ancestor->getCname(), dst_ancestor->getCname()); + XBT_DEBUG("elements_father: common ancestor '%s' src ancestor '%s' dst ancestor '%s'", common_ancestor->get_cname(), + src_ancestor->get_cname(), dst_ancestor->get_cname()); /* Check whether a direct bypass is defined. If so, use it and bail out */ if (common_ancestor->getBypassRoute(src, dst, links, latency)) @@ -342,7 +342,7 @@ void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst, common_ancestor->getLocalRoute(src_ancestor->netpoint_, dst_ancestor->netpoint_, &route, latency); xbt_assert((route.gw_src != nullptr) && (route.gw_dst != nullptr), "bad gateways for route from \"%s\" to \"%s\"", - src->getCname(), dst->getCname()); + src->get_cname(), dst->get_cname()); /* If source gateway is not our source, we have to recursively find our way up to this point */ if (src != route.gw_src) diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index 73df03a896..acb11d1ecc 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -77,7 +77,7 @@ void RoutedZone::getGraph(xbt_graph_t graph, std::map* getLocalRoute(my_src, my_dst, route, nullptr); - XBT_DEBUG("get_route_and_latency %s -> %s", my_src->getCname(), my_dst->getCname()); + XBT_DEBUG("get_route_and_latency %s -> %s", my_src->get_cname(), my_dst->get_cname()); xbt_node_t current; xbt_node_t previous; @@ -85,15 +85,15 @@ void RoutedZone::getGraph(xbt_graph_t graph, std::map* const char *current_name; if (route->gw_src) { - previous = new_xbt_graph_node(graph, route->gw_src->getCname(), nodes); - previous_name = route->gw_src->getCname(); + previous = new_xbt_graph_node(graph, route->gw_src->get_cname(), nodes); + previous_name = route->gw_src->get_cname(); } else { - previous = new_xbt_graph_node(graph, my_src->getCname(), nodes); - previous_name = my_src->getCname(); + previous = new_xbt_graph_node(graph, my_src->get_cname(), nodes); + previous_name = my_src->get_cname(); } for (auto const& link : route->link_list) { - const char* link_name = link->getCname(); + const char* link_name = link->get_cname(); current = new_xbt_graph_node(graph, link_name, nodes); current_name = link_name; new_xbt_graph_edge(graph, previous, current, edges); @@ -103,11 +103,11 @@ void RoutedZone::getGraph(xbt_graph_t graph, std::map* } if (route->gw_dst) { - current = new_xbt_graph_node(graph, route->gw_dst->getCname(), nodes); - current_name = route->gw_dst->getCname(); + current = new_xbt_graph_node(graph, route->gw_dst->get_cname(), nodes); + current_name = route->gw_dst->get_cname(); } else { - current = new_xbt_graph_node(graph, my_dst->getCname(), nodes); - current_name = my_dst->getCname(); + current = new_xbt_graph_node(graph, my_dst->get_cname(), nodes); + current_name = my_dst->get_cname(); } new_xbt_graph_edge(graph, previous, current, edges); XBT_DEBUG(" %s -> %s", previous_name, current_name); @@ -149,26 +149,27 @@ RouteCreationArgs* RoutedZone::newExtendedRoute(RoutingMode hierarchy, NetPoint* void RoutedZone::getRouteCheckParams(NetPoint* src, NetPoint* dst) { - xbt_assert(src, "Cannot find a route from nullptr to %s", dst->getCname()); - xbt_assert(dst, "Cannot find a route from %s to nullptr", src->getCname()); + xbt_assert(src, "Cannot find a route from nullptr to %s", dst->get_cname()); + xbt_assert(dst, "Cannot find a route from %s to nullptr", src->get_cname()); NetZone* src_as = src->netzone(); NetZone* dst_as = dst->netzone(); 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->getCname(), src_as->getCname(), dst->getCname(), dst_as->getCname()); + src->get_cname(), src_as->get_cname(), dst->get_cname(), dst_as->get_cname()); - 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->getCname(), dst->getCname(), src_as->getCname(), dst_as->getCname(), 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->get_cname(), dst->get_cname(), src_as->get_cname(), dst_as->get_cname(), get_cname()); } void RoutedZone::addRouteCheckParams(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, std::vector& link_list, bool symmetrical) { - const char* srcName = src->getCname(); - const char* dstName = dst->getCname(); + const char* srcName = src->get_cname(); + const char* dstName = dst->get_cname(); if (not gw_dst || not gw_src) { XBT_DEBUG("Load Route from \"%s\" to \"%s\"", srcName, dstName); @@ -182,7 +183,7 @@ void RoutedZone::addRouteCheckParams(kernel::routing::NetPoint* src, kernel::rou "When defining a route, dst cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?", dstName); } else { - XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, gw_src->getCname(), dstName, gw_dst->getCname()); + XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, gw_src->get_cname(), dstName, gw_dst->get_cname()); xbt_assert(src->isNetZone(), "When defining a NetzoneRoute, src must be a netzone but '%s' is not", srcName); xbt_assert(dst->isNetZone(), "When defining a NetzoneRoute, dst must be a netzone but '%s' is not", dstName); @@ -191,14 +192,14 @@ void RoutedZone::addRouteCheckParams(kernel::routing::NetPoint* src, kernel::rou xbt_assert(gw_dst->isHost() || gw_dst->isRouter(), "When defining a NetzoneRoute, gw_dst must be an host or a router but '%s' is not.", dstName); - xbt_assert(gw_src != gw_dst, "Cannot define an NetzoneRoute from '%s' to itself", gw_src->getCname()); + xbt_assert(gw_src != gw_dst, "Cannot define an NetzoneRoute from '%s' to itself", gw_src->get_cname()); - xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, gw_src->getCname(), dstName, - gw_dst->getCname(), srcName); - xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, gw_src->getCname(), dstName, - gw_dst->getCname(), dstName); - xbt_assert(not link_list.empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName, gw_src->getCname(), - dstName, gw_dst->getCname()); + xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, gw_src->get_cname(), dstName, + gw_dst->get_cname(), srcName); + xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, gw_src->get_cname(), dstName, + gw_dst->get_cname(), dstName); + xbt_assert(not link_list.empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName, gw_src->get_cname(), + dstName, gw_dst->get_cname()); } onRouteCreation(symmetrical, src, dst, gw_src, gw_dst, link_list); diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index 4446fdb2ce..a21579a1f7 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -96,7 +96,7 @@ void TorusZone::parse_specific_arguments(ClusterCreationArgs* cluster) void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) { - XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); + XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id()); if (dst->isRouter() || src->isRouter()) return; diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index 4c9a331e59..fc77a23aaf 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -27,7 +27,7 @@ Coords::Coords(NetPoint* netpoint, std::string coordStr) std::vector string_values; boost::split(string_values, coordStr, boost::is_any_of(" ")); - xbt_assert(string_values.size() == 3, "Coordinates of %s must have 3 dimensions", netpoint->getCname()); + xbt_assert(string_values.size() == 3, "Coordinates of %s must have 3 dimensions", netpoint->get_cname()); for (auto const& str : string_values) try { @@ -38,7 +38,7 @@ Coords::Coords(NetPoint* netpoint, std::string coordStr) coords.shrink_to_fit(); netpoint->extension_set(this); - XBT_DEBUG("Coords of %s %p: %s", netpoint->getCname(), netpoint, coordStr.c_str()); + XBT_DEBUG("Coords of %s %p: %s", netpoint->get_cname(), netpoint, coordStr.c_str()); } }; // namespace vivaldi @@ -54,7 +54,7 @@ static std::vector* getCoordsFromNetpoint(NetPoint* np) { simgrid::kernel::routing::vivaldi::Coords* coords = np->extension(); xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)", - (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->getCname(), np); + (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->get_cname(), np); return &coords->coords; } @@ -68,8 +68,8 @@ void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, s new simgrid::kernel::routing::vivaldi::Coords(netpoint, coord); - std::string link_up = "link_" + netpoint->getName() + "_UP"; - std::string link_down = "link_" + netpoint->getName() + "_DOWN"; + std::string link_up = "link_" + netpoint->get_name() + "_UP"; + std::string link_down = "link_" + netpoint->get_name() + "_DOWN"; surf::LinkImpl* linkUp = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED); surf::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED); private_links_.insert({netpoint->id(), {linkUp, linkDown}}); @@ -77,11 +77,11 @@ void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, s void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) { - XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); + XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id()); if (src->isNetZone()) { - std::string srcName = "router_" + src->getName(); - std::string dstName = "router_" + dst->getName(); + std::string srcName = "router_" + src->get_name(); + std::string dstName = "router_" + dst->get_name(); route->gw_src = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(srcName.c_str()); route->gw_dst = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(dstName.c_str()); } diff --git a/src/mc/mc_smx.cpp b/src/mc/mc_smx.cpp index f725c877f3..c270a90ec1 100644 --- a/src/mc/mc_smx.cpp +++ b/src/mc/mc_smx.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2015-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -117,7 +117,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->getCname(); + return actor->host->get_cname(); simgrid::mc::RemoteClient* process = &mc_model_checker->process(); @@ -137,7 +137,7 @@ const char* MC_smx_actor_get_host_name(smx_actor_t actor) ~fake_host() { /* Nothing to do*/} }; fake_host foo; - const size_t offset = (char*)&foo.host.getName() - (char*)&foo.host; + const size_t offset = (char*)&foo.host.get_name() - (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 d9eceb3fc1..0e235a7976 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"); std::string instr_pid(msg_process_t proc) { - return std::string(proc->getCname()) + "-" + std::to_string(proc->getPid()); + return std::string(proc->get_cname()) + "-" + std::to_string(proc->getPid()); } void TRACE_msg_process_kill(smx_process_exit_status_t status, msg_process_t process) diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index 1b9e132bed..faf039d30c 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -279,7 +279,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->getCname()); + XBT_DEBUG("Got task %s from %s", (*task)->name, mailbox->get_cname()); (*task)->simdata->setNotUsed(); } catch (xbt_ex& e) { diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index a9e2a3c01a..433e487cb9 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -176,7 +176,8 @@ msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host, xbt_dict_free(&properties); /* 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->getCname(), &props, nullptr); + smx_actor_t process = + SIMIX_process_attach(name, new simgrid::msg::ActorExt(data), host->get_cname(), &props, nullptr); if (not process) xbt_die("Could not attach"); simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process); diff --git a/src/plugins/file_system/s4u_FileSystem.cpp b/src/plugins/file_system/s4u_FileSystem.cpp index 947ea06d0a..3aecd913f2 100644 --- a/src/plugins/file_system/s4u_FileSystem.cpp +++ b/src/plugins/file_system/s4u_FileSystem.cpp @@ -34,7 +34,7 @@ File::File(std::string fullpath, sg_host_t host, void* userdata) : fullpath_(ful // this cannot fail because we get a xbt_die if the mountpoint does not exist Storage* st = nullptr; size_t longest_prefix_length = 0; - XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath.c_str(), host->getCname()); + XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath.c_str(), host->get_cname()); for (auto const& mnt : host->getMountedStorages()) { XBT_DEBUG("See '%s'", mnt.first.c_str()); @@ -50,7 +50,7 @@ File::File(std::string fullpath, sg_host_t host, void* userdata) : fullpath_(ful mount_point_ = fullpath.substr(0, longest_prefix_length); path_ = fullpath.substr(longest_prefix_length, fullpath.length()); } else - xbt_die("Can't find mount point for '%s' on '%s'", fullpath.c_str(), host->getCname()); + xbt_die("Can't find mount point for '%s' on '%s'", fullpath.c_str(), host->get_cname()); localStorage = st; @@ -91,7 +91,7 @@ void File::dump() "\t\tStorage Id: '%s'\n" "\t\tStorage Type: '%s'\n" "\t\tFile Descriptor Id: %d", - getPath(), size_, mount_point_.c_str(), localStorage->getCname(), localStorage->getType(), desc_id); + getPath(), size_, mount_point_.c_str(), localStorage->get_cname(), localStorage->getType(), desc_id); } sg_size_t File::read(sg_size_t size) @@ -101,14 +101,14 @@ sg_size_t File::read(sg_size_t size) /* Find the host where the file is physically located and read it */ Host* host = localStorage->getHost(); - XBT_DEBUG("READ %s on disk '%s'", getPath(), localStorage->getCname()); + XBT_DEBUG("READ %s on disk '%s'", getPath(), localStorage->get_cname()); // if the current position is close to the end of the file, we may not be able to read the requested size sg_size_t read_size = localStorage->read(std::min(size, size_ - current_position_)); current_position_ += read_size; - if (strcmp(host->getCname(), Host::current()->getCname())) { + if (strcmp(host->get_cname(), Host::current()->get_cname())) { /* 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.", host->getCname(), read_size); + XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", host->get_cname(), read_size); Host* m_host_list[] = {Host::current(), host}; double* flops_amount = new double[2]{0, 0}; double* bytes_amount = new double[4]{0, 0, static_cast(read_size), 0}; @@ -133,9 +133,9 @@ sg_size_t File::write(sg_size_t size) /* Find the host where the file is physically located (remote or local)*/ Host* host = localStorage->getHost(); - if (strcmp(host->getCname(), Host::current()->getCname())) { + if (strcmp(host->get_cname(), Host::current()->get_cname())) { /* 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.", host->getCname(), size); + XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", host->get_cname(), size); Host* m_host_list[] = {Host::current(), host}; double* flops_amount = new double[2]{0, 0}; double* bytes_amount = new double[4]{0, static_cast(size), 0, 0}; @@ -143,7 +143,7 @@ sg_size_t File::write(sg_size_t size) this_actor::parallel_execute(2, m_host_list, flops_amount, bytes_amount); } - XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu'", getPath(), localStorage->getCname(), size, size_); + XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu'", getPath(), localStorage->get_cname(), size, size_); // If the storage is full before even starting to write if (sg_storage_get_size_used(localStorage) >= sg_storage_get_size(localStorage)) return 0; @@ -221,10 +221,10 @@ int File::unlink() std::map* content = localStorage->extension()->getContent(); if (content->find(path_) == content->end()) { - XBT_WARN("File %s is not on disk %s. Impossible to unlink", path_.c_str(), localStorage->getCname()); + XBT_WARN("File %s is not on disk %s. Impossible to unlink", path_.c_str(), localStorage->get_cname()); return -1; } else { - XBT_DEBUG("UNLINK %s on disk '%s'", path_.c_str(), localStorage->getCname()); + XBT_DEBUG("UNLINK %s on disk '%s'", path_.c_str(), localStorage->get_cname()); localStorage->extension()->decrUsedSize(size_); // Remove the file from storage @@ -240,7 +240,7 @@ int File::remoteCopy(sg_host_t host, const char* fullpath) Storage* storage_src = localStorage; Host* src_host = storage_src->getHost(); seek(0, SEEK_SET); - XBT_DEBUG("READ %s on disk '%s'", getPath(), localStorage->getCname()); + XBT_DEBUG("READ %s on disk '%s'", getPath(), localStorage->get_cname()); // if the current position is close to the end of the file, we may not be able to read the requested size sg_size_t read_size = localStorage->read(size_); current_position_ += read_size; @@ -263,12 +263,12 @@ int File::remoteCopy(sg_host_t host, const char* fullpath) /* Mount point found, retrieve the host the storage is attached to */ dst_host = storage_dest->getHost(); } else { - XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->getCname()); + XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->get_cname()); return -1; } - XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, src_host->getCname(), - storage_dest->getHost()->getCname()); + XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, src_host->get_cname(), + storage_dest->getHost()->get_cname()); Host* m_host_list[] = {src_host, dst_host}; double* flops_amount = new double[2]{0, 0}; double* bytes_amount = new double[4]{0, static_cast(read_size), 0, 0}; diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index 15277a4e8f..c8fd8c3c14 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -95,7 +95,7 @@ double VMModel::next_occuring_event(double now) double solved_value = ws_vm->getImpl()->action_->get_variable()->get_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->getCname(), ws_vm->getPm()->getCname()); + XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->get_cname(), ws_vm->getPm()->get_cname()); xbt_assert(cpu->model() == surf_cpu_model_vm); kernel::lmm::System* vcpu_system = cpu->model()->get_maxmin_system(); @@ -124,7 +124,7 @@ VirtualMachineImpl::VirtualMachineImpl(simgrid::s4u::VirtualMachine* piface, sim /* TODO: we have to periodically input GUESTOS_NOISE to the system? how ? */ action_ = host_PM->pimpl_cpu->execution_start(0, coreAmount); - XBT_VERB("Create VM(%s)@PM(%s)", piface->getCname(), hostPM_->getCname()); + XBT_VERB("Create VM(%s)@PM(%s)", piface->get_cname(), hostPM_->get_cname()); onVmCreation(this); } @@ -155,12 +155,13 @@ void VirtualMachineImpl::setState(e_surf_vm_state_t state) void VirtualMachineImpl::suspend(smx_actor_t issuer) { if (getState() != SURF_VM_STATE_RUNNING) - THROWF(vm_error, 0, "Cannot suspend VM %s: it is not running.", piface_->getCname()); + THROWF(vm_error, 0, "Cannot suspend VM %s: it is not running.", piface_->get_cname()); if (issuer->host == piface_) - THROWF(vm_error, 0, "Actor %s cannot suspend the VM %s in which it runs", issuer->getCname(), piface_->getCname()); + THROWF(vm_error, 0, "Actor %s cannot suspend the VM %s in which it runs", issuer->get_cname(), + piface_->get_cname()); auto& process_list = piface_->extension()->process_list; - XBT_DEBUG("suspend VM(%s), where %zu processes exist", piface_->getCname(), process_list.size()); + XBT_DEBUG("suspend VM(%s), where %zu processes exist", piface_->get_cname(), process_list.size()); action_->suspend(); @@ -177,15 +178,15 @@ 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_->getCname()); + THROWF(vm_error, 0, "Cannot resume VM %s: it was not suspended", piface_->get_cname()); auto& process_list = piface_->extension()->process_list; - XBT_DEBUG("Resume VM %s, containing %zu processes.", piface_->getCname(), process_list.size()); + XBT_DEBUG("Resume VM %s, containing %zu processes.", piface_->get_cname(), process_list.size()); action_->resume(); for (auto& smx_process : process_list) { - XBT_DEBUG("resume %s", smx_process.getCname()); + XBT_DEBUG("resume %s", smx_process.get_cname()); smx_process.resume(); } @@ -217,15 +218,15 @@ void VirtualMachineImpl::shutdown(smx_actor_t issuer) THROW_IMPOSSIBLE; break; } - XBT_VERB("Shutting down the VM %s even if it's not running but %s", piface_->getCname(), stateName); + XBT_VERB("Shutting down the VM %s even if it's not running but %s", piface_->get_cname(), stateName); } auto& process_list = piface_->extension()->process_list; - XBT_DEBUG("shutdown VM %s, that contains %zu processes", piface_->getCname(), process_list.size()); + XBT_DEBUG("shutdown VM %s, that contains %zu processes", piface_->get_cname(), process_list.size()); for (auto& smx_process : process_list) { - XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", smx_process.getCname(), - smx_process.host->getCname(), issuer->getCname()); + XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", smx_process.get_cname(), + smx_process.host->get_cname(), issuer->get_cname()); SIMIX_process_kill(&smx_process, issuer); } @@ -246,9 +247,9 @@ s4u::Host* VirtualMachineImpl::getPm() */ void VirtualMachineImpl::setPm(s4u::Host* destination) { - const char* vm_name = piface_->getCname(); - const char* pm_name_src = hostPM_->getCname(); - const char* pm_name_dst = destination->getCname(); + const char* vm_name = piface_->get_cname(); + const char* pm_name_src = hostPM_->get_cname(); + const char* pm_name_dst = destination->get_cname(); /* update net_elm with that of the destination physical host */ piface_->pimpl_netpoint = destination->pimpl_netpoint; diff --git a/src/plugins/vm/VmLiveMigration.cpp b/src/plugins/vm/VmLiveMigration.cpp index b584d69edc..ae70eaf456 100644 --- a/src/plugins/vm/VmLiveMigration.cpp +++ b/src/plugins/vm/VmLiveMigration.cpp @@ -31,7 +31,7 @@ void MigrationRx::operator()() bool received_finalize = false; std::string finalize_task_name = - std::string("__mig_stage3:") + vm_->getCname() + "(" + src_pm_->getCname() + "-" + dst_pm_->getCname() + ")"; + std::string("__mig_stage3:") + vm_->get_cname() + "(" + src_pm_->get_cname() + "-" + dst_pm_->get_cname() + ")"; while (not received_finalize) { std::string* payload = static_cast(mbox->get()); @@ -55,7 +55,7 @@ void MigrationRx::operator()() // Now the VM is running on the new host (the migration is completed) (even if the SRC crash) vm_->getImpl()->isMigrating = false; - XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", vm_->getCname(), src_pm_->getCname(), dst_pm_->getCname()); + XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", vm_->get_cname(), src_pm_->get_cname(), dst_pm_->get_cname()); if (TRACE_vm_is_enabled()) { static long long int counter = 0; @@ -63,22 +63,22 @@ void MigrationRx::operator()() counter++; // start link - container_t msg = simgrid::instr::Container::byName(vm_->getName()); + container_t msg = simgrid::instr::Container::byName(vm_->get_name()); simgrid::instr::Container::getRoot()->getLink("MSG_VM_LINK")->startEvent(msg, "M", key); // destroy existing container of this vm - simgrid::instr::Container::byName(vm_->getName())->removeFromParent(); + simgrid::instr::Container::byName(vm_->get_name())->removeFromParent(); // create new container on the new_host location - new simgrid::instr::Container(vm_->getCname(), "MSG_VM", simgrid::instr::Container::byName(dst_pm_->getName())); + new simgrid::instr::Container(vm_->get_cname(), "MSG_VM", simgrid::instr::Container::byName(dst_pm_->get_name())); // end link - msg = simgrid::instr::Container::byName(vm_->getName()); + msg = simgrid::instr::Container::byName(vm_->get_name()); simgrid::instr::Container::getRoot()->getLink("MSG_VM_LINK")->endEvent(msg, "M", key); } // Inform the SRC that the migration has been correctly performed std::string* payload = new std::string("__mig_stage4:"); - *payload = *payload + vm_->getCname() + "(" + src_pm_->getCname() + "-" + dst_pm_->getCname() + ")"; + *payload = *payload + vm_->get_cname() + "(" + src_pm_->get_cname() + "-" + dst_pm_->get_cname() + ")"; mbox_ctl->put(payload, 0); @@ -100,8 +100,8 @@ sg_size_t MigrationTx::sendMigrationData(sg_size_t size, int stage, int stage2_r { sg_size_t sent = size; std::string* msg = new std::string("__mig_stage"); - *msg = *msg + std::to_string(stage) + ":" + vm_->getCname() + "(" + src_pm_->getCname() + "-" + dst_pm_->getCname() + - ")"; + *msg = *msg + std::to_string(stage) + ":" + vm_->get_cname() + "(" + src_pm_->get_cname() + "-" + + dst_pm_->get_cname() + ")"; double clock_sta = s4u::Engine::getClock(); @@ -338,20 +338,21 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm) simgrid::s4u::Host* src_pm = vm->getPm(); if (src_pm->isOff()) - THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->getCname(), src_pm->getCname()); + THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->get_cname(), + src_pm->get_cname()); if (dst_pm->isOff()) - THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->getCname(), dst_pm->getCname()); + THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->get_cname(), dst_pm->get_cname()); if (vm->getState() != SURF_VM_STATE_RUNNING) - THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->getCname()); + THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->get_cname()); if (vm->getImpl()->isMigrating) - THROWF(vm_error, 0, "Cannot migrate VM '%s' that is already migrating.", vm->getCname()); + THROWF(vm_error, 0, "Cannot migrate VM '%s' that is already migrating.", vm->get_cname()); vm->getImpl()->isMigrating = true; std::string rx_name = - std::string("__pr_mig_rx:") + vm->getCname() + "(" + src_pm->getCname() + "-" + dst_pm->getCname() + ")"; + std::string("__pr_mig_rx:") + vm->get_cname() + "(" + src_pm->get_cname() + "-" + dst_pm->get_cname() + ")"; std::string tx_name = - std::string("__pr_mig_tx:") + vm->getCname() + "(" + src_pm->getCname() + "-" + dst_pm->getCname() + ")"; + std::string("__pr_mig_tx:") + vm->get_cname() + "(" + src_pm->get_cname() + "-" + dst_pm->get_cname() + ")"; simgrid::s4u::ActorPtr rx = simgrid::s4u::Actor::createActor(rx_name.c_str(), dst_pm, simgrid::vm::MigrationRx(vm, dst_pm)); @@ -363,7 +364,7 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm) /* wait until the migration have finished or on error has occurred */ XBT_DEBUG("wait for reception of the final ACK (i.e. migration has been correctly performed"); simgrid::s4u::MailboxPtr mbox_ctl = simgrid::s4u::Mailbox::byName( - std::string("__mbox_mig_ctl:") + vm->getCname() + "(" + src_pm->getCname() + "-" + dst_pm->getCname() + ")"); + std::string("__mbox_mig_ctl:") + vm->get_cname() + "(" + src_pm->get_cname() + "-" + dst_pm->get_cname() + ")"); delete static_cast(mbox_ctl->get()); tx->join(); rx->join(); diff --git a/src/plugins/vm/VmLiveMigration.hpp b/src/plugins/vm/VmLiveMigration.hpp index 39cde37a6c..c965535b13 100644 --- a/src/plugins/vm/VmLiveMigration.hpp +++ b/src/plugins/vm/VmLiveMigration.hpp @@ -37,10 +37,10 @@ public: { src_pm_ = vm_->getPm(); - mbox_ctl = s4u::Mailbox::byName(std::string("__mbox_mig_ctl:") + vm_->getCname() + "(" + src_pm_->getCname() + "-" + - dst_pm_->getCname() + ")"); - mbox = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->getCname() + "(" + src_pm_->getCname() + "-" + - dst_pm_->getCname() + ")"); + mbox_ctl = s4u::Mailbox::byName(std::string("__mbox_mig_ctl:") + vm_->get_cname() + "(" + src_pm_->get_cname() + + "-" + dst_pm_->get_cname() + ")"); + mbox = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() + + "-" + dst_pm_->get_cname() + ")"); } void operator()(); }; @@ -56,8 +56,8 @@ public: explicit MigrationTx(s4u::VirtualMachine* vm, s4u::Host* dst_pm) : vm_(vm), dst_pm_(dst_pm) { src_pm_ = vm_->getPm(); - mbox = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->getCname() + "(" + src_pm_->getCname() + "-" + - dst_pm_->getCname() + ")"); + mbox = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() + + "-" + dst_pm_->get_cname() + ")"); } void operator()(); sg_size_t sendMigrationData(sg_size_t size, int stage, int stage2_round, double mig_speed, double timeout); diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index c283575dfc..d69ac57e39 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -42,10 +42,12 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm, int coreAmount, extension_set(new simgrid::simix::Host()); if (TRACE_vm_is_enabled()) { - container_t host_container = instr::Container::byName(pm->getName()); + container_t host_container = instr::Container::byName(pm->get_name()); new instr::Container(name, "MSG_VM", host_container); - instr::Container::byName(getName())->getState("MSG_VM_STATE")->addEntityValue("start", "0 0 1"); // start is blue - instr::Container::byName(getName())->getState("MSG_VM_STATE")->addEntityValue("suspend", "1 0 0"); // suspend is red + instr::Container::byName(get_name())->getState("MSG_VM_STATE")->addEntityValue("start", "0 0 1"); // start is blue + instr::Container::byName(get_name()) + ->getState("MSG_VM_STATE") + ->addEntityValue("suspend", "1 0 0"); // suspend is red } } @@ -53,7 +55,7 @@ VirtualMachine::~VirtualMachine() { onDestruction(*this); - XBT_DEBUG("destroy %s", getCname()); + XBT_DEBUG("destroy %s", get_cname()); /* 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... @@ -67,13 +69,13 @@ VirtualMachine::~VirtualMachine() pimpl_netpoint = nullptr; if (TRACE_vm_is_enabled()) - simgrid::instr::Container::byName(getName())->removeFromParent(); + simgrid::instr::Container::byName(get_name())->removeFromParent(); } void VirtualMachine::start() { if (TRACE_vm_is_enabled()) - simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->pushEvent("start"); + simgrid::instr::Container::byName(get_name())->getState("MSG_VM_STATE")->pushEvent("start"); simgrid::simix::kernelImmediate([this]() { simgrid::vm::VmHostExt::ensureVmExtInstalled(); @@ -95,9 +97,9 @@ void VirtualMachine::start() 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).", - this->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(), - this->getCname()); + this->get_cname(), pm->get_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->get_cname(), + this->get_cname()); } } @@ -105,7 +107,7 @@ void VirtualMachine::start() }); if (TRACE_vm_is_enabled()) - simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->popEvent(); + simgrid::instr::Container::byName(get_name())->getState("MSG_VM_STATE")->popEvent(); } void VirtualMachine::suspend() @@ -113,7 +115,7 @@ void VirtualMachine::suspend() smx_actor_t issuer = SIMIX_process_self(); simgrid::simix::kernelImmediate([this, issuer]() { pimpl_vm_->suspend(issuer); }); if (TRACE_vm_is_enabled()) - simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->pushEvent("suspend"); + simgrid::instr::Container::byName(get_name())->getState("MSG_VM_STATE")->pushEvent("suspend"); XBT_DEBUG("vm_suspend done"); } @@ -121,7 +123,7 @@ void VirtualMachine::resume() { pimpl_vm_->resume(); if (TRACE_vm_is_enabled()) - simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->popEvent(); + simgrid::instr::Container::byName(get_name())->getState("MSG_VM_STATE")->popEvent(); } void VirtualMachine::shutdown() @@ -220,7 +222,7 @@ sg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount) const char* sg_vm_get_name(sg_vm_t vm) { - return vm->getCname(); + return vm->get_cname(); } /** @brief Get the physical host of a given VM. */ diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 6a9fd4d0d9..8960fb8366 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -119,7 +119,7 @@ void Actor::migrate(Host* new_host) if (TRACE_actor_is_enabled()) { // create new container on the new_host location - simgrid::instr::Container::byName(new_host->getName())->createChild(instr_pid(this), "ACTOR"); + simgrid::instr::Container::byName(new_host->get_name())->createChild(instr_pid(this), "ACTOR"); // end link link->endEvent(simgrid::instr::Container::byName(instr_pid(this)), "M", key); } @@ -140,14 +140,14 @@ bool Actor::isDaemon() return this->pimpl_->isDaemon(); } -const simgrid::xbt::string& Actor::getName() const +const simgrid::xbt::string& Actor::get_name() const { - return this->pimpl_->getName(); + return this->pimpl_->get_name(); } -const char* Actor::getCname() const +const char* Actor::get_cname() const { - return this->pimpl_->getCname(); + return this->pimpl_->get_cname(); } aid_t Actor::getPid() @@ -339,14 +339,14 @@ aid_t getPpid() return SIMIX_process_self()->ppid; } -std::string getName() +std::string get_name() { - return SIMIX_process_self()->getName(); + return SIMIX_process_self()->get_name(); } -const char* getCname() +const char* get_cname() { - return SIMIX_process_self()->getCname(); + return SIMIX_process_self()->get_cname(); } Host* getHost() @@ -357,7 +357,9 @@ Host* getHost() void suspend() { if (TRACE_actor_is_enabled()) - instr::Container::byName(getName() + "-" + std::to_string(getPid()))->getState("ACTOR_STATE")->pushEvent("suspend"); + instr::Container::byName(get_name() + "-" + std::to_string(getPid())) + ->getState("ACTOR_STATE") + ->pushEvent("suspend"); simcall_process_suspend(SIMIX_process_self()); } @@ -367,7 +369,7 @@ void resume() simgrid::simix::kernelImmediate([process] { process->resume(); }); if (TRACE_actor_is_enabled()) - instr::Container::byName(getName() + "-" + std::to_string(getPid()))->getState("ACTOR_STATE")->popEvent(); + instr::Container::byName(get_name() + "-" + std::to_string(getPid()))->getState("ACTOR_STATE")->popEvent(); } bool isSuspended() @@ -432,7 +434,7 @@ int sg_actor_get_PPID(sg_actor_t actor) */ const char* sg_actor_get_name(sg_actor_t actor) { - return actor->getCname(); + return actor->get_cname(); } sg_host_t sg_actor_get_host(sg_actor_t actor) diff --git a/src/s4u/s4u_engine.cpp b/src/s4u/s4u_engine.cpp index 221feb05c8..c2bb1b643f 100644 --- a/src/s4u/s4u_engine.cpp +++ b/src/s4u/s4u_engine.cpp @@ -193,7 +193,7 @@ s4u::NetZone* Engine::getNetRoot() static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* name) { - if (not strcmp(current->getCname(), name)) + if (not strcmp(current->get_cname(), name)) return current; for (auto const& elem : *(current->getChildren())) { @@ -228,14 +228,14 @@ void Engine::getNetpointList(std::vector* l void Engine::netpointRegister(simgrid::kernel::routing::NetPoint* point) { // simgrid::simix::kernelImmediate([&]{ FIXME: this segfaults in set_thread - pimpl->netpoints_[point->getName()] = point; + pimpl->netpoints_[point->get_name()] = point; // }); } /** @brief Unregister a given netpoint */ void Engine::netpointUnregister(simgrid::kernel::routing::NetPoint* point) { simgrid::simix::kernelImmediate([this, point] { - pimpl->netpoints_.erase(point->getName()); + pimpl->netpoints_.erase(point->get_name()); delete point; }); } diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 61c830583d..5cb5695a27 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -165,10 +165,10 @@ 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):", getCname(), dest->getCname(), + XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", get_cname(), dest->get_cname(), (latency == nullptr ? -1 : *latency)); for (auto const& link : links) - XBT_CDEBUG(surf_route, "Link %s", link->getCname()); + XBT_CDEBUG(surf_route, "Link %s", link->get_cname()); } } diff --git a/src/s4u/s4u_link.cpp b/src/s4u/s4u_link.cpp index b36652171c..a7d6c2a085 100644 --- a/src/s4u/s4u_link.cpp +++ b/src/s4u/s4u_link.cpp @@ -20,7 +20,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_link, s4u, "Logging specific to the S4U link const char* sg_link_name(sg_link_t link) { - return link->getCname(); + return link->get_cname(); } sg_link_t sg_link_by_name(const char* name) { @@ -80,17 +80,17 @@ Link* Link::byName(const char* name) return nullptr; return &res->piface_; } -const std::string& Link::getName() const +const std::string& Link::get_name() const { - return this->pimpl_->getName(); + return this->pimpl_->get_name(); } -const char* Link::getCname() const +const char* Link::get_cname() const { - return this->pimpl_->getCname(); + return this->pimpl_->get_cname(); } const char* Link::name() { - return getCname(); + return get_cname(); } bool Link::isUsed() { diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index 32ab0bb99c..92a03fcb65 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -16,14 +16,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_channel,s4u,"S4U Communication Mailboxes"); namespace simgrid { namespace s4u { -const simgrid::xbt::string& Mailbox::getName() const +const simgrid::xbt::string& Mailbox::get_name() const { - return pimpl_->getName(); + return pimpl_->get_name(); } -const char* Mailbox::getCname() const +const char* Mailbox::get_cname() const { - return pimpl_->getCname(); + return pimpl_->get_cname(); } MailboxPtr Mailbox::byName(const char*name) diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index 930acfecb2..8cede7fd59 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -69,7 +69,7 @@ std::vector* NetZone::getChildren() return children_; } -const char* NetZone::getCname() const +const char* NetZone::get_cname() const { return name_.c_str(); } @@ -81,7 +81,7 @@ NetZone* NetZone::getFather() void NetZone::getHosts(std::vector* whereto) { for (auto const& card : vertices_) { - s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->getName()); + s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->get_name()); if (host != nullptr) whereto->push_back(host); } @@ -91,7 +91,7 @@ int NetZone::getHostCount() { int count = 0; for (auto const& card : vertices_) { - s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->getName()); + s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->get_name()); if (host != nullptr) count++; } @@ -122,7 +122,7 @@ sg_netzone_t sg_zone_get_root() const char* sg_zone_get_name(sg_netzone_t netzone) { - return netzone->getCname(); + return netzone->get_cname(); } sg_netzone_t sg_zone_get_by_name(const char* name) @@ -133,7 +133,7 @@ sg_netzone_t sg_zone_get_by_name(const char* name) void sg_zone_get_sons(sg_netzone_t netzone, xbt_dict_t whereto) { for (auto const& elem : *netzone->getChildren()) { - xbt_dict_set(whereto, elem->getCname(), static_cast(elem), nullptr); + xbt_dict_set(whereto, elem->get_cname(), static_cast(elem), nullptr); } } diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index 78b3013ab7..1c3d02d8b6 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -27,7 +27,7 @@ void XBT_ATTRIB_DEPRECATED_v322( getStorageList(std::map* whereTo) { for (auto const& s : simgrid::s4u::Engine::getInstance()->getAllStorages()) - whereTo->insert({s->getName(), s}); + whereTo->insert({s->get_name(), s}); } Storage::Storage(std::string name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(name) @@ -40,12 +40,12 @@ Storage* Storage::byName(std::string name) return Engine::getInstance()->storageByNameOrNull(name); } -const std::string& Storage::getName() const +const std::string& Storage::get_name() const { return name_; } -const char* Storage::getCname() const +const char* Storage::get_cname() const { return name_.c_str(); } @@ -109,13 +109,13 @@ simgrid::xbt::signal Storage::onDestruction; const char* sg_storage_get_name(sg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters"); - return storage->getCname(); + return storage->get_cname(); } const char* sg_storage_get_host(sg_storage_t storage) { xbt_assert((storage != nullptr), "Invalid parameters"); - return storage->getHost()->getCname(); + return storage->getHost()->get_cname(); } /** \ingroup sg_storage_management diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index e47f72a728..84318b32af 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -45,7 +45,7 @@ sg_host_t *sg_host_list() { const char *sg_host_get_name(sg_host_t host) { - return host->getCname(); + return host->get_cname(); } void* sg_host_extension_get(sg_host_t host, size_t ext) @@ -65,8 +65,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))->getCname(), - (*static_cast(pb))->getCname()); + return strcmp((*static_cast(pa))->get_cname(), + (*static_cast(pb))->get_cname()); } xbt_dynar_t sg_hosts_as_dynar() @@ -103,7 +103,7 @@ xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){ for (auto const& 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->getCname(), nullptr); + xbt_dict_set(res, mount_name, (void*)storage->get_cname(), nullptr); } return res; @@ -303,7 +303,7 @@ double sg_host_route_bandwidth(sg_host_t from, sg_host_t to) /** @brief Displays debugging information about a host */ void sg_host_dump(sg_host_t host) { - XBT_INFO("Displaying host %s", host->getCname()); + XBT_INFO("Displaying host %s", host->get_cname()); XBT_INFO(" - speed: %.0f", host->getSpeed()); XBT_INFO(" - available speed: %.2f", sg_host_get_available_speed(host)); std::map* props = host->getProperties(); diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 7047bb2d0e..9569b3967a 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -179,7 +179,7 @@ void ActorImpl::daemonize() simgrid::s4u::Actor* ActorImpl::restart() { - XBT_DEBUG("Restarting process %s on %s", getCname(), host->getCname()); + XBT_DEBUG("Restarting process %s on %s", get_cname(), host->get_cname()); // retrieve the arguments of the old process // FIXME: Factorize this with SIMIX_host_add_auto_restart_process ? @@ -250,7 +250,7 @@ void ActorImpl::resume() smx_activity_t ActorImpl::sleep(double duration) { if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->getCname()); + THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->get_cname()); simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl(); synchro->host = host; @@ -305,10 +305,10 @@ smx_actor_t SIMIX_process_create(const char* name, std::function code, v std::map* properties, smx_actor_t parent_process) { - XBT_DEBUG("Start process %s on host '%s'", name, host->getCname()); + XBT_DEBUG("Start process %s on host '%s'", name, host->get_cname()); if (host->isOff()) { - XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, host->getCname()); + XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, host->get_cname()); return nullptr; } @@ -347,12 +347,12 @@ 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->getCname(), host->getCname()); + XBT_DEBUG("Inserting %s(%s) in the to_run list", process->get_cname(), host->get_cname()); simix_global->process_to_run.push_back(process); intrusive_ptr_add_ref(process); /* Tracing the process creation */ if (TRACE_actor_is_enabled()) - simgrid::instr::Container::byName(process->host->getName())->createChild(instr_pid(process->ciface()), "ACTOR"); + simgrid::instr::Container::byName(process->host->get_name())->createChild(instr_pid(process->ciface()), "ACTOR"); /* The onCreation() signal must be delayed until there, where the pid and everything is set */ simgrid::s4u::ActorPtr tmp = process->iface(); // Passing this directly to onCreation will lead to crashes simgrid::s4u::Actor::onCreation(tmp); @@ -404,13 +404,13 @@ 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->getCname(), host->getCname()); + XBT_DEBUG("Inserting %s(%s) in the to_run list", process->get_cname(), host->get_cname()); simix_global->process_to_run.push_back(process); intrusive_ptr_add_ref(process); /* Tracing the process creation */ if (TRACE_actor_is_enabled()) - simgrid::instr::Container::byName(process->host->getName())->createChild(instr_pid(process->ciface()), "ACTOR"); + simgrid::instr::Container::byName(process->host->get_name())->createChild(instr_pid(process->ciface()), "ACTOR"); auto* context = dynamic_cast(process->context); if (not context) @@ -460,13 +460,13 @@ void SIMIX_process_runall() void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) { if (process->finished) { - XBT_DEBUG("Ignoring request to kill process %s@%s that is already dead", process->getCname(), - process->host->getCname()); + XBT_DEBUG("Ignoring request to kill process %s@%s that is already dead", process->get_cname(), + process->host->get_cname()); return; } - XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer->getCname(), issuer->host->getCname(), process->getCname(), - process->host->getCname()); + XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer->get_cname(), issuer->host->get_cname(), + process->get_cname(), process->host->get_cname()); process->context->iwannadie = 1; process->blocked = 0; @@ -714,7 +714,7 @@ void SIMIX_process_sleep_destroy(smx_activity_t synchro) */ void SIMIX_process_yield(smx_actor_t self) { - XBT_DEBUG("Yield actor '%s'", self->getCname()); + XBT_DEBUG("Yield actor '%s'", self->get_cname()); /* Go into sleep and return control to maestro */ self->context->suspend(); @@ -729,11 +729,11 @@ void SIMIX_process_yield(smx_actor_t self) SIMIX_process_on_exit_runall(self); /* Add the process to the list of process to restart, only if the host is down */ if (self->auto_restart && self->host->isOff()) { - SIMIX_host_add_auto_restart_process(self->host, self->getCname(), self->code, self->userdata, + SIMIX_host_add_auto_restart_process(self->host, self->get_cname(), self->code, self->userdata, SIMIX_timer_get_date(self->kill_timer), self->getProperties(), self->auto_restart); } - XBT_DEBUG("Process %s@%s is dead", self->getCname(), self->host->getCname()); + XBT_DEBUG("Process %s@%s is dead", self->get_cname(), self->host->get_cname()); self->context->stop(); } diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index c2449fbfd8..9fe8d89d9d 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -57,8 +57,8 @@ public: aid_t pid = 0; aid_t ppid = -1; simgrid::xbt::string name; - const simgrid::xbt::string& getName() const { return name; } - const char* getCname() const { return name.c_str(); } + const simgrid::xbt::string& get_name() const { return name; } + const char* get_cname() const { return name.c_str(); } s4u::Host* host = nullptr; /* the host on which the process is running */ smx_context_t context = nullptr; /* the context (uctx/raw/thread) that executes the user function */ diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 14f60e6287..5a87f19a29 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -35,7 +35,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix); void simcall_call(smx_actor_t actor) { if (actor != simix_global->maestro_process) { - XBT_DEBUG("Yield actor '%s' on simcall %s (%d)", actor->getCname(), SIMIX_simcall_name(actor->simcall.call), + XBT_DEBUG("Yield actor '%s' on simcall %s (%d)", actor->get_cname(), SIMIX_simcall_name(actor->simcall.call), (int)actor->simcall.call); SIMIX_process_yield(actor); } else { @@ -247,7 +247,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->getCname(), process->host->getCname()); + XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->get_cname(), process->host->get_cname()); process->kill_timer = SIMIX_timer_set(kill_time, [process] { 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 6664cfa13a..cdad122f8a 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -229,8 +229,8 @@ void SIMIX_global_init(int *argc, char **argv) }); simgrid::surf::storageCreatedCallbacks.connect([](simgrid::surf::StorageImpl* storage) { - sg_storage_t s = simgrid::s4u::Storage::byName(storage->getCname()); - xbt_assert(s != nullptr, "Storage not found for name %s", storage->getCname()); + sg_storage_t s = simgrid::s4u::Storage::byName(storage->get_cname()); + xbt_assert(s != nullptr, "Storage not found for name %s", storage->get_cname()); }); } @@ -496,7 +496,7 @@ void SIMIX_run() /* If only daemon processes remain, cancel their actions, mark them to die and reschedule them */ if (simix_global->process_list.size() == simix_global->daemons.size()) for (auto const& dmon : simix_global->daemons) { - XBT_DEBUG("Kill %s", dmon->getCname()); + XBT_DEBUG("Kill %s", dmon->get_cname()); SIMIX_process_kill(dmon, simix_global->maestro_process); } } @@ -523,7 +523,7 @@ void SIMIX_run() /* Autorestart all process */ for (auto const& host : host_that_restart) { - XBT_INFO("Restart processes on host %s", host->getCname()); + XBT_INFO("Restart processes on host %s", host->get_cname()); SIMIX_host_autorestart(host); } host_that_restart.clear(); @@ -654,11 +654,11 @@ void SIMIX_display_process_status() synchro_description = "I/O"; XBT_INFO("Process %ld (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid, - process->getCname(), process->host->getCname(), synchro_description, process->waiting_synchro.get(), + process->get_cname(), process->host->get_cname(), synchro_description, process->waiting_synchro.get(), process->waiting_synchro->name.c_str(), (int)process->waiting_synchro->state); } else { - XBT_INFO("Process %ld (%s@%s)", process->pid, process->getCname(), process->host->getCname()); + XBT_INFO("Process %ld (%s@%s)", process->pid, process->get_cname(), process->host->get_cname()); } } } diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index c85a416c33..29a81f4e37 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -30,7 +30,7 @@ namespace simgrid { if (not process_list.empty()) { std::string msg = std::string("Shutting down host, but it's not empty:"); for (auto const& process : process_list) - msg += "\n\t" + std::string(process.getName()); + msg += "\n\t" + std::string(process.get_name()); SIMIX_display_process_status(); THROWF(arg_error, 0, "%s", msg.c_str()); @@ -50,7 +50,7 @@ namespace simgrid { void Host::turnOn() { for (auto const& arg : boot_processes) { - XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->getCname()); + XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->get_cname()); smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host, arg->properties.get(), nullptr); if (arg->kill_time >= 0) @@ -76,12 +76,12 @@ void SIMIX_host_off(sg_host_t h, smx_actor_t issuer) if (not host->process_list.empty()) { for (auto& process : host->process_list) { SIMIX_process_kill(&process, issuer); - XBT_DEBUG("Killing %s@%s on behalf of %s which turned off that host.", process.getCname(), - process.host->getCname(), issuer->getCname()); + XBT_DEBUG("Killing %s@%s on behalf of %s which turned off that host.", process.get_cname(), + process.host->get_cname(), issuer->get_cname()); } } } else { - XBT_INFO("Host %s is already off", h->getCname()); + XBT_INFO("Host %s is already off", h->get_cname()); } } @@ -92,7 +92,7 @@ const char* sg_host_self_get_name() if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process) return ""; - return host->getCname(); + return host->get_cname(); } /** @@ -110,11 +110,11 @@ void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, std:: new simgrid::kernel::actor::ProcessArg(name, code, data, host, kill_time, nullptr, auto_restart); arg->properties.reset(properties, [](decltype(properties)) {}); - if (host->isOff() && watched_hosts.find(host->getCname()) == watched_hosts.end()) { - watched_hosts.insert(host->getCname()); - XBT_DEBUG("Push host %s to watched_hosts because state == SURF_RESOURCE_OFF", host->getCname()); + if (host->isOff() && watched_hosts.find(host->get_cname()) == watched_hosts.end()) { + watched_hosts.insert(host->get_cname()); + XBT_DEBUG("Push host %s to watched_hosts because state == SURF_RESOURCE_OFF", host->get_cname()); } - XBT_DEBUG("Adding Process %s to the auto-restart list of Host %s", arg->name.c_str(), arg->host->getCname()); + XBT_DEBUG("Adding Process %s to the auto-restart list of Host %s", arg->name.c_str(), arg->host->get_cname()); host->extension()->auto_restart_processes.push_back(arg); } @@ -125,7 +125,7 @@ void SIMIX_host_autorestart(sg_host_t host) host->extension()->auto_restart_processes; for (auto const& arg : process_list) { - XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->getCname()); + XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->get_cname()); smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host, arg->properties.get(), nullptr); if (arg->kill_time >= 0) @@ -243,7 +243,7 @@ void SIMIX_execution_finish(smx_activity_t synchro) break; case SIMIX_FAILED: - XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->getCname()); + XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->get_cname()); simcall->issuer->context->iwannadie = 1; SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); break; diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 3852732056..d147d4d5c8 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -464,13 +464,13 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm) comm->surfAction_->set_data(comm.get()); comm->state = SIMIX_RUNNING; - XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->getCname(), - receiver->getCname(), comm->surfAction_); + XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->get_cname(), + receiver->get_cname(), comm->surfAction_); /* If a link is failed, detect it immediately */ if (comm->surfAction_->get_state() == simgrid::kernel::resource::Action::State::failed) { - XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->getCname(), - receiver->getCname()); + XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->get_cname(), + receiver->get_cname()); comm->state = SIMIX_LINK_FAILURE; comm->cleanupSurf(); } @@ -481,11 +481,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->getCname(), comm->src_proc->host->getCname()); + comm->src_proc->get_cname(), comm->src_proc->host->get_cname()); else XBT_DEBUG("The communication is suspended on startup because dst (%s@%s) was suspended since it initiated the " "communication", - comm->dst_proc->getCname(), comm->dst_proc->host->getCname()); + comm->dst_proc->get_cname(), comm->dst_proc->host->get_cname()); comm->surfAction_->suspend(); } @@ -566,8 +566,8 @@ 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->getCname() : nullptr, - comm->dst_proc ? comm->dst_proc->host->getCname() : nullptr, simcall->issuer->getCname(), + synchro.get(), comm->src_proc ? comm->src_proc->host->get_cname() : nullptr, + comm->dst_proc ? comm->dst_proc->host->get_cname() : nullptr, simcall->issuer->get_cname(), simcall->issuer, comm->detached); if (comm->src_proc == simcall->issuer) { XBT_DEBUG("I'm source"); @@ -690,8 +690,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->getCname() : "a finished process", comm->src_buff, - comm->dst_proc ? comm->dst_proc->host->getCname() : "a finished process", comm->dst_buff, buff_size); + comm->src_proc ? comm->src_proc->host->get_cname() : "a finished process", comm->src_buff, + comm->dst_proc ? comm->dst_proc->host->get_cname() : "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/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index aa14f3b0a7..475d8a0abd 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -152,9 +152,9 @@ int PMPI_Get_address(void *location, MPI_Aint * address) int PMPI_Get_processor_name(char *name, int *resultlen) { - 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); + strncpy(name, sg_host_self()->get_cname(), + strlen(sg_host_self()->get_cname()) < MPI_MAX_PROCESSOR_NAME - 1 ? strlen(sg_host_self()->get_cname()) + 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/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index 2005f1c235..d910bac429 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -105,8 +105,8 @@ std::vector HostImpl::get_attached_storages() { std::vector storages; for (auto const& s : storage_) - if (s.second->getHost() == piface_->getCname()) - storages.push_back(s.second->piface_.getCname()); + if (s.second->getHost() == piface_->get_cname()) + storages.push_back(s.second->piface_.get_cname()); return storages; } diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 2b42c2b7fb..a9a81104ff 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -185,7 +185,7 @@ CpuAction *CpuCas01::sleep(double duration) if (duration > 0) duration = std::max(duration, sg_surf_precision); - XBT_IN("(%s,%g)", getCname(), duration); + XBT_IN("(%s,%g)", get_cname(), duration); CpuCas01Action* action = new CpuCas01Action(model(), 1.0, isOff(), speed_.scale * speed_.peak, constraint()); // FIXME: sleep variables should not consume 1.0 in System::expand() diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index b6c3f2c812..21867e6631 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -28,7 +28,7 @@ void CpuModel::update_actions_state_lazy(double now, double /*delta*/) XBT_CDEBUG(surf_kernel, "Something happened to action %p", action); if (TRACE_is_enabled()) { Cpu* cpu = static_cast(action->get_variable()->get_constraint(0)->get_id()); - TRACE_surf_host_set_utilization(cpu->getCname(), action->get_category(), action->get_variable()->get_value(), + TRACE_surf_host_set_utilization(cpu->get_cname(), action->get_category(), action->get_variable()->get_value(), action->get_last_update(), now - action->get_last_update()); } @@ -56,7 +56,7 @@ void CpuModel::update_actions_state_full(double now, double delta) ++it; // increment iterator here since the following calls to action.finish() may invalidate it if (TRACE_is_enabled()) { Cpu* cpu = static_cast(action.get_variable()->get_constraint(0)->get_id()); - TRACE_surf_host_set_utilization(cpu->getCname(), action.get_category(), action.get_variable()->get_value(), + TRACE_surf_host_set_utilization(cpu->get_cname(), action.get_category(), action.get_variable()->get_value(), now - delta, delta); TRACE_last_timestamp_to_dump = now - delta; } @@ -83,14 +83,14 @@ Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, std::vector* speedPerPstate, int core) - : Resource(model, host->getCname(), constraint), coresAmount_(core), host_(host) + : Resource(model, host->get_cname(), constraint), coresAmount_(core), host_(host) { - xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->getCname()); + xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->get_cname()); speed_.peak = speedPerPstate->front(); speed_.scale = 1; host->pimpl_cpu = this; - xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->getCname()); + xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->get_cname()); // Copy the power peak array: for (double const& value : *speedPerPstate) { @@ -110,7 +110,7 @@ void Cpu::setPState(int pstate_index) xbt_assert(pstate_index <= static_cast(speedPerPstate_.size()), "Invalid parameters for CPU %s (pstate %d > length of pstates %d). Please fix your platform file, or your " "call to change the pstate.", - getCname(), pstate_index, static_cast(speedPerPstate_.size())); + get_cname(), pstate_index, static_cast(speedPerPstate_.size())); double new_peak_speed = speedPerPstate_[pstate_index]; pstate_ = pstate_index; @@ -143,7 +143,7 @@ double Cpu::get_available_speed() } void Cpu::onSpeedChange() { - TRACE_surf_host_set_speed(surf_get_clock(), getCname(), coresAmount_ * speed_.scale * speed_.peak); + TRACE_surf_host_set_speed(surf_get_clock(), get_cname(), coresAmount_ * speed_.scale * speed_.peak); s4u::Host::onSpeedChange(*host_); } @@ -154,13 +154,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_->getCname()); + xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Host %s", host_->get_cname()); stateEvent_ = future_evt_set->add_trace(trace, this); } void Cpu::set_speed_trace(tmgr_trace_t trace) { - xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->getCname()); + xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->get_cname()); speed_.event = future_evt_set->add_trace(trace, this); } @@ -185,7 +185,7 @@ void CpuAction::update_remains_lazy(double now) if (TRACE_is_enabled()) { Cpu* cpu = static_cast(get_variable()->get_constraint(0)->get_id()); - TRACE_surf_host_set_utilization(cpu->getCname(), get_category(), get_last_value(), get_last_update(), + TRACE_surf_host_set_utilization(cpu->get_cname(), get_category(), get_last_value(), get_last_update(), now - get_last_update()); } XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, get_remains_no_update()); diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 90a5316a95..5800817ed9 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -489,7 +489,7 @@ void CpuTi::update_actions_finish_time(double now) else model()->get_action_heap().remove(&action); - XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", getCname(), + XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", get_cname(), &action, action.get_start_time(), action.get_finish_time(), action.get_max_duration()); } /* remove from modified cpu */ @@ -548,7 +548,7 @@ void CpuTi::update_remaining_amount(double now) CpuAction *CpuTi::execution_start(double size) { - XBT_IN("(%s,%g)", getCname(), size); + XBT_IN("(%s,%g)", get_cname(), size); CpuTiAction* action = new CpuTiAction(static_cast(model()), size, isOff(), this); action_set_.push_back(*action); @@ -563,7 +563,7 @@ CpuAction *CpuTi::sleep(double duration) if (duration > 0) duration = std::max(duration, sg_surf_precision); - XBT_IN("(%s,%g)", getCname(), duration); + XBT_IN("(%s,%g)", get_cname(), duration); CpuTiAction* action = new CpuTiAction(static_cast(model()), 1.0, isOff(), this); action->set_max_duration(duration); diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index fcb53ce652..ddbe0af707 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -67,7 +67,7 @@ static container_t lowestCommonAncestor (container_t a1, container_t a2) static void linkContainers(container_t src, container_t dst, std::set* filter) { //ignore loopback - if (src->getName() == "__loopback__" || dst->getName() == "__loopback__") { + if (src->get_name() == "__loopback__" || dst->get_name() == "__loopback__") { XBT_DEBUG (" linkContainers: ignoring loopback link"); return; } @@ -79,14 +79,14 @@ static void linkContainers(container_t src, container_t dst, std::setgetName() + dst->getName(); - std::string aux2 = dst->getName() + src->getName(); + std::string aux1 = src->get_name() + dst->get_name(); + std::string aux2 = dst->get_name() + src->get_name(); if (filter->find(aux1) != filter->end()) { - XBT_DEBUG(" linkContainers: already registered %s <-> %s (1)", src->getCname(), dst->getCname()); + XBT_DEBUG(" linkContainers: already registered %s <-> %s (1)", src->get_cname(), dst->get_cname()); return; } if (filter->find(aux2) != filter->end()) { - XBT_DEBUG(" linkContainers: already registered %s <-> %s (2)", dst->getCname(), src->getCname()); + XBT_DEBUG(" linkContainers: already registered %s <-> %s (2)", dst->get_cname(), src->get_cname()); return; } @@ -95,14 +95,14 @@ static void linkContainers(container_t src, container_t dst, std::setinsert(aux2); //declare type - std::string link_typename = father->type_->getName() + "-" + src->type_->getName() + - std::to_string(src->type_->getId()) + "-" + dst->type_->getName() + - std::to_string(dst->type_->getId()); + std::string link_typename = father->type_->get_name() + "-" + src->type_->get_name() + + std::to_string(src->type_->get_id()) + "-" + dst->type_->get_name() + + std::to_string(dst->type_->get_id()); simgrid::instr::LinkType* link = father->type_->getOrCreateLinkType(link_typename, src->type_, dst->type_); link->setCallingContainer(father); //register EDGE types for triva configuration - trivaEdgeTypes.insert(link->getName()); + trivaEdgeTypes.insert(link->get_name()); //create the link static long long counter = 0; @@ -113,7 +113,7 @@ static void linkContainers(container_t src, container_t dst, std::setstartEvent(src, "topology", key); link->endEvent(dst, "topology", key); - XBT_DEBUG(" linkContainers %s <-> %s", src->getCname(), dst->getCname()); + XBT_DEBUG(" linkContainers %s <-> %s", src->get_cname(), dst->get_cname()); } static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t container, @@ -123,11 +123,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->getCname()); + XBT_DEBUG("Graph extraction for NetZone = %s", netzone->get_cname()); if (not netzone->getChildren()->empty()) { //bottom-up recursion for (auto const& nz_son : *netzone->getChildren()) { - container_t child_container = container->children_.at(nz_son->getCname()); + container_t child_container = container->children_.at(nz_son->get_cname()); recursiveGraphExtraction(nz_son, child_container, filter); } } @@ -152,7 +152,7 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t */ static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone) { - std::string id = netzone.getName(); + std::string id = netzone.get_name(); if (simgrid::instr::Container::getRoot() == nullptr) { simgrid::instr::NetZoneContainer* root = new simgrid::instr::NetZoneContainer(id, 0, nullptr); @@ -190,7 +190,7 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link) return; container_t father = currentContainer.back(); - container_t container = new simgrid::instr::Container(link.getName(), "LINK", father); + container_t container = new simgrid::instr::Container(link.get_name(), "LINK", father); if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_link())) { simgrid::instr::VariableType* bandwidth = container->type_->getOrCreateVariableType("bandwidth", ""); @@ -250,7 +250,7 @@ static void sg_instr_new_host(simgrid::s4u::Host& host) static void sg_instr_new_router(simgrid::kernel::routing::NetPoint * netpoint) { if (netpoint->isRouter() && TRACE_is_enabled() && TRACE_needs_platform()) - new simgrid::instr::RouterContainer(netpoint->getCname(), currentContainer.back()); + new simgrid::instr::RouterContainer(netpoint->get_cname(), currentContainer.back()); } static void instr_routing_parse_end_platform () @@ -284,10 +284,10 @@ void instr_routing_define_callbacks () */ static void recursiveNewVariableType(std::string new_typename, std::string color, simgrid::instr::Type* root) { - if (root->getName() == "HOST" || root->getName() == "MSG_VM") + if (root->get_name() == "HOST" || root->get_name() == "MSG_VM") root->getOrCreateVariableType(std::string("p") + new_typename, color); - if (root->getName() == "LINK") + if (root->get_name() == "LINK") root->getOrCreateVariableType(std::string("b") + new_typename, color); for (auto elm : root->children_) { @@ -303,7 +303,7 @@ void instr_new_variable_type(std::string new_typename, std::string color) static void recursiveNewUserVariableType(std::string father_type, std::string new_typename, std::string color, simgrid::instr::Type* root) { - if (root->getName() == father_type) { + if (root->get_name() == father_type) { root->getOrCreateVariableType(new_typename, color); } for (auto elm : root->children_) @@ -317,7 +317,7 @@ void instr_new_user_variable_type(std::string father_type, std::string new_typen static void recursiveNewUserStateType(std::string father_type, std::string new_typename, simgrid::instr::Type* root) { - if (root->getName() == father_type) + if (root->get_name() == father_type) root->getOrCreateStateType(new_typename); for (auto elm : root->children_) @@ -332,7 +332,7 @@ void instr_new_user_state_type(std::string father_type, std::string new_typename static void recursiveNewValueForUserStateType(std::string type_name, const char* val, std::string color, simgrid::instr::Type* root) { - if (root->getName() == type_name) + if (root->get_name() == type_name) static_cast(root)->addEntityValue(val, color); for (auto elm : root->children_) @@ -353,7 +353,7 @@ static void recursiveXBTGraphExtraction(xbt_graph_t graph, std::mapgetChildren()->empty()) { //bottom-up recursion for (auto const& netzone_child : *netzone->getChildren()) { - container_t child_container = container->children_.at(netzone_child->getCname()); + container_t child_container = container->children_.at(netzone_child->get_cname()); recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container); } } diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index ed03321f8e..64f405bd87 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -170,7 +170,7 @@ void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/) kernel::lmm::Constraint* constraint = action->get_variable()->get_constraint(i); NetworkCm02Link* link = static_cast(constraint->get_id()); double value = action->get_variable()->get_value() * action->get_variable()->get_constraint_weight(i); - TRACE_surf_link_set_utilization(link->getCname(), action->get_category(), value, action->get_last_update(), + TRACE_surf_link_set_utilization(link->get_cname(), action->get_category(), value, action->get_last_update(), now - action->get_last_update()); } } @@ -218,7 +218,7 @@ void NetworkCm02Model::update_actions_state_full(double now, double delta) kernel::lmm::Constraint* constraint = action.get_variable()->get_constraint(i); NetworkCm02Link* link = static_cast(constraint->get_id()); TRACE_surf_link_set_utilization( - link->getCname(), action.get_category(), + link->get_cname(), action.get_category(), (action.get_variable()->get_value() * action.get_variable()->get_constraint_weight(i)), action.get_last_update(), now - action.get_last_update()); } @@ -248,12 +248,12 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos std::vector back_route; std::vector route; - XBT_IN("(%s,%s,%g,%g)", src->getCname(), dst->getCname(), size, rate); + XBT_IN("(%s,%s,%g,%g)", src->get_cname(), dst->get_cname(), 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->getCname(), dst->getCname()); + src->get_cname(), dst->get_cname()); for (auto const& link : route) if (link->isOff()) @@ -399,7 +399,8 @@ void NetworkCm02Link::setBandwidth(double value) model()->get_maxmin_system()->update_constraint_bound(constraint(), sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale)); - TRACE_surf_link_set_bandwidth(surf_get_clock(), getCname(), sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale); + TRACE_surf_link_set_bandwidth(surf_get_clock(), get_cname(), + sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale); if (sg_weight_S_parameter > 0) { double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale); diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 7d2ecbfa6b..24258c57b5 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -26,7 +26,7 @@ static void IB_create_host_callback(simgrid::s4u::Host& host){ IBNode* act = new IBNode(id); id++; - ((NetworkIBModel*)surf_network_model)->active_nodes.insert({host.getName(), act}); + ((NetworkIBModel*)surf_network_model)->active_nodes.insert({host.get_name(), act}); } static void IB_action_state_changed_callback(simgrid::surf::NetworkAction* action) @@ -52,18 +52,18 @@ static void IB_action_init_callback(simgrid::surf::NetworkAction* action, simgri simgrid::surf::IBNode* act_src; simgrid::surf::IBNode* act_dst; - auto asrc = ibModel->active_nodes.find(src->getName()); + auto asrc = ibModel->active_nodes.find(src->get_name()); if (asrc != ibModel->active_nodes.end()) { act_src = asrc->second; } else { - throw std::out_of_range(std::string("Could not find '") + src->getCname() + "' active comms !"); + throw std::out_of_range(std::string("Could not find '") + src->get_cname() + "' active comms !"); } - auto adst = ibModel->active_nodes.find(dst->getName()); + auto adst = ibModel->active_nodes.find(dst->get_name()); if (adst != ibModel->active_nodes.end()) { act_dst = adst->second; } else { - throw std::out_of_range(std::string("Could not find '") + dst->getCname() + "' active comms !"); + throw std::out_of_range(std::string("Could not find '") + dst->get_cname() + "' active comms !"); } ibModel->active_comms[action]=std::make_pair(act_src, act_dst); diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index b7efd168f3..d843caa6fc 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -167,17 +167,17 @@ namespace simgrid { } void LinkImpl::setStateTrace(tmgr_trace_t trace) { - xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Link %s", getCname()); + xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Link %s", get_cname()); stateEvent_ = future_evt_set->add_trace(trace, this); } void LinkImpl::setBandwidthTrace(tmgr_trace_t trace) { - xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth trace to Link %s", getCname()); + xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth trace to Link %s", get_cname()); bandwidth_.event = future_evt_set->add_trace(trace, this); } void LinkImpl::setLatencyTrace(tmgr_trace_t trace) { - xbt_assert(latency_.event == nullptr, "Cannot set a second latency trace to Link %s", getCname()); + xbt_assert(latency_.event == nullptr, "Cannot set a second latency trace to Link %s", get_cname()); latency_.event = future_evt_set->add_trace(trace, this); } diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index f13305591c..ca3409ee26 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -92,18 +92,18 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin if (link_list.size() == 1) { simgrid::surf::LinkNS3* link = static_cast(link_list[0]); - XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->getCname(), dst->getCname(), link->getCname(), + XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->get_cname(), dst->get_cname(), link->get_cname(), (symmetrical ? "(symmetrical)" : "(not symmetrical)")); // XBT_DEBUG("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id); - XBT_DEBUG("\tLink (%s) bw:%fbps lat:%fs", link->getCname(), link->bandwidth(), link->latency()); + XBT_DEBUG("\tLink (%s) bw:%fbps lat:%fs", link->get_cname(), link->bandwidth(), link->latency()); // create link ns3 NetPointNs3* host_src = src->extension(); NetPointNs3* host_dst = dst->extension(); - xbt_assert(host_src != nullptr, "Network element %s does not seem to be NS3-ready", src->getCname()); - xbt_assert(host_dst != nullptr, "Network element %s does not seem to be NS3-ready", dst->getCname()); + xbt_assert(host_src != nullptr, "Network element %s does not seem to be NS3-ready", src->get_cname()); + xbt_assert(host_dst != nullptr, "Network element %s does not seem to be NS3-ready", dst->get_cname()); ns3_add_link(host_src, host_dst, link->bandwidth(), link->latency()); } else { @@ -115,7 +115,7 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin "of length 1.\n" "WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently " "ignored.", - src->getCname(), dst->getCname(), link_list.size()); + src->get_cname(), dst->get_cname(), link_list.size()); warned_about_long_routes = true; } } @@ -158,7 +158,7 @@ NetworkNS3Model::NetworkNS3Model() : NetworkModel(Model::UpdateAlgo::Full) simgrid::kernel::routing::NetPoint::onCreation.connect([](simgrid::kernel::routing::NetPoint* pt) { pt->extension_set(new NetPointNs3()); - XBT_VERB("SimGrid's %s is known as node %d within NS3", pt->getCname(), pt->extension()->node_num); + XBT_VERB("SimGrid's %s is known as node %d within NS3", pt->get_cname(), pt->extension()->node_num); }); simgrid::surf::on_cluster.connect(&clusterCreation_cb); @@ -231,7 +231,7 @@ void NetworkNS3Model::update_actions_state(double now, double delta) action->src_->routeTo(action->dst_, route, nullptr); for (auto const& link : route) - TRACE_surf_link_set_utilization(link->getCname(), action->get_category(), (data_delta_sent) / delta, + TRACE_surf_link_set_utilization(link->get_cname(), action->get_category(), (data_delta_sent) / delta, now - delta, delta); action->lastSent_ = sgFlow->sentBytes_; @@ -292,7 +292,7 @@ void LinkNS3::setLatencyTrace(tmgr_trace_t trace) { NetworkNS3Action::NetworkNS3Action(kernel::resource::Model* model, double totalBytes, s4u::Host* src, s4u::Host* dst) : NetworkAction(model, totalBytes, false) { - XBT_DEBUG("Communicate from %s to %s", src->getCname(), dst->getCname()); + XBT_DEBUG("Communicate from %s to %s", src->get_cname(), dst->get_cname()); src_ = src; dst_ = dst; @@ -305,10 +305,10 @@ NetworkNS3Action::NetworkNS3Action(kernel::resource::Model* model, double totalB ns3::Ptr dst_node = dst->pimpl_netpoint->extension()->ns3Node_; xbt_assert(node2 < IPV4addr.size(), "Element %s is unknown to NS3. Is it connected to any one-hop link?", - dst->pimpl_netpoint->getCname()); + dst->pimpl_netpoint->get_cname()); std::string& addr = IPV4addr[node2]; xbt_assert(not addr.empty(), "Element %s is unknown to NS3. Is it connected to any one-hop link?", - dst->pimpl_netpoint->getCname()); + dst->pimpl_netpoint->get_cname()); XBT_DEBUG("ns3: Create flow of %.0f Bytes from %u to %u with Interface %s", totalBytes, node1, node2, addr.c_str()); ns3::PacketSinkHelper sink("ns3::TcpSocketFactory", ns3::InetSocketAddress(ns3::Ipv4Address::GetAny(), port_number)); diff --git a/src/surf/plugins/host_dvfs.cpp b/src/surf/plugins/host_dvfs.cpp index 1f11563731..130147d8a6 100644 --- a/src/surf/plugins/host_dvfs.cpp +++ b/src/surf/plugins/host_dvfs.cpp @@ -233,7 +233,7 @@ static void on_host_added(simgrid::s4u::Host& host) if (dynamic_cast(&host)) // Ignore virtual machines return; - std::string name = std::string("dvfs-daemon-") + host.getCname(); + std::string name = std::string("dvfs-daemon-") + host.get_cname(); simgrid::s4u::ActorPtr daemon = simgrid::s4u::Actor::createActor(name.c_str(), &host, []() { /** * This lambda function is the function the actor (daemon) will execute @@ -242,7 +242,7 @@ static void on_host_added(simgrid::s4u::Host& host) */ simgrid::s4u::ActorPtr daemonProc = simgrid::s4u::Actor::self(); - XBT_DEBUG("DVFS process on %s is a daemon: %d", daemonProc->getHost()->getName().c_str(), daemonProc->isDaemon()); + XBT_DEBUG("DVFS process on %s is a daemon: %d", daemonProc->getHost()->get_cname(), daemonProc->isDaemon()); std::string dvfs_governor; const char* host_conf = daemonProc->getHost()->getProperty(property_governor); @@ -269,7 +269,7 @@ static void on_host_added(simgrid::s4u::Host& host) new simgrid::plugin::dvfs::Powersave(daemonProc->getHost())); } else { XBT_CRITICAL("No governor specified for host %s, falling back to Performance", - daemonProc->getHost()->getCname()); + daemonProc->getHost()->get_cname()); return std::unique_ptr( new simgrid::plugin::dvfs::Performance(daemonProc->getHost())); } diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index 2e16379893..d7cbb73d77 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -176,7 +176,7 @@ 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->getCname(), start_time, finish_time, host->pimpl_cpu->speed_.peak, previous_energy, + host->get_cname(), start_time, finish_time, host->pimpl_cpu->speed_.peak, previous_energy, energy_this_step); } @@ -193,7 +193,7 @@ HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host(ptr), last_updated(surf_g try { this->watts_off = std::stod(std::string(off_power_str)); } catch (std::invalid_argument& ia) { - throw std::invalid_argument(std::string("Invalid value for property watt_off of host ") + host->getCname() + + throw std::invalid_argument(std::string("Invalid value for property watt_off of host ") + host->get_cname() + ": " + off_power_str); } } @@ -204,13 +204,13 @@ 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->getCname()); + xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->get_cname()); 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->getCname()); + xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->get_cname()); return power_range_watts_list[pstate].max; } @@ -261,12 +261,9 @@ double HostEnergy::getCurrentWattsValue() */ double HostEnergy::getCurrentWattsValue(double cpu_load) { - xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->getCname()); + xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->get_cname()); - /* - * * Return watts_off if pstate == pstate_off - * * this happens when host is off - */ + /* Return watts_off if pstate == pstate_off (ie, if the host is off) */ if (this->pstate == pstate_off) { return watts_off; } @@ -328,7 +325,7 @@ void HostEnergy::initWattsRangeList() 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->getCname(), all_power_values_str, host->getCoreCount()); + XBT_DEBUG("%s: profile: %s, cores: %d", host->get_cname(), all_power_values_str, host->getCoreCount()); int i = 0; for (auto const& current_power_values_str : all_power_values) { @@ -339,7 +336,7 @@ void HostEnergy::initWattsRangeList() 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->getCname()); + host->get_cname()); if (current_power_values.size() == 2) { // In this case, 1core == AllCores current_power_values.push_back(current_power_values.at(1)); @@ -349,20 +346,20 @@ void HostEnergy::initWattsRangeList() "The energy profile of mono-cores should be formatted 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->getCname()); + host->get_cname()); } } 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->getCname()); + host->get_cname()); } /* 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->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()); + char* msg_idle = bprintf("Invalid idle value for pstate %d on host %s: %%s", i, host->get_cname()); + char* msg_min = bprintf("Invalid OneCore value for pstate %d on host %s: %%s", i, host->get_cname()); + char* msg_max = bprintf("Invalid AllCores value for pstate %d on host %s: %%s", i, host->get_cname()); 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)); @@ -426,7 +423,7 @@ static void onHostDestruction(simgrid::s4u::Host& host) if (dynamic_cast(&host)) // Ignore virtual machines return; - XBT_INFO("Energy consumption of host %s: %f Joules", host.getCname(), + XBT_INFO("Energy consumption of host %s: %f Joules", host.get_cname(), host.extension()->getConsumedEnergy()); } diff --git a/src/surf/plugins/link_energy.cpp b/src/surf/plugins/link_energy.cpp index 966da21260..0cd11d5e2c 100644 --- a/src/surf/plugins/link_energy.cpp +++ b/src/surf/plugins/link_energy.cpp @@ -105,12 +105,12 @@ void LinkEnergy::initWattsRangeList() boost::split(current_power_values, current_power_values_str, boost::is_any_of(":")); xbt_assert(current_power_values.size() == 2, "Power properties incorrectly defined - could not retrieve idle and busy power values for link %s", - this->link_->getCname()); + this->link_->get_cname()); /* min_power corresponds to the idle power (link load = 0) */ /* max_power is the power consumed at 100% link load */ - char* idleMsg = bprintf("Invalid idle power value for link%s", this->link_->getCname()); - char* busyMsg = bprintf("Invalid busy power value for %s", this->link_->getCname()); + char* idleMsg = bprintf("Invalid idle power value for link%s", this->link_->get_cname()); + char* busyMsg = bprintf("Invalid busy power value for %s", this->link_->get_cname()); idle_ = xbt_str_parse_double((current_power_values.at(0)).c_str(), idleMsg); busy_ = xbt_str_parse_double((current_power_values.at(1)).c_str(), busyMsg); @@ -155,7 +155,7 @@ static void onCommunicate(simgrid::surf::NetworkAction* action, simgrid::s4u::Ho if (link == nullptr) continue; - XBT_DEBUG("Update link %s", link->getCname()); + XBT_DEBUG("Update link %s", link->get_cname()); LinkEnergy* link_energy = link->piface_.extension(); link_energy->initWattsRangeList(); link_energy->update(); @@ -203,8 +203,8 @@ void sg_link_energy_plugin_init() }); simgrid::s4u::Link::onDestruction.connect([](simgrid::s4u::Link& link) { - if (strcmp(link.getCname(), "__loopback__")) - XBT_INFO("Energy consumption of link '%s': %f Joules", link.getCname(), + if (strcmp(link.get_cname(), "__loopback__")) + XBT_INFO("Energy consumption of link '%s': %f Joules", link.get_cname(), link.extension()->getConsumedEnergy()); }); diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index d0c47f5f20..0b04f618f4 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -172,7 +172,7 @@ L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* hos latency = std::max(latency, lat); for (auto const& link : route) - affected_links.insert(link->getCname()); + affected_links.insert(link->get_cname()); } } } @@ -309,7 +309,7 @@ bool LinkL07::is_used() void CpuL07::apply_event(tmgr_trace_event_t triggered, double value) { - XBT_DEBUG("Updating cpu %s (%p) with value %g", getCname(), this, value); + XBT_DEBUG("Updating cpu %s (%p) with value %g", get_cname(), this, value); if (triggered == speed_.event) { speed_.scale = value; onSpeedChange(); @@ -329,7 +329,7 @@ void CpuL07::apply_event(tmgr_trace_event_t triggered, double value) void LinkL07::apply_event(tmgr_trace_event_t triggered, double value) { - XBT_DEBUG("Updating link %s (%p) with value=%f", getCname(), this, value); + XBT_DEBUG("Updating link %s (%p) with value=%f", get_cname(), this, value); if (triggered == bandwidth_.event) { setBandwidth(value); tmgr_trace_event_unref(&bandwidth_.event); diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index dc6fee2084..f507c65872 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -296,10 +296,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->getCname()); + xbt_assert(nullptr == cluster->backbone_, "Cluster %s already has a backbone link!", cluster->get_cname()); cluster->backbone_ = bb; - XBT_DEBUG("Add a backbone to AS '%s'", current_routing->getCname()); + XBT_DEBUG("Add a backbone to AS '%s'", current_routing->get_cname()); } void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet) @@ -419,7 +419,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) std::vector list = simgrid::s4u::Engine::getInstance()->getAllHosts(); for (auto const& host : list) { - msg += host->getName(); + msg += host->get_name(); msg += "', '"; if (msg.length() > 1024) { msg.pop_back(); // remove trailing quote @@ -449,7 +449,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) arg = new simgrid::kernel::actor::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart); - XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->getCname(), start_time); + XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->get_cname(), 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.get(), nullptr); @@ -460,7 +460,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) delete arg; }); } else { // start_time <= SIMIX_get_clock() - XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->getCname()); + XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->get_cname()); smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), std::move(code), nullptr, host, arg->properties.get(), nullptr); @@ -657,7 +657,7 @@ void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* hostl if (as_cluster->private_links_.find(netpoint->id()) != as_cluster->private_links_.end()) surf_parse_error(std::string("Host_link for '") + hostlink->id.c_str() + "' is already defined!"); - XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->getCname(), netpoint->id()); + XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->get_cname(), netpoint->id()); as_cluster->private_links_.insert({netpoint->id(), {linkUp, linkDown}}); } diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 03b1cff407..897c3b7ab6 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -24,7 +24,7 @@ static void check_disk_attachment() for (auto const& s : simgrid::s4u::Engine::getInstance()->getAllStorages()) { simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(s->getImpl()->getHost().c_str()); if (not host_elm) - surf_parse_error(std::string("Unable to attach storage ") + s->getCname() + ": host " + + surf_parse_error(std::string("Unable to attach storage ") + s->get_cname() + ": host " + s->getImpl()->getHost().c_str() + " does not exist."); else s->attached_to_ = sg_host_by_name(s->getImpl()->getHost().c_str()); @@ -122,7 +122,7 @@ StorageN11Action::StorageN11Action(kernel::resource::Model* model, double cost, e_surf_action_storage_type_t type) : StorageAction(model, cost, failed, model->get_maxmin_system()->variable_new(this, 1.0, -1.0, 3), storage, type) { - XBT_IN("(%s,%g", storage->getCname(), cost); + XBT_IN("(%s,%g", storage->get_cname(), cost); // Must be less than the max bandwidth for all actions model->get_maxmin_system()->expand(storage->constraint(), get_variable(), 1.0); diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 06af81e3c0..9eab503eff 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -108,7 +108,7 @@ double surf_solve(double max_date) XBT_DEBUG("Updating models (min = %g, NOW = %g, next_event_date = %g)", time_delta, NOW, next_event_date); while ((event = future_evt_set->pop_leq(next_event_date, &value, &resource))) { - if (resource->is_used() || (watched_hosts.find(resource->getCname()) != watched_hosts.end())) { + if (resource->is_used() || (watched_hosts.find(resource->get_cname()) != watched_hosts.end())) { time_delta = next_event_date - NOW; XBT_DEBUG("This event invalidates the next_occuring_event() computation of models. Next event set to %f", time_delta); } @@ -117,7 +117,7 @@ double surf_solve(double max_date) NOW = next_event_date; /* update state of the corresponding resource to the new value. Does not touch lmm. It will be modified if needed when updating actions */ - XBT_DEBUG("Calling update_resource_state for resource %s", resource->getCname()); + XBT_DEBUG("Calling update_resource_state for resource %s", resource->get_cname()); resource->apply_event(event, value); NOW = round_start; } diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 73d9c14d91..602728d541 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -59,7 +59,7 @@ void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::stri std::vector 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->getName() < b->getName(); + return a->get_name() < b->get_name(); }); bool first = true; for (auto const& np : list) { @@ -69,7 +69,7 @@ void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::stri if (not first) msg += ","; first = false; - msg += "'" + np->getName() + "'"; + msg += "'" + np->get_name() + "'"; if (msg.length() > 4096) { msg.pop_back(); // remove trailing quote msg += "...(list truncated)......"; diff --git a/teshsuite/s4u/actor/actor.cpp b/teshsuite/s4u/actor/actor.cpp index c3be30e16c..de47145a5e 100644 --- a/teshsuite/s4u/actor/actor.cpp +++ b/teshsuite/s4u/actor/actor.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -26,7 +26,7 @@ static void master() simgrid::s4u::this_actor::getHost()->actorList(actor_list); for (auto const& actor : *actor_list) { - XBT_INFO("Actor (pid=%ld, ppid=%ld, name=%s)", actor->getPid(), actor->getPpid(), actor->getCname()); + XBT_INFO("Actor (pid=%ld, ppid=%ld, name=%s)", actor->getPid(), actor->getPpid(), actor->get_cname()); if (simgrid::s4u::this_actor::getPid() != actor->getPid()) actor->kill(); } diff --git a/teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp b/teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp index df7d015224..74768e4e86 100644 --- a/teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp +++ b/teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -17,7 +16,7 @@ static void vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst sg_vm_migrate(vm, dst_pm); double mig_end = simgrid::s4u::Engine::getClock(); - XBT_INFO("%s migrated: %s->%s in %g s", vm->getCname(), src_pm->getCname(), dst_pm->getCname(), mig_end - mig_sta); + XBT_INFO("%s migrated: %s->%s in %g s", vm->get_cname(), src_pm->get_cname(), dst_pm->get_cname(), mig_end - mig_sta); } static simgrid::s4u::ActorPtr vm_migrate_async(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm) @@ -34,16 +33,16 @@ static void master_main() vm0->setRamsize(1e9); // 1Gbytes vm0->start(); - XBT_INFO("Start the migration of %s from %s to %s", vm0->getCname(), pm0->getCname(), pm1->getCname()); + XBT_INFO("Start the migration of %s from %s to %s", vm0->get_cname(), pm0->get_cname(), pm1->get_cname()); vm_migrate_async(vm0, pm1); simgrid::s4u::this_actor::sleep_for(2); - XBT_INFO("Wait! change my mind, shutdown %s. This ends the migration", vm0->getCname()); + XBT_INFO("Wait! change my mind, shutdown %s. This ends the migration", vm0->get_cname()); vm0->shutdown(); simgrid::s4u::this_actor::sleep_for(8); - XBT_INFO("Start again the migration of %s from %s to %s", vm0->getCname(), pm0->getCname(), pm1->getCname()); + XBT_INFO("Start again the migration of %s from %s to %s", vm0->get_cname(), pm0->get_cname(), pm1->get_cname()); vm0->start(); vm_migrate_async(vm0, pm1); diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.cpp b/teshsuite/s4u/storage_client_server/storage_client_server.cpp index a524e29f4f..78e962a945 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.cpp +++ b/teshsuite/s4u/storage_client_server/storage_client_server.cpp @@ -15,7 +15,7 @@ static void display_storage_properties(simgrid::s4u::Storage* storage) { std::map* props = storage->getProperties(); if (not props->empty()) { - XBT_INFO("\tProperties of mounted storage: %s", storage->getCname()); + XBT_INFO("\tProperties of mounted storage: %s", storage->get_cname()); for (auto const& elm : *props) { XBT_INFO(" %s->%s", elm.first.c_str(), elm.second.c_str()); @@ -30,7 +30,7 @@ static sg_size_t write_local_file(const std::string& dest, sg_size_t file_size) simgrid::s4u::File 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()->getCname()); + simgrid::s4u::Actor::self()->get_cname()); return written; } @@ -39,7 +39,7 @@ static sg_size_t read_local_file(const std::string& src) simgrid::s4u::File file(src, nullptr); 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()->getCname(), read, src.c_str()); + XBT_INFO("%s has read %llu on %s", simgrid::s4u::Actor::self()->get_cname(), read, src.c_str()); return read; } @@ -50,7 +50,7 @@ static void hsm_put(const std::string& remote_host, const std::string& src, cons sg_size_t read_size = read_local_file(src); // Send file - XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::getCname(), read_size, remote_host.c_str()); + XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::get_cname(), read_size, remote_host.c_str()); std::string* payload = new std::string(simgrid::xbt::string_printf("%s %llu", dest.c_str(), read_size)); simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(remote_host); mailbox->put(payload, static_cast(read_size)); @@ -59,7 +59,7 @@ static void hsm_put(const std::string& remote_host, const std::string& src, cons static void display_storage_content(simgrid::s4u::Storage* storage) { - XBT_INFO("Print the content of the storage element: %s", storage->getCname()); + XBT_INFO("Print the content of the storage element: %s", storage->get_cname()); std::map* content = storage->extension()->getContent(); if (not content->empty()) { for (auto const& entry : *content) @@ -94,25 +94,25 @@ static void dump_platform_storages() std::vector storages = simgrid::s4u::Engine::getInstance()->getAllStorages(); for (auto const& s : storages) { - XBT_INFO("Storage %s is attached to %s", s->getCname(), s->getHost()->getCname()); + XBT_INFO("Storage %s is attached to %s", s->get_cname(), s->getHost()->get_cname()); s->setProperty("other usage", "gpfs"); } } static void storage_info(simgrid::s4u::Host* host) { - XBT_INFO("*** Storage info on %s ***", host->getCname()); + XBT_INFO("*** Storage info on %s ***", host->get_cname()); for (auto const& elm : host->getMountedStorages()) { const std::string& mount_name = elm.first; simgrid::s4u::Storage* storage = elm.second; - XBT_INFO("\tStorage name: %s, mount name: %s", storage->getCname(), mount_name.c_str()); + XBT_INFO("\tStorage name: %s, mount name: %s", storage->get_cname(), mount_name.c_str()); XBT_INFO("\t\tFree size: %llu bytes", sg_storage_get_size_free(storage)); XBT_INFO("\t\tUsed size: %llu bytes", sg_storage_get_size_used(storage)); display_storage_properties(storage); - dump_storage_by_name(storage->getCname()); + dump_storage_by_name(storage->get_cname()); } } @@ -131,7 +131,7 @@ static void client() static void server() { storage_info(simgrid::s4u::this_actor::getHost()); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getCname()); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->get_cname()); XBT_INFO("Server waiting for transfers ..."); while (1) { diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index 21b2947737..53e0efdd64 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -54,7 +54,7 @@ static void dump_hosts() [](sg_host_t a, sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; }); for (unsigned int i = 0; i < totalHosts; i++) { - std::printf(" getCname(), sg_host_speed(hosts[i])); + std::printf(" get_cname(), sg_host_speed(hosts[i])); props = hosts[i]->getProperties(); if (hosts[i]->getCoreCount() > 1) { std::printf(" core=\"%d\"", hosts[i]->getCoreCount()); @@ -84,7 +84,7 @@ static void dump_links() simgrid::s4u::Link* link = links[i]; std::printf(" getCname(), link->bandwidth(), link->latency()); + std::printf("%s\" bandwidth=\"%.0f\" latency=\"%.9f\"", link->get_cname(), link->bandwidth(), link->latency()); if (sg_link_is_shared(link)) { std::printf("/>\n"); } else { @@ -101,12 +101,12 @@ static void dump_routers() simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList); std::sort(netcardList.begin(), netcardList.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { - return a->getName() < b->getName(); + return a->get_name() < b->get_name(); }); for (auto const& srcCard : netcardList) if (srcCard->isRouter()) - std::printf(" \n", srcCard->getCname()); + std::printf(" \n", srcCard->get_cname()); } static void dump_routes() @@ -119,7 +119,7 @@ static void dump_routes() simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList); std::sort(netcardList.begin(), netcardList.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { - return a->getName() < b->getName(); + return a->get_name() < b->get_name(); }); for (unsigned int it_src = 0; it_src < totalHosts; it_src++) { // Routes from host @@ -131,20 +131,20 @@ static void dump_routes() 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->getCname(), host2->getCname()); + std::printf(" \n ", host1->get_cname(), host2->get_cname()); for (auto const& link : route) - std::printf("", link->getCname()); + std::printf("", link->get_cname()); std::printf("\n \n"); } } for (auto const& netcardDst : netcardList) { // to router if (netcardDst->isRouter()) { - std::printf(" \n ", host1->getCname(), netcardDst->getCname()); + std::printf(" \n ", host1->get_cname(), netcardDst->get_cname()); std::vector route; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, route, nullptr); for (auto const& link : route) - std::printf("", link->getCname()); + std::printf("", link->get_cname()); std::printf("\n \n"); } } @@ -154,22 +154,22 @@ static void dump_routes() if (value1->isRouter()) { for (auto const& value2 : netcardList) { // to router if (value2->isRouter()) { - std::printf(" \n ", value1->getCname(), value2->getCname()); + std::printf(" \n ", value1->get_cname(), value2->get_cname()); std::vector route; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, route, nullptr); for (auto const& link : route) - std::printf("", link->getCname()); + std::printf("", link->get_cname()); std::printf("\n \n"); } } 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->getCname(), host2->getCname()); + std::printf(" \n ", value1->get_cname(), host2->get_cname()); std::vector route; simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, route, nullptr); for (auto const& link : route) - std::printf("", link->getCname()); + std::printf("", link->get_cname()); std::printf("\n \n"); } } diff --git a/teshsuite/simdag/is-router/is-router.cpp b/teshsuite/simdag/is-router/is-router.cpp index 544228670b..9091552837 100644 --- a/teshsuite/simdag/is-router/is-router.cpp +++ b/teshsuite/simdag/is-router/is-router.cpp @@ -23,7 +23,7 @@ int main(int argc, char **argv) simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList); std::sort(netcardList.begin(), netcardList.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { - return a->getName() < b->getName(); + return a->get_name() < b->get_name(); }); int it; @@ -37,13 +37,13 @@ int main(int argc, char **argv) type = "netzone"; if (nc->isHost()) type = "host"; - std::printf(" - Seen: \"%s\". Type: %s\n", host->getCname(), type); + std::printf(" - Seen: \"%s\". Type: %s\n", host->get_cname(), type); } xbt_dynar_free(&hosts); std::printf("NetCards count: %zu\n", netcardList.size()); for (auto const& nc : netcardList) - std::printf(" - Seen: \"%s\". Type: %s\n", nc->getCname(), + std::printf(" - Seen: \"%s\". Type: %s\n", nc->get_cname(), nc->isRouter() ? "router" : (nc->isNetZone() ? "netzone" : (nc->isHost() ? "host" : "buggy"))); return 0;