double clock = simgrid::s4u::Engine::getClock();
simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getName() + "_" + action[2]);
ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME, size,
- simgrid::s4u::this_actor::getName().c_str(), to->getName());
+ simgrid::s4u::this_actor::getCname(), to->getName());
to->put(payload, size);
delete payload;
simgrid::s4u::MailboxPtr from =
simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::getName());
- ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME, simgrid::s4u::this_actor::getName().c_str(),
- from->getName());
+ ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME, simgrid::s4u::this_actor::getCname(), from->getName());
from->get();
log_action(action, simgrid::s4u::Engine::getClock() - clock);
}
/** This actor will be automatically terminated when the last non-daemon process finishes **/
void daemonize();
- /** Retrieves the name of that actor as a C string */
- const char* getCname();
/** Retrieves the name of that actor as a C++ string */
- simgrid::xbt::string getName();
+ const simgrid::xbt::string& getName() const;
+ /** Retrieves the name of that actor as a C string */
+ const char* getCname() const;
/** Retrieves the host on which that actor is running */
s4u::Host* getHost();
/** Retrieves the PID of that actor
/** @brief Returns the name of the current actor. */
XBT_PUBLIC(std::string) getName();
+/** @brief Returns the name of the current actor as a C string. */
+XBT_PUBLIC(const char*) getCname();
+
/** @brief Returns the name of the host on which the process is running. */
XBT_PUBLIC(Host*) getHost();
simgrid::simix::kernelImmediate([this]() { pimpl_->daemonize(); });
}
-const char* Actor::getCname()
+const simgrid::xbt::string& Actor::getName() const
{
- return this->pimpl_->name.c_str();
+ return this->pimpl_->getName();
}
-simgrid::xbt::string Actor::getName()
+const char* Actor::getCname() const
{
- return this->pimpl_->name;
+ return this->pimpl_->getCname();
}
aid_t Actor::getPid()
std::string getName()
{
- return SIMIX_process_self()->name;
+ return SIMIX_process_self()->getName();
+}
+
+const char* getCname()
+{
+ return SIMIX_process_self()->getCname();
}
Host* getHost()
simgrid::s4u::this_actor::getHost()->actorList(actor_list);
for (auto const& actor : *actor_list) {
- XBT_INFO("Actor (pid=%lu, ppid=%lu, name=%s)", actor->getPid(), actor->getPpid(), actor->getName().c_str());
+ XBT_INFO("Actor (pid=%lu, ppid=%lu, name=%s)", actor->getPid(), actor->getPpid(), actor->getCname());
if (simgrid::s4u::this_actor::getPid() != actor->getPid())
actor->kill();
}
simgrid::s4u::File* file = new simgrid::s4u::File(dest, nullptr);
sg_size_t written = file->write(file_size);
XBT_INFO("%llu bytes on %llu bytes have been written by %s on /sd1", written, file_size,
- simgrid::s4u::Actor::self()->getName().c_str());
+ simgrid::s4u::Actor::self()->getCname());
delete file;
return written;
}
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()->getName().c_str(), read, src);
+ XBT_INFO("%s has read %llu on %s", simgrid::s4u::Actor::self()->getCname(), read, src);
delete file;
return read;
sg_size_t read_size = read_local_file(src);
// Send file
- XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::getName().c_str(), read_size, remote_host);
+ XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::getCname(), read_size, remote_host);
char* payload = bprintf("%s %llu", dest, read_size);
simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(remote_host);
mailbox->put(payload, static_cast<double>(read_size));