double size = std::stod(action[3]);
char* payload = xbt_strdup(action[3]);
double clock = simgrid::s4u::Engine::getClock();
- simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::name() + "_" + action[2]);
+ simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getName() + "_" + action[2]);
ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME, size,
- simgrid::s4u::this_actor::name().c_str(), to->name());
+ simgrid::s4u::this_actor::getName().c_str(), to->getName());
to->put(payload, size);
xbt_free(payload);
{
double clock = simgrid::s4u::Engine::getClock();
simgrid::s4u::MailboxPtr from =
- simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::name());
+ simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::getName());
- ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME, simgrid::s4u::this_actor::name().c_str(), from->name());
+ ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME, simgrid::s4u::this_actor::getName().c_str(),
+ from->getName());
from->get();
log_action(action, simgrid::s4u::Engine::getClock() - clock);
}
static simgrid::s4u::File* get_file_descriptor(const char* file_name)
{
- std::string full_name = simgrid::s4u::this_actor::name() + ":" + file_name;
+ std::string full_name = simgrid::s4u::this_actor::getName() + ":" + file_name;
return opened_files.at(full_name);
}
{
const char* file_name = action[2];
double clock = simgrid::s4u::Engine::getClock();
- std::string full_name = simgrid::s4u::this_actor::name() + ":" + file_name;
+ std::string full_name = simgrid::s4u::this_actor::getName() + ":" + file_name;
ACT_DEBUG("Entering Open: %s (filename: %s)", NAME, file_name);
simgrid::s4u::File* file = new simgrid::s4u::File(file_name, NULL);
}
void operator()()
{
- XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->name());
+ XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->getName());
char* msg1 = static_cast<char*>(mailbox->get());
char* msg2 = static_cast<char*>(mailbox->get());
simgrid::s4u::this_actor::suspend();
- XBT_INFO("I've been moved on this new host: %s", simgrid::s4u::this_actor::host()->cname());
+ XBT_INFO("I've been moved on this new host: %s", simgrid::s4u::this_actor::getHost()->getCname());
XBT_INFO("Uh, nothing to do here. Stopping now");
}
static void dream_master()
{
XBT_INFO("Let's create a lazy guy."); /* - Create a lazy_guy process */
- simgrid::s4u::ActorPtr lazy = simgrid::s4u::Actor::createActor("Lazy", simgrid::s4u::this_actor::host(), lazy_guy);
+ simgrid::s4u::ActorPtr lazy = simgrid::s4u::Actor::createActor("Lazy", simgrid::s4u::this_actor::getHost(), lazy_guy);
XBT_INFO("Let's wait a little bit...");
simgrid::s4u::this_actor::sleep_for(10); /* - Wait for 10 seconds */
XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!");
e->loadPlatform(argv[1]); /* - Load the platform description */
std::vector<simgrid::s4u::Host*> list;
- e->hostList(&list);
+ e->getHostList(&list);
simgrid::s4u::Actor::createActor("dream_master", list.front(), dream_master);
e->run(); /* - Run the simulation */
if (number_of_tasks < 10000 || i % 10000 == 0)
XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", (std::string("Task_") + std::to_string(i)).c_str(),
- number_of_tasks, mailbox->name());
+ number_of_tasks, mailbox->getName());
/* - Send the task to the @ref worker */
char* payload = bprintf("%f", comp_size);
void operator()()
{
- rank = xbt_str_parse_int(simgrid::s4u::this_actor::name().c_str(),
+ rank = xbt_str_parse_int(simgrid::s4u::this_actor::getName().c_str(),
"Any process of this example must have a numerical name, not %s");
my_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(rank));
- if (rank + 1 == simgrid::s4u::Engine::instance()->hostCount())
+ if (rank + 1 == simgrid::s4u::Engine::getInstance()->getHostCount())
/* The last process, which sends the token back to rank 0 */
neighbor_mailbox = simgrid::s4u::Mailbox::byName("0");
else
if (rank == 0) {
/* The root process (rank 0) first sends the token then waits to receive it back */
- XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->name());
+ XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->getName());
neighbor_mailbox->put(xbt_strdup("Token"), task_comm_size);
char* res = static_cast<char*>(my_mailbox->get());
XBT_INFO("Host \"%u\" received \"%s\"", rank, res);
} else {
char* res = static_cast<char*>(my_mailbox->get());
XBT_INFO("Host \"%u\" received \"%s\"", rank, res);
- XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->name());
+ XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->getName());
neighbor_mailbox->put(res, task_comm_size);
}
}
xbt_assert(argc > 1, "Usage: %s platform.xml\n", argv[0]);
e->loadPlatform(argv[1]);
- XBT_INFO("Number of hosts '%zu'", e->hostCount());
+ XBT_INFO("Number of hosts '%zu'", e->getHostCount());
int id = 0;
std::vector<simgrid::s4u::Host*> list;
- e->hostList(&list);
+ e->getHostList(&list);
for (auto host : list) {
/* - Give a unique rank to each host and create a @ref relay_runner process on each */
simgrid::s4u::Actor::createActor((std::to_string(id)).c_str(), host, RelayRunner());
// initialize my node
id_ = std::stoi(args[1]);
- stream = simgrid::s4u::this_actor::host()->extension<HostChord>()->getStream();
+ stream = simgrid::s4u::this_actor::getHost()->extension<HostChord>()->getStream();
mailbox_ = simgrid::s4u::Mailbox::byName(std::to_string(id_));
next_finger_to_fix = 0;
fingers_ = new int[nb_bits];
}
// receive the answer
XBT_DEBUG("Sent 'Predecessor Alive' request to %d, waiting for the answer on my mailbox '%s'", pred_id_,
- message->answer_to->name());
+ message->answer_to->getName());
simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data);
try {
// receive the answer
XBT_DEBUG("Sent 'Get Predecessor' request to %d, waiting for the answer on my mailbox '%s'", ask_to,
- message->answer_to->name());
+ message->answer_to->getName());
simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data);
try {
message->type = FIND_SUCCESSOR_ANSWER;
message->answer_id = fingers_[0];
XBT_DEBUG("Sending back a 'Find Successor Answer' to %s (mailbox %s): the successor of %d is %d",
- message->issuer_host_name.c_str(), message->answer_to->name(), message->request_id, message->answer_id);
+ message->issuer_host_name.c_str(), message->answer_to->getName(), message->request_id,
+ message->answer_id);
message->answer_to->put_init(message, 10)->detach();
} else {
// otherwise, forward the request to the closest preceding finger in my table
message->type = GET_PREDECESSOR_ANSWER;
message->answer_id = pred_id_;
XBT_DEBUG("Sending back a 'Get Predecessor Answer' to %s via mailbox '%s': my predecessor is %d",
- message->issuer_host_name.c_str(), message->answer_to->name(), message->answer_id);
+ message->issuer_host_name.c_str(), message->answer_to->getName(), message->answer_id);
message->answer_to->put_init(message, 10)->detach();
break;
case PREDECESSOR_ALIVE:
XBT_DEBUG("Receiving a 'Predecessor Alive' request from %s", message->issuer_host_name.c_str());
message->type = PREDECESSOR_ALIVE_ANSWER;
- XBT_DEBUG("Sending back a 'Predecessor Alive Answer' to %s (mailbox %s)",
- message->issuer_host_name.c_str(), message->answer_to->name());
+ XBT_DEBUG("Sending back a 'Predecessor Alive Answer' to %s (mailbox %s)", message->issuer_host_name.c_str(),
+ message->answer_to->getName());
message->answer_to->put_init(message, 10)->detach();
break;
HostChord::EXTENSION_ID = simgrid::s4u::Host::extension_create<HostChord>();
std::vector<simgrid::s4u::Host*> list;
- simgrid::s4u::Engine::instance()->hostList(&list);
+ simgrid::s4u::Engine::getInstance()->getHostList(&list);
for (auto host : list)
host->extension_set(new HostChord(host));
}
explicit HostChord(simgrid::s4u::Host* ptr) : host(ptr)
{
- std::string descr = std::string("RngSream<") + host->cname() + ">";
+ std::string descr = std::string("RngSream<") + host->getCname() + ">";
stream_ = RngStream_CreateStream(descr.c_str());
}
int answer_id = -1; // answer (used by some types of messages)
simgrid::s4u::MailboxPtr answer_to; // mailbox to send an answer to (if any)
- explicit ChordMessage(e_message_type_t type) : type(type), issuer_host_name(simgrid::s4u::this_actor::host()->name())
+ explicit ChordMessage(e_message_type_t type)
+ : type(type), issuer_host_name(simgrid::s4u::this_actor::getHost()->getName())
{
}
public:
void show_info(std::unordered_map<std::string, simgrid::s4u::Storage*> const& mounts)
{
- XBT_INFO("Storage info on %s:", simgrid::s4u::Host::current()->cname());
+ XBT_INFO("Storage info on %s:", simgrid::s4u::Host::current()->getCname());
for (const auto&kv : mounts) {
const char* mountpoint = kv.first.c_str();
simgrid::s4u::Storage* storage = kv.second;
// Retrieve disk's information
- sg_size_t free_size = storage->sizeFree();
- sg_size_t used_size = storage->sizeUsed();
- sg_size_t size = storage->size();
+ sg_size_t free_size = storage->getSizeFree();
+ sg_size_t used_size = storage->getSizeUsed();
+ sg_size_t size = storage->getSize();
- XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", storage->name(), mountpoint, used_size, free_size,
+ XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", storage->getName(), mountpoint, used_size, free_size,
size);
}
}
void operator()() {
std::unordered_map<std::string, simgrid::s4u::Storage*> const& mounts =
- simgrid::s4u::Host::current()->mountedStorages();
+ simgrid::s4u::Host::current()->getMountedStorages();
show_info(mounts);
// Now rename file from ./tmp/data.txt to ./tmp/simgrid.readme
const char *newpath = "/home/tmp/simgrid.readme";
- XBT_INFO("Move '%s' to '%s'", file->path(), newpath);
+ XBT_INFO("Move '%s' to '%s'", file->getPath(), newpath);
file->move(newpath);
// Test attaching some user data to the file
file->setUserdata(xbt_strdup("777"));
- XBT_INFO("User data attached to the file: %s", (char*)file->userdata());
- xbt_free(file->userdata());
+ XBT_INFO("User data attached to the file: %s", (char*)file->getUserdata());
+ xbt_free(file->getUserdata());
// Close the file
delete file;
// Now attach some user data to disk1
- XBT_INFO("Get/set data for storage element: %s", storage->name());
- XBT_INFO(" Uninitialized storage data: '%s'", (char*)storage->userdata());
+ XBT_INFO("Get/set data for storage element: %s", storage->getName());
+ XBT_INFO(" Uninitialized storage data: '%s'", (char*)storage->getUserdata());
storage->setUserdata(xbt_strdup("Some user data"));
- XBT_INFO(" Set and get data: '%s'", (char*)storage->userdata());
+ XBT_INFO(" Set and get data: '%s'", (char*)storage->getUserdata());
- xbt_free(storage->userdata());
+ xbt_free(storage->getUserdata());
}
};
double comp_amount2 = 1000000;
double comm_amount12 = 2000000;
double comm_amount21 = 3000000;
- XBT_INFO("Computation time for %f flops on %s: %f", comp_amount1, h1->cname(), comp_amount1/h1->speed());
- XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, h2->cname(), comp_amount2/h2->speed());
+ XBT_INFO("Computation time for %f flops on %s: %f", comp_amount1, h1->getCname(), comp_amount1 / h1->getSpeed());
+ XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, h2->getCname(), comp_amount2 / h2->getSpeed());
- XBT_INFO("Route between %s and %s:", h1->cname(), h2->cname());
+ XBT_INFO("Route between %s and %s:", h1->getCname(), h2->getCname());
std::vector<sg_link_t> route;
double latency = 0;
h1->routeTo(h2, &route, &latency);
sg_link_bandwidth(link));
XBT_INFO("Route latency = %f, route bandwidth = %f", latency, sg_host_route_bandwidth(h1, h2));
- XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount12, h1->cname(), h2->cname(),
- sg_host_route_latency(h1, h2) + comm_amount12 / sg_host_route_bandwidth(h1, h2));
- XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount21, h2->cname(), h1->cname(),
- sg_host_route_latency(h2, h1) + comm_amount21 / sg_host_route_bandwidth(h2, h1));
+ XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount12, h1->getCname(), h2->getCname(),
+ sg_host_route_latency(h1, h2) + comm_amount12 / sg_host_route_bandwidth(h1, h2));
+ XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount21, h2->getCname(), h1->getCname(),
+ sg_host_route_latency(h2, h1) + comm_amount21 / sg_host_route_bandwidth(h2, h1));
/* creation of the tasks and their dependencies */
SD_task_t taskA = SD_task_create("Task A", NULL, 10.0);
void daemonize();
/** Retrieves the name of that actor as a C string */
- const char* cname();
+ const char* getCname();
/** Retrieves the name of that actor as a C++ string */
- simgrid::xbt::string name();
+ simgrid::xbt::string getName();
/** Retrieves the host on which that actor is running */
- s4u::Host* host();
+ s4u::Host* getHost();
/** Retrieves the PID of that actor
*
* actor_id_t is an alias for unsigned long */
- aid_t pid();
+ aid_t getPid();
/** Retrieves the PPID of that actor
*
* actor_id_t is an alias for unsigned long */
- aid_t ppid();
+ aid_t getPpid();
/** Suspend an actor by suspending the task on which it was waiting for the completion. */
void suspend();
/** Sets the time at which that actor should be killed */
void setKillTime(double time);
/** Retrieves the time at which that actor will be killed (or -1 if not set) */
- double killTime();
+ double getKillTime();
void migrate(Host * new_host);
simix::ActorImpl* getImpl();
/** Retrieve the property value (or nullptr if not set) */
- const char* property(const char* key);
+ const char* getProperty(const char* key);
void setProperty(const char* key, const char* value);
};
XBT_ATTRIB_DEPRECATED("Please use Mailbox::put_async") isend(MailboxPtr chan, void* payload, double simulatedSize);
/** @brief Returns the actor ID of the current actor (same as pid). */
- XBT_PUBLIC(aid_t) pid();
+ XBT_PUBLIC(aid_t) getPid();
/** @brief Returns the ancestor's actor ID of the current actor (same as ppid). */
- XBT_PUBLIC(aid_t) ppid();
+ XBT_PUBLIC(aid_t) getPpid();
/** @brief Returns the name of the current actor. */
- XBT_PUBLIC(std::string) name();
+ XBT_PUBLIC(std::string) getName();
/** @brief Returns the name of the host on which the process is running. */
- XBT_PUBLIC(Host*) host();
+ XBT_PUBLIC(Host*) getHost();
/** @brief Suspend the actor. */
XBT_PUBLIC(void) suspend();
void cancel();
/** Retrieve the mailbox on which this comm acts */
- MailboxPtr mailbox();
+ MailboxPtr getMailbox();
private:
double rate_ = -1;
/** @brief Load a deployment file and launch the actors that it contains */
void loadDeployment(const char* deploy);
- size_t hostCount();
- void hostList(std::vector<Host*> * whereTo);
+ size_t getHostCount();
+ void getHostList(std::vector<Host*> * whereTo);
/** @brief Run the simulation */
void run();
static double getClock();
/** @brief Retrieve the engine singleton */
- static s4u::Engine* instance();
+ static s4u::Engine* getInstance();
/** @brief Retrieve the root netzone, containing all others */
- simgrid::s4u::NetZone* netRoot();
+ simgrid::s4u::NetZone* getNetRoot();
/** @brief Retrieve the netzone of the given name (or nullptr if not found) */
- simgrid::s4u::NetZone* netzoneByNameOrNull(const char* name);
+ simgrid::s4u::NetZone* getNetzoneByNameOrNull(const char* name);
/** @brief Retrieve the netcard of the given name (or nullptr if not found) */
- simgrid::kernel::routing::NetPoint* netpointByNameOrNull(const char* name);
- void netpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
+ simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(const char* name);
+ void getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
void netpointRegister(simgrid::kernel::routing::NetPoint * card);
void netpointUnregister(simgrid::kernel::routing::NetPoint * card);
~File();
/** Retrieves the path to the file */
- const char* path() { return path_; }
+ const char* getPath() { return path_; }
/** Simulates a read action. Returns the size of data actually read
*
/** Allows to store user data on that host */
void setUserdata(void* data) { userdata_ = data; }
/** Retrieves the previously stored data */
- void* userdata() { return userdata_; }
+ void* getUserdata() { return userdata_; }
/** Retrieve the datasize */
sg_size_t size();
/** Retrieves the host on which the current actor is running */
static s4u::Host* current();
- simgrid::xbt::string const& name() const { return name_; }
- const char* cname() { return name_.c_str(); }
+ simgrid::xbt::string const& getName() const { return name_; }
+ const char* getCname() { return name_.c_str(); }
void actorList(std::vector<ActorPtr> * whereto);
/** Returns if that host is currently down and offline */
bool isOff() { return not isOn(); }
- double speed();
- int coreCount();
- xbt_dict_t properties();
- const char* property(const char* key);
+ double getSpeed();
+ int getCoreCount();
+ xbt_dict_t getProperties();
+ const char* getProperty(const char* key);
void setProperty(const char* key, const char* value);
- void processes(std::vector<ActorPtr> * list);
+ void getProcesses(std::vector<ActorPtr> * list);
double getPstateSpeed(int pstate_index);
- int pstatesCount() const;
+ int getPstatesCount() const;
void setPstate(int pstate_index);
- int pstate();
- void attachedStorages(std::vector<const char*> * storages);
+ int getPstate();
+ void getAttachedStorages(std::vector<const char*> * storages);
/** Get an associative list [mount point]->[Storage] of all local mount points.
*
* This is defined in the platform file, and cannot be modified programatically (yet).
*/
- std::unordered_map<std::string, Storage*> const& mountedStorages();
+ std::unordered_map<std::string, Storage*> const& getMountedStorages();
void routeTo(Host * dest, std::vector<Link*> * links, double* latency);
void routeTo(Host * dest, std::vector<surf::LinkImpl*> * links, double* latency);
kernel::activity::MailboxImpl* getImpl() { return pimpl_; }
/** Gets the name of that mailbox */
- const char *name();
+ const char* getName();
/** Retrieve the mailbox associated to the given C string */
static MailboxPtr byName(const char *name);
void setReceiver(ActorPtr actor);
/** Return the actor declared as permanent receiver, or nullptr if none **/
- ActorPtr receiver();
+ ActorPtr getReceiver();
/** Creates (but don't start) an emission to that mailbox */
CommPtr put_init();
public:
/** @brief Seal your netzone once you're done adding content, and before routing stuff through it */
virtual void seal();
- char* name();
- NetZone* father();
+ char* getCname();
+ NetZone* getFather();
- std::vector<NetZone*>* children(); // Sub netzones
- void hosts(std::vector<s4u::Host*> * whereto); // retrieve my content as a vector of hosts
+ std::vector<NetZone*>* getChildren(); // Sub netzones
+ void getHosts(std::vector<s4u::Host*> * whereto); // retrieve my content as a vector of hosts
/** Get the properties assigned to a host */
- std::unordered_map<std::string, std::string>* properties();
+ std::unordered_map<std::string, std::string>* getProperties();
/** Retrieve the property value (or nullptr if not set) */
- const char* property(const char* key);
+ const char* getProperty(const char* key);
void setProperty(const char* key, const char* value);
/* Add content to the netzone, at parsing time. It should be sealed afterward. */
virtual ~Storage() = default;
/** Retrieve a Storage by its name. It must exist in the platform file */
static Storage* byName(const char* name);
- const char* name();
- const char* type();
- Host* host();
- sg_size_t sizeFree();
- sg_size_t sizeUsed();
+ const char* getName();
+ const char* getType();
+ Host* getHost();
+ sg_size_t getSizeFree();
+ sg_size_t getSizeUsed();
/** Retrieve the total amount of space of this storage element */
- sg_size_t size();
+ sg_size_t getSize();
- xbt_dict_t properties();
- const char* property(const char* key);
+ xbt_dict_t getProperties();
+ const char* getProperty(const char* key);
void setProperty(const char* key, char* value);
- std::map<std::string, sg_size_t>* content();
+ std::map<std::string, sg_size_t>* getContent();
void setUserdata(void* data) { userdata_ = data; }
- void* userdata() { return userdata_; }
+ void* getUserdata() { return userdata_; }
/* The signals */
/** @brief Callback signal fired when a new Link is created */
public:
bool isMigrating();
- void parameters(vm_params_t params);
+ void getParameters(vm_params_t params);
void setParameters(vm_params_t params);
double getRamsize();
- simgrid::s4u::Host* pm();
+ simgrid::s4u::Host* getPm();
e_surf_vm_state_t getState();
for (int i = 1; i < argc; i++)
env->SetObjectArrayElement(args,i - 1, env->NewStringUTF(argv[i]));
//Retrieve the host for the process.
- jstring jhostName = env->NewStringUTF(MSG_host_self()->cname());
+ jstring jhostName = env->NewStringUTF(MSG_host_self()->getCname());
jobject jhost = Java_org_simgrid_msg_Host_getByName(env, nullptr, jhostName);
//creates the process
jobject jprocess = env->NewObject(class_Process, constructor_Process, jhost, jname, args);
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject jas) {
simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
- return env->NewStringUTF(as->name());
+ return env->NewStringUTF(as->getCname());
}
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, jobject jas) {
if (not cls)
return nullptr;
- jtable = env->NewObjectArray(static_cast<jsize>(self_as->children()->size()), cls, nullptr);
+ jtable = env->NewObjectArray(static_cast<jsize>(self_as->getChildren()->size()), cls, nullptr);
if (not jtable) {
jxbt_throw_jni(env, "Hosts table allocation failed");
return nullptr;
}
- for (auto tmp_as : *self_as->children()) {
+ for (auto tmp_as : *self_as->getChildren()) {
jobject tmp_jas = jnetzone_new_instance(env);
if (not tmp_jas) {
jxbt_throw_jni(env, "java As instantiation failed");
return nullptr;
std::vector<sg_host_t> table;
- as->hosts(&table);
+ as->getHosts(&table);
jtable = env->NewObjectArray(static_cast<jsize>(table.size()), cls, nullptr);
for (auto host : table) {
jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
if (not jhost) {
- jname = env->NewStringUTF(host->cname());
+ jname = env->NewStringUTF(host->getCname());
jhost = Java_org_simgrid_msg_Host_getByName(env, cls, jname);
- env->ReleaseStringUTFChars(static_cast<jstring>(jname), host->cname());
+ env->ReleaseStringUTFChars(static_cast<jstring>(jname), host->getCname());
}
env->SetObjectArrayElement(jtable, index, jhost);
return nullptr;
}
/* Sets the host name */
- jobject jname = env->NewStringUTF(host->cname());
+ jobject jname = env->NewStringUTF(host->getCname());
env->SetObjectField(jhost, jhost_field_Host_name, jname);
/* Bind & store it */
jhost_bind(jhost, host, env);
jobject jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
if (not jhost) {
- jstring jname = env->NewStringUTF(host->cname());
+ jstring jname = env->NewStringUTF(host->getCname());
jhost = Java_org_simgrid_msg_Host_getByName(env, cls_arg, jname);
}
static int l_host_get_name(lua_State * L)
{
sg_host_t ht = sglua_check_host(L, 1);
- lua_pushstring(L, ht->cname());
+ lua_pushstring(L, ht->getCname());
return 1;
}
xbt_assert(newContainer->netpoint, "Element '%s' not found", name);
break;
case INSTR_ROUTER:
- newContainer->netpoint = simgrid::s4u::Engine::instance()->netpointByNameOrNull(name);
+ newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
xbt_assert(newContainer->netpoint, "Element '%s' not found", name);
break;
case INSTR_AS:
- newContainer->netpoint = simgrid::s4u::Engine::instance()->netpointByNameOrNull(name);
+ newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
xbt_assert(newContainer->netpoint, "Element '%s' not found", name);
break;
default:
{
if (netzone_p != nullptr)
id_ = netzone_p->addComponent(this);
- simgrid::s4u::Engine::instance()->netpointRegister(this);
+ simgrid::s4u::Engine::getInstance()->netpointRegister(this);
simgrid::kernel::routing::NetPoint::onCreation(this);
}
}
*/
simgrid::kernel::routing::NetPoint* sg_netpoint_by_name_or_null(const char* name)
{
- return simgrid::s4u::Engine::instance()->netpointByNameOrNull(name);
+ return simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
}
NetZoneImpl::NetZoneImpl(NetZone* father, const char* name) : NetZone(father, name)
{
- xbt_assert(nullptr == simgrid::s4u::Engine::instance()->netpointByNameOrNull(name),
+ xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name),
"Refusing to create a second NetZone called '%s'.", name);
netpoint_ = new NetPoint(name, NetPoint::Type::NetZone, static_cast<NetZoneImpl*>(father));
for (auto& kv : bypassRoutes_)
delete kv.second;
- simgrid::s4u::Engine::instance()->netpointUnregister(netpoint_);
+ simgrid::s4u::Engine::getInstance()->netpointUnregister(netpoint_);
}
simgrid::s4u::Host* NetZoneImpl::createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount,
NetZoneImpl* current = src->netzone();
while (current != nullptr) {
path_src.push_back(current);
- current = static_cast<NetZoneImpl*>(current->father());
+ current = static_cast<NetZoneImpl*>(current->getFather());
}
std::vector<NetZoneImpl*> path_dst;
current = dst->netzone();
while (current != nullptr) {
path_dst.push_back(current);
- current = static_cast<NetZoneImpl*>(current->father());
+ current = static_cast<NetZoneImpl*>(current->getFather());
}
/* (3) find the common father.
NetZoneImpl *src_ancestor;
NetZoneImpl *dst_ancestor;
find_common_ancestors(src, dst, &common_ancestor, &src_ancestor, &dst_ancestor);
- XBT_DEBUG("elements_father: common ancestor '%s' src ancestor '%s' dst ancestor '%s'", common_ancestor->name(),
- src_ancestor->name(), dst_ancestor->name());
+ XBT_DEBUG("elements_father: common ancestor '%s' src ancestor '%s' dst ancestor '%s'", common_ancestor->getCname(),
+ src_ancestor->getCname(), dst_ancestor->getCname());
/* Check whether a direct bypass is defined. If so, use it and bail out */
if (common_ancestor->getBypassRoute(src, dst, links, latency))
xbt_assert(src_as == dst_as,
"Internal error: %s@%s and %s@%s are not in the same netzone as expected. Please report that bug.",
- src->cname(), src_as->name(), dst->cname(), dst_as->name());
+ src->cname(), src_as->getCname(), dst->cname(), dst_as->getCname());
xbt_assert(this == dst_as, "Internal error: route destination %s@%s is not in netzone %s as expected (route source: "
"%s@%s). Please report that bug.",
- src->cname(), dst->cname(), src_as->name(), dst_as->name(), name());
+ src->cname(), dst->cname(), src_as->getCname(), dst_as->getCname(), getCname());
}
void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route)
{
if (src->isNetZone()) {
std::string srcName = "router_" + src->name();
std::string dstName = "router_" + dst->name();
- route->gw_src = simgrid::s4u::Engine::instance()->netpointByNameOrNull(srcName.c_str());
- route->gw_dst = simgrid::s4u::Engine::instance()->netpointByNameOrNull(dstName.c_str());
+ route->gw_src = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(srcName.c_str());
+ route->gw_dst = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(dstName.c_str());
}
/* Retrieve the private links */
const char* MC_smx_actor_get_host_name(smx_actor_t actor)
{
if (mc_model_checker == nullptr)
- return actor->host->cname();
+ return actor->host->getCname();
simgrid::mc::Process* process = &mc_model_checker->process();
~fake_host() {}
};
fake_host foo;
- const size_t offset = (char*) &foo.host.name() - (char*) &foo.host;
+ const size_t offset = (char*)&foo.host.getName() - (char*)&foo.host;
// Read the simgrid::xbt::string in the MCed process:
simgrid::mc::ActorInformation* info = actor_info_cast(actor);
char *instr_process_id (msg_process_t proc, char *str, int len)
{
- return instr_process_id_2 (proc->cname(), proc->pid(), str, len);
+ return instr_process_id_2(proc->getCname(), proc->getPid(), str, len);
}
char *instr_process_id_2 (const char *process_name, int process_pid, char *str, int len)
int len = INSTR_DEFAULT_STR_SIZE;
char str[INSTR_DEFAULT_STR_SIZE];
- container_t host_container = PJ_container_get(host->cname());
+ container_t host_container = PJ_container_get(host->getCname());
PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container);
}
}
{
if (TRACE_msg_process_is_enabled() && status==SMX_EXIT_FAILURE){
//kill means that this process no longer exists, let's destroy it
- TRACE_msg_process_destroy(process->cname(), process->pid());
+ TRACE_msg_process_destroy(process->getCname(), process->getPid());
}
}
msg_netzone_t MSG_zone_get_root()
{
- return simgrid::s4u::Engine::instance()->netRoot();
+ return simgrid::s4u::Engine::getInstance()->getNetRoot();
}
const char* MSG_zone_get_name(msg_netzone_t netzone)
{
- return netzone->name();
+ return netzone->getCname();
}
msg_netzone_t MSG_zone_get_by_name(const char* name)
{
- return simgrid::s4u::Engine::instance()->netzoneByNameOrNull(name);
+ return simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(name);
}
void MSG_zone_get_sons(msg_netzone_t netzone, xbt_dict_t whereto)
{
- for (auto elem : *netzone->children()) {
- xbt_dict_set(whereto, elem->name(), static_cast<void*>(elem), nullptr);
+ for (auto elem : *netzone->getChildren()) {
+ xbt_dict_set(whereto, elem->getCname(), static_cast<void*>(elem), nullptr);
}
}
const char* MSG_zone_get_property_value(msg_netzone_t netzone, const char* name)
{
- return netzone->property(name);
+ return netzone->getProperty(name);
}
void MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value)
{
/* converts vector to dynar */
std::vector<simgrid::s4u::Host*> hosts;
- netzone->hosts(&hosts);
+ netzone->getHosts(&hosts);
for (auto host : hosts)
xbt_dynar_push(whereto, &host);
}
/* Try to receive it by calling SIMIX network layer */
try {
simcall_comm_recv(MSG_process_self()->getImpl(), mailbox->getImpl(), task, nullptr, nullptr, nullptr, nullptr, timeout, rate);
- XBT_DEBUG("Got task %s from %s",(*task)->name,mailbox->name());
+ XBT_DEBUG("Got task %s from %s", (*task)->name, mailbox->getName());
(*task)->simdata->setNotUsed();
}
catch (xbt_ex& e) {
* \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine.
*/
double MSG_host_get_speed(msg_host_t host) {
- return host->speed();
+ return host->getSpeed();
}
/** \ingroup m_host_management
* \return the number of cores
*/
int MSG_host_get_core_number(msg_host_t host) {
- return host->coreCount();
+ return host->getCoreCount();
}
/** \ingroup m_host_management
xbt_dict_t MSG_host_get_properties(msg_host_t host)
{
xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)");
- return host->properties();
+ return host->getProperties();
}
/** \ingroup m_host_management
{
xbt_assert((host != nullptr), "Invalid parameters");
xbt_dict_t contents = xbt_dict_new_homogeneous(nullptr);
- for (auto elm : host->mountedStorages())
+ for (auto elm : host->getMountedStorages())
xbt_dict_set(contents, elm.first.c_str(), MSG_storage_get_content(elm.second), nullptr);
return contents;
*/
void* MSG_file_get_data(msg_file_t fd)
{
- return fd->userdata();
+ return fd->getUserdata();
}
/** \ingroup msg_file
"\t\tStorage Id: '%s'\n"
"\t\tStorage Type: '%s'\n"
"\t\tFile Descriptor Id: %d",
- fd->path(), fd->size(), fd->mount_point.c_str(), fd->storageId, fd->storage_type, fd->desc_id);
+ fd->getPath(), fd->size(), fd->mount_point.c_str(), fd->storageId, fd->storage_type, fd->desc_id);
}
/** \ingroup msg_file
/* Find the host where the file is physically located and read it */
msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId);
- msg_host_t attached_host = storage_src->host();
+ msg_host_t attached_host = storage_src->getHost();
read_size = fd->read(size); // TODO re-add attached_host;
- if (strcmp(attached_host->cname(), MSG_host_self()->cname())) {
+ if (strcmp(attached_host->getCname(), MSG_host_self()->getCname())) {
/* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
- XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->cname(), read_size);
+ XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->getCname(), read_size);
msg_host_t m_host_list[] = {MSG_host_self(), attached_host};
double flops_amount[] = {0, 0};
double bytes_amount[] = {0, 0, static_cast<double>(read_size), 0};
if(transfer != MSG_OK){
if (transfer == MSG_HOST_FAILURE)
- XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->cname());
+ XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->getCname());
if (transfer == MSG_TASK_CANCELED)
XBT_WARN("Transfer error, task has been canceled!");
/* Find the host where the file is physically located (remote or local)*/
msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId);
- msg_host_t attached_host = storage_src->host();
+ msg_host_t attached_host = storage_src->getHost();
- if (strcmp(attached_host->cname(), MSG_host_self()->cname())) {
+ if (strcmp(attached_host->getCname(), MSG_host_self()->getCname())) {
/* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
- XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->cname(), size);
+ XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->getCname(), size);
msg_host_t m_host_list[] = {MSG_host_self(), attached_host};
double flops_amount[] = {0, 0};
double bytes_amount[] = {0, static_cast<double>(size), 0, 0};
if(transfer != MSG_OK){
if (transfer == MSG_HOST_FAILURE)
- XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->cname());
+ XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->getCname());
if (transfer == MSG_TASK_CANCELED)
XBT_WARN("Transfer error, task has been canceled!");
{
/* Find the host where the file is physically located (remote or local)*/
msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId);
- msg_host_t attached_host = storage_src->host();
+ msg_host_t attached_host = storage_src->getHost();
fd->unlink(attached_host);
delete fd;
return MSG_OK;
const char *MSG_file_get_name(msg_file_t fd) {
xbt_assert((fd != nullptr), "Invalid parameters");
- return fd->path();
+ return fd->getPath();
}
/**
{
/* Find the host where the file is physically located and read it */
msg_storage_t storage_src = simgrid::s4u::Storage::byName(file->storageId);
- msg_host_t src_host = storage_src->host();
+ msg_host_t src_host = storage_src->getHost();
MSG_file_seek(file, 0, SEEK_SET);
sg_size_t read_size = file->read(file->size());
msg_host_t dst_host;
size_t longest_prefix_length = 0;
- for (auto elm : host->mountedStorages()) {
+ for (auto elm : host->getMountedStorages()) {
std::string mount_point = std::string(fullpath).substr(0, elm.first.size());
if (mount_point == elm.first && elm.first.length() > longest_prefix_length) {
/* The current mount name is found in the full path and is bigger than the previous*/
if (storage_dest != nullptr) {
/* Mount point found, retrieve the host the storage is attached to */
- dst_host = storage_dest->host();
+ dst_host = storage_dest->getHost();
}else{
- XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->cname());
+ XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->getCname());
return MSG_TASK_CANCELED;
}
- XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, src_host->cname(),
- storage_dest->host()->cname());
+ XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, src_host->getCname(),
+ storage_dest->getHost()->getCname());
msg_host_t m_host_list[] = {src_host, dst_host};
double flops_amount[] = {0, 0};
double bytes_amount[] = {0, static_cast<double>(read_size), 0, 0};
if (err != MSG_OK) {
if (err == MSG_HOST_FAILURE)
- XBT_WARN("Transfer error, %s remote host just turned off!", storage_dest->host()->cname());
+ XBT_WARN("Transfer error, %s remote host just turned off!", storage_dest->getHost()->getCname());
if (err == MSG_TASK_CANCELED)
XBT_WARN("Transfer error, task has been canceled!");
const char* MSG_storage_get_name(msg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters");
- return storage->name();
+ return storage->getName();
}
/** \ingroup msg_storage_management
*/
sg_size_t MSG_storage_get_free_size(msg_storage_t storage)
{
- return storage->sizeFree();
+ return storage->getSizeFree();
}
/** \ingroup msg_storage_management
*/
sg_size_t MSG_storage_get_used_size(msg_storage_t storage)
{
- return storage->sizeUsed();
+ return storage->getSizeUsed();
}
/** \ingroup msg_storage_management
xbt_dict_t MSG_storage_get_properties(msg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters (storage is nullptr)");
- return storage->properties();
+ return storage->getProperties();
}
/** \ingroup msg_storage_management
*/
const char *MSG_storage_get_property_value(msg_storage_t storage, const char *name)
{
- return storage->property(name);
+ return storage->getProperty(name);
}
/** \ingroup msg_storage_management
void *MSG_storage_get_data(msg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters");
- return storage->userdata();
+ return storage->getUserdata();
}
/** \ingroup msg_storage_management
*/
xbt_dict_t MSG_storage_get_content(msg_storage_t storage)
{
- std::map<std::string, sg_size_t>* content = storage->content();
+ std::map<std::string, sg_size_t>* content = storage->getContent();
xbt_dict_t content_dict = xbt_dict_new_homogeneous(&free);
for (auto entry : *content) {
*/
sg_size_t MSG_storage_get_size(msg_storage_t storage)
{
- return storage->size();
+ return storage->getSize();
}
/** \ingroup msg_storage_management
const char* MSG_storage_get_host(msg_storage_t storage)
{
xbt_assert((storage != nullptr), "Invalid parameters");
- return storage->host()->cname();
+ return storage->getHost()->getCname();
}
SG_END_DECL()
/* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */
smx_actor_t process =
- SIMIX_process_attach(name, new simgrid::msg::ActorExt(data), host->cname(), properties, nullptr);
+ SIMIX_process_attach(name, new simgrid::msg::ActorExt(data), host->getCname(), properties, nullptr);
if (not process)
xbt_die("Could not attach");
simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process);
*/
const char *MSG_process_get_name(msg_process_t process)
{
- return process->cname();
+ return process->getCname();
}
/** \ingroup m_process_management
*/
void MSG_vm_get_params(msg_vm_t vm, vm_params_t params)
{
- static_cast<simgrid::s4u::VirtualMachine*>(vm)->parameters(params);
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->getParameters(params);
}
/* **** Check state of a VM **** */
void MSG_vm_destroy(msg_vm_t vm)
{
if (MSG_vm_is_migrating(vm))
- THROWF(vm_error, 0, "Cannot destroy VM '%s', which is migrating.", vm->cname());
+ THROWF(vm_error, 0, "Cannot destroy VM '%s', which is migrating.", vm->getCname());
/* First, terminate all processes on the VM if necessary */
if (MSG_vm_is_running(vm))
});
if (TRACE_msg_vm_is_enabled()) {
- container_t container = PJ_container_get(vm->cname());
+ container_t container = PJ_container_get(vm->getCname());
PJ_container_remove_from_parent(container);
PJ_container_free(container);
}
if (vm_ramsize > pm_ramsize - total_ramsize_of_vms) {
XBT_WARN("cannnot start %s@%s due to memory shortage: vm_ramsize %ld, free %ld, pm_ramsize %ld (bytes).",
- vm->cname(), pm->cname(), vm_ramsize, pm_ramsize - total_ramsize_of_vms, pm_ramsize);
- THROWF(vm_error, 0, "Memory shortage on host '%s', VM '%s' cannot be started", pm->cname(), vm->cname());
+ vm->getCname(), pm->getCname(), vm_ramsize, pm_ramsize - total_ramsize_of_vms, pm_ramsize);
+ THROWF(vm_error, 0, "Memory shortage on host '%s', VM '%s' cannot be started", pm->getCname(), vm->getCname());
}
}
});
if (TRACE_msg_vm_is_enabled()) {
- container_t vm_container = PJ_container_get(vm->cname());
+ container_t vm_container = PJ_container_get(vm->getCname());
type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
val_t value = PJ_value_get_or_new("start", "0 0 1", type); // start is blue
new PushStateEvent(MSG_get_clock(), vm_container, type, value);
static inline char *get_mig_process_tx_name(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm)
{
- return bprintf("__pr_mig_tx:%s(%s-%s)", vm->cname(), src_pm->cname(), dst_pm->cname());
+ return bprintf("__pr_mig_tx:%s(%s-%s)", vm->getCname(), src_pm->getCname(), dst_pm->getCname());
}
static inline char *get_mig_process_rx_name(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm)
{
- return bprintf("__pr_mig_rx:%s(%s-%s)", vm->cname(), src_pm->cname(), dst_pm->cname());
+ return bprintf("__pr_mig_rx:%s(%s-%s)", vm->getCname(), src_pm->getCname(), dst_pm->getCname());
}
static inline char *get_mig_task_name(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm, int stage)
{
- return bprintf("__task_mig_stage%d:%s(%s-%s)", stage, vm->cname(), src_pm->cname(), dst_pm->cname());
+ return bprintf("__task_mig_stage%d:%s(%s-%s)", stage, vm->getCname(), src_pm->getCname(), dst_pm->getCname());
}
struct migration_session {
// Now the VM is running on the new host (the migration is completed) (even if the SRC crash)
vm->pimpl_vm_->isMigrating = false;
- XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", ms->vm->cname(), ms->src_pm->cname(), ms->dst_pm->cname());
+ XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", ms->vm->getCname(), ms->src_pm->getCname(), ms->dst_pm->getCname());
if (TRACE_msg_vm_is_enabled()) {
static long long int counter = 0;
counter++;
// start link
- container_t msg = PJ_container_get(vm->cname());
+ container_t msg = PJ_container_get(vm->getCname());
type_t type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
new StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
// destroy existing container of this vm
- container_t existing_container = PJ_container_get(vm->cname());
+ container_t existing_container = PJ_container_get(vm->getCname());
PJ_container_remove_from_parent(existing_container);
PJ_container_free(existing_container);
// create new container on the new_host location
- PJ_container_new(vm->cname(), INSTR_MSG_VM, PJ_container_get(ms->dst_pm->cname()));
+ PJ_container_new(vm->getCname(), INSTR_MSG_VM, PJ_container_get(ms->dst_pm->getCname()));
// end link
- msg = PJ_container_get(vm->cname());
+ msg = PJ_container_get(vm->getCname());
type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
new EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
}
double computed = dp->prev_remaining - remaining;
double duration = clock - dp->prev_clock;
- XBT_DEBUG("%s@%s: computed %f ops (remaining %f -> %f) in %f secs (%f -> %f)", key, vm->cname(), computed,
+ XBT_DEBUG("%s@%s: computed %f ops (remaining %f -> %f) in %f secs (%f -> %f)", key, vm->getCname(), computed,
dp->prev_remaining, remaining, duration, dp->prev_clock, clock);
return computed;
pimpl->dp_objs = xbt_dict_new_homogeneous(nullptr);
xbt_assert(xbt_dict_get_or_null(pimpl->dp_objs, key) == nullptr);
xbt_dict_set(pimpl->dp_objs, key, dp, nullptr);
- XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, host->cname(), remaining, pimpl->dp_enabled);
+ XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, host->getCname(), remaining, pimpl->dp_enabled);
xbt_free(key);
}
xbt_dict_remove(pimpl->dp_objs, key);
xbt_free(dp);
- XBT_DEBUG("del %s on %s", key, host->cname());
+ XBT_DEBUG("del %s on %s", key, host->getCname());
xbt_free(key);
}
/* FIXME: why try-and-catch is used here? */
if(ret == MSG_HOST_FAILURE){
- XBT_DEBUG("SRC host failed during migration of %s (stage %d)", vm->cname(), stage);
+ XBT_DEBUG("SRC host failed during migration of %s (stage %d)", vm->getCname(), stage);
MSG_task_destroy(task);
- THROWF(host_error, 0, "SRC host failed during migration of %s (stage %d)", vm->cname(), stage);
+ THROWF(host_error, 0, "SRC host failed during migration of %s (stage %d)", vm->getCname(), stage);
}else if(ret == MSG_TRANSFER_FAILURE){
- XBT_DEBUG("DST host failed during migration of %s (stage %d)", vm->cname(), stage);
+ XBT_DEBUG("DST host failed during migration of %s (stage %d)", vm->getCname(), stage);
MSG_task_destroy(task);
- THROWF(host_error, 0, "DST host failed during migration of %s (stage %d)", vm->cname(), stage);
+ THROWF(host_error, 0, "DST host failed during migration of %s (stage %d)", vm->getCname(), stage);
}
double clock_end = MSG_get_clock();
double host_speed = MSG_host_get_speed(MSG_vm_get_pm(ms->vm));
s_vm_params_t params;
- static_cast<simgrid::s4u::VirtualMachine*>(ms->vm)->parameters(¶ms);
+ static_cast<simgrid::s4u::VirtualMachine*>(ms->vm)->getParameters(¶ms);
const sg_size_t ramsize = params.ramsize;
const sg_size_t devsize = params.devsize;
const int skip_stage1 = params.skip_stage1;
msg_host_t src_pm = pimpl->getPm();
if (src_pm->isOff())
- THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->cname(), src_pm->cname());
+ THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->getCname(), src_pm->getCname());
if (dst_pm->isOff())
- THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->cname(), dst_pm->cname());
+ THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->getCname(), dst_pm->getCname());
if (not MSG_vm_is_running(vm))
- THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->cname());
+ THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->getCname());
if (typedVm->isMigrating())
- THROWF(vm_error, 0, "Cannot migrate VM '%s' that is already migrating.", vm->cname());
+ THROWF(vm_error, 0, "Cannot migrate VM '%s' that is already migrating.", vm->getCname());
pimpl->isMigrating = true;
/* We have two mailboxes. mbox is used to transfer migration data between source and destination PMs. mbox_ctl is used
* to detect the completion of a migration. The names of these mailboxes must not conflict with others. */
- ms->mbox_ctl = bprintf("__mbox_mig_ctl:%s(%s-%s)", vm->cname(), src_pm->cname(), dst_pm->cname());
- ms->mbox = bprintf("__mbox_mig_src_dst:%s(%s-%s)", vm->cname(), src_pm->cname(), dst_pm->cname());
+ ms->mbox_ctl = bprintf("__mbox_mig_ctl:%s(%s-%s)", vm->getCname(), src_pm->getCname(), dst_pm->getCname());
+ ms->mbox = bprintf("__mbox_mig_src_dst:%s(%s-%s)", vm->getCname(), src_pm->getCname(), dst_pm->getCname());
char *pr_rx_name = get_mig_process_rx_name(vm, src_pm, dst_pm);
char *pr_tx_name = get_mig_process_tx_name(vm, src_pm, dst_pm);
XBT_ERROR("SRC crashes, throw an exception (m-control)");
// MSG_process_kill(tx_process); // Adrien, I made a merge on Nov 28th 2014, I'm not sure whether this line is
// required or not
- THROWF(host_error, 0, "Source host '%s' failed during the migration of VM '%s'.", src_pm->cname(), vm->cname());
+ THROWF(host_error, 0, "Source host '%s' failed during the migration of VM '%s'.", src_pm->getCname(),
+ vm->getCname());
} else if ((ret == MSG_TRANSFER_FAILURE) || (ret == MSG_TIMEOUT)) {
// MSG_TIMEOUT here means that MSG_host_is_avail() returned false.
XBT_ERROR("DST crashes, throw an exception (m-control)");
- THROWF(host_error, 0, "Destination host '%s' failed during the migration of VM '%s'.", dst_pm->cname(),
- vm->cname());
+ THROWF(host_error, 0, "Destination host '%s' failed during the migration of VM '%s'.", dst_pm->getCname(),
+ vm->getCname());
}
char* expected_task_name = get_mig_task_name(vm, src_pm, dst_pm, 4);
XBT_DEBUG("vm_suspend done");
if (TRACE_msg_vm_is_enabled()) {
- container_t vm_container = PJ_container_get(vm->cname());
+ container_t vm_container = PJ_container_get(vm->getCname());
type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
val_t value = PJ_value_get_or_new("suspend", "1 0 0", type); // suspend is red
new PushStateEvent(MSG_get_clock(), vm_container, type, value);
static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->resume();
if (TRACE_msg_vm_is_enabled()) {
- container_t vm_container = PJ_container_get(vm->cname());
+ container_t vm_container = PJ_container_get(vm->getCname());
type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
new PopStateEvent(MSG_get_clock(), vm_container, type);
}
*/
msg_host_t MSG_vm_get_pm(msg_vm_t vm)
{
- return static_cast<simgrid::s4u::VirtualMachine*>(vm)->pm();
+ return static_cast<simgrid::s4u::VirtualMachine*>(vm)->getPm();
}
/** @brief Set a CPU bound for a given VM.
double solved_value = ws_vm->pimpl_vm_->action_->getVariable()
->value; // this is X1 in comment above, what this VM got in the sharing on the PM
- XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->cname(), ws_vm->pimpl_vm_->getPm()->cname());
+ XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->getCname(), ws_vm->pimpl_vm_->getPm()->getCname());
// TODO: check lmm_update_constraint_bound() works fine instead of the below manual substitution.
// cpu_cas01->constraint->bound = solved_value;
/* Initialize the VM parameters */
params_.ramsize = 0;
- XBT_VERB("Create VM(%s)@PM(%s)", piface->cname(), hostPM_->cname());
+ XBT_VERB("Create VM(%s)@PM(%s)", piface->getCname(), hostPM_->getCname());
}
extern "C" int
void VirtualMachineImpl::suspend(smx_actor_t issuer)
{
if (isMigrating)
- THROWF(vm_error, 0, "Cannot suspend VM '%s': it is migrating", piface_->cname());
+ THROWF(vm_error, 0, "Cannot suspend VM '%s': it is migrating", piface_->getCname());
if (getState() != SURF_VM_STATE_RUNNING)
- THROWF(vm_error, 0, "Cannot suspend VM %s: it is not running.", piface_->cname());
+ THROWF(vm_error, 0, "Cannot suspend VM %s: it is not running.", piface_->getCname());
if (issuer->host == piface_)
- THROWF(vm_error, 0, "Actor %s cannot suspend the VM %s in which it runs", issuer->cname(), piface_->cname());
+ THROWF(vm_error, 0, "Actor %s cannot suspend the VM %s in which it runs", issuer->cname(), piface_->getCname());
xbt_swag_t process_list = piface_->extension<simgrid::simix::Host>()->process_list;
- XBT_DEBUG("suspend VM(%s), where %d processes exist", piface_->cname(), xbt_swag_size(process_list));
+ XBT_DEBUG("suspend VM(%s), where %d processes exist", piface_->getCname(), xbt_swag_size(process_list));
action_->suspend();
void VirtualMachineImpl::resume()
{
if (getState() != SURF_VM_STATE_SUSPENDED)
- THROWF(vm_error, 0, "Cannot resume VM %s: it was not suspended", piface_->cname());
+ THROWF(vm_error, 0, "Cannot resume VM %s: it was not suspended", piface_->getCname());
xbt_swag_t process_list = piface_->extension<simgrid::simix::Host>()->process_list;
- XBT_DEBUG("Resume VM %s, containing %d processes.", piface_->cname(), xbt_swag_size(process_list));
+ XBT_DEBUG("Resume VM %s, containing %d processes.", piface_->getCname(), xbt_swag_size(process_list));
action_->resume();
THROW_IMPOSSIBLE;
break;
}
- XBT_VERB("Shuting down the VM %s even if it's not running but %s", piface_->cname(), stateName);
+ XBT_VERB("Shuting down the VM %s even if it's not running but %s", piface_->getCname(), stateName);
}
xbt_swag_t process_list = piface_->extension<simgrid::simix::Host>()->process_list;
- XBT_DEBUG("shutdown VM %s, that contains %d processes", piface_->cname(), xbt_swag_size(process_list));
+ XBT_DEBUG("shutdown VM %s, that contains %d processes", piface_->getCname(), xbt_swag_size(process_list));
smx_actor_t smx_process;
smx_actor_t smx_process_safe;
*/
void VirtualMachineImpl::setPm(s4u::Host* destination)
{
- const char* vm_name = piface_->cname();
- const char* pm_name_src = hostPM_->cname();
- const char* pm_name_dst = destination->cname();
+ const char* vm_name = piface_->getCname();
+ const char* pm_name_src = hostPM_->getCname();
+ const char* pm_name_dst = destination->getCname();
/* update net_elm with that of the destination physical host */
piface_->pimpl_netpoint = destination->pimpl_netpoint;
extension_set<simgrid::simix::Host>(new simgrid::simix::Host());
if (TRACE_msg_vm_is_enabled()) {
- container_t host_container = PJ_container_get(pm->cname());
+ container_t host_container = PJ_container_get(pm->getCname());
PJ_container_new(name, INSTR_MSG_VM, host_container);
}
}
{
onDestruction(*this);
- XBT_DEBUG("destroy %s", cname());
+ XBT_DEBUG("destroy %s", getCname());
/* FIXME: this is really strange that everything fails if the next line is removed.
* This is as if we shared these data with the PM, which definitely should not be the case...
{
return pimpl_vm_->params_.ramsize;
}
-simgrid::s4u::Host* VirtualMachine::pm()
+simgrid::s4u::Host* VirtualMachine::getPm()
{
return pimpl_vm_->getPm();
}
/** @brief Retrieve a copy of the parameters of that VM/PM
* @details The ramsize and overcommit fields are used on the PM too */
-void VirtualMachine::parameters(vm_params_t params)
+void VirtualMachine::getParameters(vm_params_t params)
{
pimpl_vm_->getParams(params);
}
simgrid::simix::kernelImmediate([this, new_host]() { pimpl_->new_host = new_host; });
}
-s4u::Host* Actor::host()
+s4u::Host* Actor::getHost()
{
return this->pimpl_->host;
}
simgrid::simix::kernelImmediate([this]() { pimpl_->daemonize(); });
}
-const char* Actor::cname()
+const char* Actor::getCname()
{
return this->pimpl_->name.c_str();
}
-simgrid::xbt::string Actor::name()
+simgrid::xbt::string Actor::getName()
{
return this->pimpl_->name;
}
-aid_t Actor::pid()
+aid_t Actor::getPid()
{
return this->pimpl_->pid;
}
-aid_t Actor::ppid()
+aid_t Actor::getPpid()
{
return this->pimpl_->ppid;
}
}
/** \brief Get the kill time of an actor(or 0 if unset). */
-double Actor::killTime()
+double Actor::getKillTime()
{
return SIMIX_timer_get_date(pimpl_->kill_timer);
}
}
/** Retrieve the property value (or nullptr if not set) */
-const char* Actor::property(const char* key)
+const char* Actor::getProperty(const char* key)
{
return (char*)xbt_dict_get_or_null(simcall_process_get_properties(pimpl_), key);
}
return chan->get_async(data);
}
-aid_t pid()
+aid_t getPid()
{
return SIMIX_process_self()->pid;
}
-aid_t ppid()
+aid_t getPpid()
{
return SIMIX_process_self()->ppid;
}
-std::string name()
+std::string getName()
{
return SIMIX_process_self()->name;
}
-Host* host()
+Host* getHost()
{
return SIMIX_process_self()->host;
}
return false;
}
-MailboxPtr Comm::mailbox()
+MailboxPtr Comm::getMailbox()
{
return mailbox_;
}
s4u::Engine::instance_ = nullptr;
}
-Engine *Engine::instance() {
+Engine* Engine::getInstance()
+{
if (s4u::Engine::instance_ == nullptr)
new Engine(0,nullptr);
return s4u::Engine::instance_;
// FIXME: The following duplicates the content of s4u::Host
extern std::map<std::string, simgrid::s4u::Host*> host_list;
/** @brief Returns the amount of hosts in the platform */
-size_t Engine::hostCount()
+size_t Engine::getHostCount()
{
return host_list.size();
}
/** @brief Fills the passed list with all hosts found in the platform */
-void Engine::hostList(std::vector<Host*>* list)
+void Engine::getHostList(std::vector<Host*>* list)
{
for (auto kv : host_list)
list->push_back(kv.second);
}
}
-s4u::NetZone* Engine::netRoot()
+s4u::NetZone* Engine::getNetRoot()
{
return pimpl->netRoot_;
}
static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* name)
{
- if (not strcmp(current->name(), name))
+ if (not strcmp(current->getCname(), name))
return current;
- for (auto elem : *(current->children())) {
+ for (auto elem : *(current->getChildren())) {
simgrid::s4u::NetZone* tmp = netzoneByNameRecursive(elem, name);
if (tmp != nullptr) {
return tmp;
}
/** @brief Retrieve the NetZone of the given name (or nullptr if not found) */
-NetZone* Engine::netzoneByNameOrNull(const char* name)
+NetZone* Engine::getNetzoneByNameOrNull(const char* name)
{
- return netzoneByNameRecursive(netRoot(), name);
+ return netzoneByNameRecursive(getNetRoot(), name);
}
/** @brief Retrieve the netpoint of the given name (or nullptr if not found) */
-simgrid::kernel::routing::NetPoint* Engine::netpointByNameOrNull(const char* name)
+simgrid::kernel::routing::NetPoint* Engine::getNetpointByNameOrNull(const char* name)
{
if (pimpl->netpoints_.find(name) == pimpl->netpoints_.end())
return nullptr;
return pimpl->netpoints_.at(name);
}
/** @brief Fill the provided vector with all existing netpoints */
-void Engine::netpointList(std::vector<simgrid::kernel::routing::NetPoint*>* list)
+void Engine::getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*>* list)
{
for (auto kv : pimpl->netpoints_)
list->push_back(kv.second);
Storage* st = nullptr;
size_t longest_prefix_length = 0;
std::string path;
- XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, host->cname());
+ XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, host->getCname());
- for (auto mnt : host->mountedStorages()) {
+ for (auto mnt : host->getMountedStorages()) {
XBT_DEBUG("See '%s'", mnt.first.c_str());
mount_point = std::string(fullpath).substr(0, mnt.first.size());
mount_point = std::string(fullpath).substr(0, longest_prefix_length);
path = std::string(fullpath).substr(longest_prefix_length, strlen(fullpath));
} else
- xbt_die("Can't find mount point for '%s' on '%s'", fullpath, host->cname());
+ xbt_die("Can't find mount point for '%s' on '%s'", fullpath, host->getCname());
pimpl_ = simcall_file_open(mount_point.c_str(), path.c_str(), st);
- storage_type = st->type();
- storageId = st->name();
+ storage_type = st->getType();
+ storageId = st->getName();
}
File::~File()
delete pimpl_;
if (pimpl_netpoint != nullptr) // not removed yet by a children class
- simgrid::s4u::Engine::instance()->netpointUnregister(pimpl_netpoint);
+ simgrid::s4u::Engine::getInstance()->netpointUnregister(pimpl_netpoint);
delete pimpl_cpu;
delete mounts;
}
return this->pimpl_cpu->isOn();
}
-int Host::pstatesCount() const {
+int Host::getPstatesCount() const
+{
return this->pimpl_cpu->getNbPStates();
}
{
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(pimpl_netpoint, dest->pimpl_netpoint, links, latency);
if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
- XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", cname(), dest->cname(),
+ XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", getCname(), dest->getCname(),
(latency == nullptr ? -1 : *latency));
for (auto link : *links)
XBT_CDEBUG(surf_route, "Link %s", link->cname());
}
/** Get the properties assigned to a host */
-xbt_dict_t Host::properties() {
+xbt_dict_t Host::getProperties()
+{
return simgrid::simix::kernelImmediate([this] {
return this->pimpl_->getProperties();
});
}
/** Retrieve the property value (or nullptr if not set) */
-const char* Host::property(const char* key)
+const char* Host::getProperty(const char* key)
{
return this->pimpl_->getProperty(key);
}
}
/** Get the processes attached to the host */
-void Host::processes(std::vector<ActorPtr>* list)
+void Host::getProcesses(std::vector<ActorPtr>* list)
{
smx_actor_t actor = NULL;
xbt_swag_foreach(actor, this->extension<simgrid::simix::Host>()->process_list) {
}
/** @brief Get the peak processor speed (in flops/s), at the current pstate */
-double Host::speed() {
+double Host::getSpeed()
+{
return pimpl_cpu->getSpeed(1.0);
}
/** @brief Returns the number of core of the processor. */
-int Host::coreCount() {
+int Host::getCoreCount()
+{
return pimpl_cpu->coreCount();
}
});
}
/** @brief Retrieve the pstate at which the host is currently running */
-int Host::pstate()
+int Host::getPstate()
{
return this->pimpl_cpu->getPState();
}
* \brief Returns the list of storages attached to an host.
* \return a vector containing all storages attached to the host
*/
-void Host::attachedStorages(std::vector<const char*>* storages)
+void Host::getAttachedStorages(std::vector<const char*>* storages)
{
simgrid::simix::kernelImmediate([this, storages] {
this->pimpl_->getAttachedStorageList(storages);
});
}
-std::unordered_map<std::string, Storage*> const& Host::mountedStorages()
+std::unordered_map<std::string, Storage*> const& Host::getMountedStorages()
{
if (mounts == nullptr) {
mounts = new std::unordered_map<std::string, Storage*>();
namespace simgrid {
namespace s4u {
-const char *Mailbox::name() {
+const char* Mailbox::getName()
+{
return pimpl_->name_;
}
}
/** @brief get the receiver (process associated to the mailbox) */
-ActorPtr Mailbox::receiver() {
+ActorPtr Mailbox::getReceiver()
+{
if (pimpl_->permanent_receiver == nullptr)
return ActorPtr();
return pimpl_->permanent_receiver->iface();
xbt_free(name_);
}
-std::unordered_map<std::string, std::string>* NetZone::properties()
+std::unordered_map<std::string, std::string>* NetZone::getProperties()
{
return simgrid::simix::kernelImmediate([this] {
return &properties_;
}
/** Retrieve the property value (or nullptr if not set) */
-const char* NetZone::property(const char* key)
+const char* NetZone::getProperty(const char* key)
{
return properties_.at(key).c_str();
}
});
}
-std::vector<NetZone*>* NetZone::children()
+std::vector<NetZone*>* NetZone::getChildren()
{
return children_;
}
-char* NetZone::name()
+char* NetZone::getCname()
{
return name_;
}
-NetZone* NetZone::father()
+NetZone* NetZone::getFather()
{
return father_;
}
-void NetZone::hosts(std::vector<s4u::Host*>* whereto)
+void NetZone::getHosts(std::vector<s4u::Host*>* whereto)
{
for (auto card : vertices_) {
s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->name());
return &res->piface_;
}
-const char* Storage::name()
+const char* Storage::getName()
{
return pimpl_->cname();
}
-const char* Storage::type()
+const char* Storage::getType()
{
return pimpl_->typeId_.c_str();
}
-Host* Storage::host()
+Host* Storage::getHost()
{
return attached_to_;
}
-sg_size_t Storage::sizeFree()
+sg_size_t Storage::getSizeFree()
{
return simgrid::simix::kernelImmediate([this] { return pimpl_->getFreeSize(); });
}
-sg_size_t Storage::sizeUsed()
+sg_size_t Storage::getSizeUsed()
{
return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); });
}
-sg_size_t Storage::size() {
+sg_size_t Storage::getSize()
+{
return pimpl_->size_;
}
-xbt_dict_t Storage::properties()
+xbt_dict_t Storage::getProperties()
{
return simgrid::simix::kernelImmediate([this] { return pimpl_->getProperties(); });
}
-const char* Storage::property(const char* key)
+const char* Storage::getProperty(const char* key)
{
- return static_cast<const char*>(xbt_dict_get_or_null(this->properties(), key));
+ return static_cast<const char*>(xbt_dict_get_or_null(this->getProperties(), key));
}
void Storage::setProperty(const char* key, char* value)
{
- xbt_dict_set(this->properties(), key, value, nullptr);
+ xbt_dict_set(this->getProperties(), key, value, nullptr);
}
-std::map<std::string, sg_size_t>* Storage::content()
+std::map<std::string, sg_size_t>* Storage::getContent()
{
return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); });
}
*/
void SD_create_environment(const char *platform_file)
{
- simgrid::s4u::Engine::instance()->loadPlatform(platform_file);
+ simgrid::s4u::Engine::getInstance()->loadPlatform(platform_file);
XBT_DEBUG("Host number: %zu, link number: %d", sg_host_count(), sg_link_count());
#if SIMGRID_HAVE_JEDULE
for (int i = 0; i < host_count; i++) {
double time = 0.0;
if (flops_amount != nullptr)
- time = flops_amount[i] / host_list[i]->speed();
+ time = flops_amount[i] / host_list[i]->getSpeed();
if (bytes_amount != nullptr)
for (int j = 0; j < host_count; j++)
*/
std::vector<std::string> names = std::vector<std::string>();
for (auto kv : simgrid::s4u::host_list)
- names.push_back(kv.second->name());
+ names.push_back(kv.second->getName());
std::sort(names.begin(), names.end());
const char *sg_host_get_name(sg_host_t host)
{
- return host->cname();
+ return host->getCname();
}
void* sg_host_extension_get(sg_host_t host, size_t ext)
static int hostcmp_voidp(const void* pa, const void* pb)
{
- return strcmp((*static_cast<simgrid::s4u::Host* const*>(pa))->cname(),
- (*static_cast<simgrid::s4u::Host* const*>(pb))->cname());
+ return strcmp((*static_cast<simgrid::s4u::Host* const*>(pa))->getCname(),
+ (*static_cast<simgrid::s4u::Host* const*>(pb))->getCname());
}
xbt_dynar_t sg_hosts_as_dynar()
xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){
xbt_assert((host != nullptr), "Invalid parameters");
xbt_dict_t res = xbt_dict_new_homogeneous(nullptr);
- for (auto elm : host->mountedStorages()) {
+ for (auto elm : host->getMountedStorages()) {
const char* mount_name = elm.first.c_str();
sg_storage_t storage = elm.second;
- xbt_dict_set(res, mount_name, (void*)storage->name(), nullptr);
+ xbt_dict_set(res, mount_name, (void*)storage->getName(), nullptr);
}
return res;
xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){
std::vector<const char*>* storage_vector = new std::vector<const char*>();
xbt_dynar_t storage_dynar = xbt_dynar_new(sizeof(const char*), nullptr);
- host->attachedStorages(storage_vector);
+ host->getAttachedStorages(storage_vector);
for (auto name : *storage_vector)
xbt_dynar_push(storage_dynar, &name);
delete storage_vector;
/** @brief Returns the total speed of a host */
double sg_host_speed(sg_host_t host)
{
- return host->speed();
+ return host->getSpeed();
}
double sg_host_get_available_speed(sg_host_t host)
* See also @ref plugin_energy.
*/
int sg_host_get_nb_pstates(sg_host_t host) {
- return host->pstatesCount();
+ return host->getPstatesCount();
}
/** @brief Gets the pstate at which that host currently runs.
* See also @ref plugin_energy.
*/
int sg_host_get_pstate(sg_host_t host) {
- return host->pstate();
+ return host->getPstate();
}
/** @brief Sets the pstate at which that host should run.
*
/** @brief Get the properties of an host */
xbt_dict_t sg_host_get_properties(sg_host_t host) {
- return host->properties();
+ return host->getProperties();
}
/** \ingroup m_host_management
{
xbt_dict_t props;
- XBT_INFO("Displaying host %s", host->cname());
- XBT_INFO(" - speed: %.0f", host->speed());
+ XBT_INFO("Displaying host %s", host->getCname());
+ XBT_INFO(" - speed: %.0f", host->getSpeed());
XBT_INFO(" - available speed: %.2f", sg_host_get_available_speed(host));
- props = host->properties();
+ props = host->getProperties();
if (not xbt_dict_is_empty(props)) {
XBT_INFO(" - properties:");
xbt_dict_t properties, smx_actor_t parent_process)
{
- XBT_DEBUG("Start process %s on host '%s'", name, host->cname());
+ XBT_DEBUG("Start process %s on host '%s'", name, host->getCname());
if (host->isOff()) {
- XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, host->cname());
+ XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, host->getCname());
return nullptr;
}
/* Now insert it in the global process list and in the process to run list */
simix_global->process_list[process->pid] = process;
- XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->cname());
+ XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->getCname());
xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process);
intrusive_ptr_add_ref(process);
/* Now insert it in the global process list and in the process to run list */
simix_global->process_list[process->pid] = process;
- XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->cname());
+ XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->getCname());
xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process);
/* Tracing the process creation */
*/
void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) {
- XBT_DEBUG("Killing process %s@%s", process->cname(), process->host->cname());
+ XBT_DEBUG("Killing process %s@%s", process->cname(), process->host->getCname());
process->context->iwannadie = 1;
process->blocked = 0;
sg_host_t host = process->host;
if (host->isOff())
- THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->cname());
+ THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->getCname());
simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl();
synchro->host = host;
self->properties,
self->auto_restart);
}
- XBT_DEBUG("Process %s@%s is dead", self->cname(), self->host->cname());
+ XBT_DEBUG("Process %s@%s is dead", self->cname(), self->host->getCname());
self->context->stop();
}
}
/** @brief Restart a process, starting it again from the beginning. */
smx_actor_t SIMIX_process_restart(smx_actor_t process, smx_actor_t issuer) {
- XBT_DEBUG("Restarting process %s on %s", process->cname(), process->host->cname());
+ XBT_DEBUG("Restarting process %s on %s", process->cname(), process->host->getCname());
//retrieve the arguments of the old process
//FIXME: Factorize this with SIMIX_host_add_auto_restart_process ?
if (kill_time <= SIMIX_get_clock() || simix_global->kill_process_function == nullptr)
return;
- XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->cname(), process->host->cname());
+ XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->cname(), process->host->getCname());
process->kill_timer = SIMIX_timer_set(kill_time, [=] {
simix_global->kill_process_function(process);
process->kill_timer=nullptr;
/* Autorestart all process */
for (auto host: host_that_restart) {
- XBT_INFO("Restart processes on host %s", host->cname());
+ XBT_INFO("Restart processes on host %s", host->getCname());
SIMIX_host_autorestart(host);
}
host_that_restart.clear();
*/
XBT_INFO("Process %lu (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid,
- process->cname(), process->host->cname(), synchro_description, process->waiting_synchro.get(),
+ process->cname(), process->host->getCname(), synchro_description, process->waiting_synchro.get(),
process->waiting_synchro->name.c_str(), (int)process->waiting_synchro->state);
}
else {
- XBT_INFO("Process %lu (%s@%s)", process->pid, process->cname(), process->host->cname());
+ XBT_INFO("Process %lu (%s@%s)", process->pid, process->cname(), process->host->getCname());
}
}
}
void Host::turnOn()
{
for (auto arg : boot_processes) {
- XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->cname());
+ XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->getCname());
smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host,
arg->properties, nullptr);
if (arg->kill_time >= 0)
smx_actor_t process = nullptr;
xbt_swag_foreach(process, host->process_list) {
SIMIX_process_kill(process, issuer);
- XBT_DEBUG("Killing %s@%s on behalf of %s", process->cname(), process->host->cname(), issuer->cname());
+ XBT_DEBUG("Killing %s@%s on behalf of %s", process->cname(), process->host->getCname(), issuer->cname());
}
}
} else {
- XBT_INFO("Host %s is already off", h->cname());
+ XBT_INFO("Host %s is already off", h->getCname());
}
}
if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process)
return "";
- return host->cname();
+ return host->getCname();
}
/**
arg->properties = properties;
arg->auto_restart = auto_restart;
- if (host->isOff() && not xbt_dict_get_or_null(watched_hosts_lib, host->cname())) {
- xbt_dict_set(watched_hosts_lib, host->cname(), host, nullptr);
- XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF", host->cname());
+ if (host->isOff() && not xbt_dict_get_or_null(watched_hosts_lib, host->getCname())) {
+ xbt_dict_set(watched_hosts_lib, host->getCname(), host, nullptr);
+ XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF", host->getCname());
}
host->extension<simgrid::simix::Host>()->auto_restart_processes.push_back(arg);
}
host->extension<simgrid::simix::Host>()->auto_restart_processes;
for (auto arg : process_list) {
- XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->cname());
+ XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->getCname());
smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host,
arg->properties, nullptr);
if (arg->kill_time >= 0)
break;
case SIMIX_FAILED:
- XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->cname());
+ XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->getCname());
simcall->issuer->context->iwannadie = 1;
SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
break;
{
/* check if the host is active */
if (host->isOff())
- THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname());
+ THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname());
simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
synchro->host = host;
smx_activity_t SIMIX_file_write(surf_file_t file, sg_size_t size, sg_host_t host)
{
if (host->isOff())
- THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname());
+ THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname());
simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
synchro->host = host;
smx_activity_t SIMIX_file_open(const char* mount, const char* path, sg_storage_t st)
{
- if (st->host()->isOff())
- THROWF(host_error, 0, "Host %s failed, you cannot call this function", st->host()->cname());
+ if (st->getHost()->isOff())
+ THROWF(host_error, 0, "Host %s failed, you cannot call this function", st->getHost()->getCname());
simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
- synchro->host = st->host();
+ synchro->host = st->getHost();
synchro->surf_io = st->pimpl_->open(mount, path);
synchro->surf_io->setData(synchro);
XBT_DEBUG("Create io synchro %p", synchro);
smx_activity_t SIMIX_file_close(surf_file_t file, sg_host_t host)
{
if (host->isOff())
- THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname());
+ THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname());
simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
synchro->host = host;
comm->surf_comm->setData(comm.get());
comm->state = SIMIX_RUNNING;
- XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->cname(),
- receiver->cname(), comm->surf_comm);
+ XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->getCname(),
+ receiver->getCname(), comm->surf_comm);
/* If a link is failed, detect it immediately */
if (comm->surf_comm->getState() == simgrid::surf::Action::State::failed) {
- XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->cname(),
- receiver->cname());
+ XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->getCname(),
+ receiver->getCname());
comm->state = SIMIX_LINK_FAILURE;
comm->cleanupSurf();
}
if (comm->src_proc->isSuspended())
XBT_DEBUG("The communication is suspended on startup because src (%s@%s) was suspended since it initiated the "
"communication",
- comm->src_proc->cname(), comm->src_proc->host->cname());
+ comm->src_proc->cname(), comm->src_proc->host->getCname());
else
XBT_DEBUG("The communication is suspended on startup because dst (%s@%s) was suspended since it initiated the "
"communication",
- comm->dst_proc->cname(), comm->dst_proc->host->cname());
+ comm->dst_proc->cname(), comm->dst_proc->host->getCname());
comm->surf_comm->suspend();
}
case SIMIX_LINK_FAILURE:
XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) "
"detached:%d",
- synchro.get(), comm->src_proc ? comm->src_proc->host->cname() : nullptr,
- comm->dst_proc ? comm->dst_proc->host->cname() : nullptr, simcall->issuer->cname(), simcall->issuer,
- comm->detached);
+ synchro.get(), comm->src_proc ? comm->src_proc->host->getCname() : nullptr,
+ comm->dst_proc ? comm->dst_proc->host->getCname() : nullptr, simcall->issuer->cname(),
+ simcall->issuer, comm->detached);
if (comm->src_proc == simcall->issuer) {
XBT_DEBUG("I'm source");
} else if (comm->dst_proc == simcall->issuer) {
return;
XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", comm.get(),
- comm->src_proc ? comm->src_proc->host->cname() : "a finished process", comm->src_buff,
- comm->dst_proc ? comm->dst_proc->host->cname() : "a finished process", comm->dst_buff, buff_size);
+ comm->src_proc ? comm->src_proc->host->getCname() : "a finished process", comm->src_buff,
+ comm->dst_proc ? comm->dst_proc->host->getCname() : "a finished process", comm->dst_buff, buff_size);
/* Copy at most dst_buff_size bytes of the message to receiver's buffer */
if (comm->dst_buff_size)
if (not SmpiHost::EXTENSION_ID.valid())
SmpiHost::EXTENSION_ID = simgrid::s4u::Host::extension_create<SmpiHost>();
- const char* orecv_string = host->property("smpi/or");
+ const char* orecv_string = host->getProperty("smpi/or");
if (orecv_string != nullptr) {
orecv_parsed_values = parse_factor(orecv_string);
} else {
orecv_parsed_values = parse_factor(xbt_cfg_get_string("smpi/or"));
}
- const char* osend_string = host->property("smpi/os");
+ const char* osend_string = host->getProperty("smpi/os");
if (osend_string != nullptr) {
osend_parsed_values = parse_factor(osend_string);
} else {
osend_parsed_values = parse_factor(xbt_cfg_get_string("smpi/os"));
}
- const char* oisend_string = host->property("smpi/ois");
+ const char* oisend_string = host->getProperty("smpi/ois");
if (oisend_string != nullptr) {
oisend_parsed_values = parse_factor(oisend_string);
} else {
*/
double smpi_get_host_current_power_peak()
{
- return sg_host_self()->speed();
+ return sg_host_self()->getSpeed();
}
/**
int PMPI_Get_processor_name(char *name, int *resultlen)
{
- strncpy(name, sg_host_self()->cname(), strlen(sg_host_self()->cname()) < MPI_MAX_PROCESSOR_NAME - 1
- ? strlen(sg_host_self()->cname()) + 1
- : MPI_MAX_PROCESSOR_NAME - 1);
+ strncpy(name, sg_host_self()->getCname(), strlen(sg_host_self()->getCname()) < MPI_MAX_PROCESSOR_NAME - 1
+ ? strlen(sg_host_self()->getCname()) + 1
+ : MPI_MAX_PROCESSOR_NAME - 1);
*resultlen = strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
return MPI_SUCCESS;
if (detached_ != 0 || ((flags_ & (ISEND | SSEND)) != 0)) { // issend should be treated as isend
// isend and send timings may be different
sleeptime = ((flags_ & ISEND) != 0)
- ? simgrid::s4u::Actor::self()->host()->extension<simgrid::smpi::SmpiHost>()->oisend(size_)
- : simgrid::s4u::Actor::self()->host()->extension<simgrid::smpi::SmpiHost>()->osend(size_);
+ ? simgrid::s4u::Actor::self()->getHost()->extension<simgrid::smpi::SmpiHost>()->oisend(size_)
+ : simgrid::s4u::Actor::self()->getHost()->extension<simgrid::smpi::SmpiHost>()->osend(size_);
}
if(sleeptime > 0.0){
// nsleeps is a multiplier to the sleeptime, to increase speed of execution, each failed iprobe will increase it
// This can speed up the execution of certain applications by an order of magnitude, such as HPL
static int nsleeps = 1;
- double speed = simgrid::s4u::Actor::self()->host()->speed();
+ double speed = simgrid::s4u::Actor::self()->getHost()->getSpeed();
double maxrate = xbt_cfg_get_double("smpi/iprobe-cpu-usage");
MPI_Request request = new Request(nullptr, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
comm->group()->index(source), comm->rank(), tag, comm, PERSISTENT | RECV);
}
if(req->detached_sender_ != nullptr){
//integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
- double sleeptime = simgrid::s4u::Actor::self()->host()->extension<simgrid::smpi::SmpiHost>()->orecv(req->real_size());
+ double sleeptime =
+ simgrid::s4u::Actor::self()->getHost()->extension<simgrid::smpi::SmpiHost>()->orecv(req->real_size());
if(sleeptime > 0.0){
simcall_process_sleep(sleeptime);
XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime);
simgrid::surf::StorageImpl* HostImpl::findStorageOnMountList(const char* mount)
{
- XBT_DEBUG("Search for storage name '%s' on '%s'", mount, piface_->cname());
+ XBT_DEBUG("Search for storage name '%s' on '%s'", mount, piface_->getCname());
if (storage_.find(mount) == storage_.end())
- xbt_die("Can't find mount '%s' for '%s'", mount, piface_->cname());
+ xbt_die("Can't find mount '%s' for '%s'", mount, piface_->getCname());
return storage_.at(mount);
}
void HostImpl::getAttachedStorageList(std::vector<const char*>* storages)
{
for (auto s : storage_)
- if (s.second->attach_ == piface_->cname())
- storages->push_back(s.second->piface_.name());
+ if (s.second->attach_ == piface_->getCname())
+ storages->push_back(s.second->piface_.getName());
}
Action* HostImpl::close(surf_file_t fd)
Cpu::Cpu(Model* model, simgrid::s4u::Host* host, lmm_constraint_t constraint, std::vector<double>* speedPerPstate,
int core)
- : Resource(model, host->cname(), constraint), coresAmount_(core), host_(host)
+ : Resource(model, host->getCname(), constraint), coresAmount_(core), host_(host)
{
- xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->cname());
+ xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->getCname());
speed_.peak = speedPerPstate->front();
speed_.scale = 1;
host->pimpl_cpu = this;
- xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->cname());
+ xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->getCname());
// Copy the power peak array:
for (double value : *speedPerPstate) {
void Cpu::setStateTrace(tmgr_trace_t trace)
{
- xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Host %s", host_->cname());
+ xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Host %s", host_->getCname());
stateEvent_ = future_evt_set->add_trace(trace, this);
}
void Cpu::setSpeedTrace(tmgr_trace_t trace)
{
- xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->cname());
+ xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->getCname());
speed_.event = future_evt_set->add_trace(trace, this);
}
XBT_DEBUG("Graph extraction disabled by user.");
return;
}
- XBT_DEBUG("Graph extraction for NetZone = %s", netzone->name());
- if (not netzone->children()->empty()) {
+ XBT_DEBUG("Graph extraction for NetZone = %s", netzone->getCname());
+ if (not netzone->getChildren()->empty()) {
//bottom-up recursion
- for (auto nz_son : *netzone->children()) {
- container_t child_container = static_cast<container_t>(xbt_dict_get(container->children, nz_son->name()));
+ for (auto nz_son : *netzone->getChildren()) {
+ container_t child_container = static_cast<container_t>(xbt_dict_get(container->children, nz_son->getCname()));
recursiveGraphExtraction(nz_son, child_container, filter);
}
}
*/
static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone)
{
- const char* id = netzone.name();
+ const char* id = netzone.getCname();
if (PJ_container_get_root() == nullptr){
PJ_container_alloc ();
static void sg_instr_new_host(simgrid::s4u::Host& host)
{
container_t father = currentContainer.back();
- container_t container = PJ_container_new(host.cname(), INSTR_HOST, father);
+ container_t container = PJ_container_new(host.getCname(), INSTR_HOST, father);
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_speed())) {
type_t speed = PJ_type_get_or_null ("power", container->type);
speed = PJ_type_variable_new ("power", nullptr, container->type);
}
- double current_speed_state = host.speed();
+ double current_speed_state = host.getSpeed();
new SetVariableEvent (0, container, speed, current_speed_state);
}
if (TRACE_uncategorized()){
currentContainer.clear();
xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free_f);
XBT_DEBUG ("Starting graph extraction.");
- recursiveGraphExtraction(simgrid::s4u::Engine::instance()->netRoot(), PJ_container_get_root(), filter);
+ recursiveGraphExtraction(simgrid::s4u::Engine::getInstance()->getNetRoot(), PJ_container_get_root(), filter);
XBT_DEBUG ("Graph extraction finished.");
xbt_dict_free(&filter);
platform_created = 1;
static void recursiveXBTGraphExtraction(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges, sg_netzone_t netzone,
container_t container)
{
- if (not netzone->children()->empty()) {
+ if (not netzone->getChildren()->empty()) {
//bottom-up recursion
- for (auto netzone_child : *netzone->children()) {
- container_t child_container = static_cast<container_t>(xbt_dict_get(container->children, netzone_child->name()));
+ for (auto netzone_child : *netzone->getChildren()) {
+ container_t child_container =
+ static_cast<container_t>(xbt_dict_get(container->children, netzone_child->getCname()));
recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);
}
}
xbt_graph_t ret = xbt_graph_new_graph (0, nullptr);
xbt_dict_t nodes = xbt_dict_new_homogeneous(nullptr);
xbt_dict_t edges = xbt_dict_new_homogeneous(nullptr);
- recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::instance()->netRoot(), PJ_container_get_root());
+ recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::getInstance()->getNetRoot(),
+ PJ_container_get_root());
xbt_dict_free (&nodes);
xbt_dict_free (&edges);
return ret;
std::vector<LinkImpl*>* back_route = nullptr;
std::vector<LinkImpl*>* route = new std::vector<LinkImpl*>();
- XBT_IN("(%s,%s,%g,%g)", src->cname(), dst->cname(), size, rate);
+ XBT_IN("(%s,%s,%g,%g)", src->getCname(), dst->getCname(), size, rate);
src->routeTo(dst, route, &latency);
xbt_assert(not route->empty() || latency,
"You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
- src->cname(), dst->cname());
+ src->getCname(), dst->getCname());
for (auto link: *route)
if (link->isOff())
"Using a model with a gap (e.g., SMPI) with a platform without links (e.g. vivaldi)!!!");
gapAppend(size, route->at(0), action);
- XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->cname(), dst->cname(), action->senderGap_,
+ XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->getCname(), dst->getCname(), action->senderGap_,
action->latency_);
}
IBNode* act = new IBNode(id);
id++;
- xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes, host.cname(), act, nullptr);
+ xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes, host.getCname(), act, nullptr);
}
static void IB_action_state_changed_callback(simgrid::surf::NetworkAction* action)
{
simgrid::surf::NetworkIBModel* ibModel = (simgrid::surf::NetworkIBModel*)surf_network_model;
- simgrid::surf::IBNode* act_src = (simgrid::surf::IBNode*)xbt_dict_get_or_null(ibModel->active_nodes, src->cname());
+ simgrid::surf::IBNode* act_src = (simgrid::surf::IBNode*)xbt_dict_get_or_null(ibModel->active_nodes, src->getCname());
xbt_assert(act_src, "could not find src node active comms !");
- simgrid::surf::IBNode* act_dst = (simgrid::surf::IBNode*)xbt_dict_get_or_null(ibModel->active_nodes, dst->cname());
+ simgrid::surf::IBNode* act_dst = (simgrid::surf::IBNode*)xbt_dict_get_or_null(ibModel->active_nodes, dst->getCname());
xbt_assert(act_dst, "could not find dst node active comms !");
ibModel->active_comms[action]=std::make_pair(act_src, act_dst);
NetworkNS3Action::NetworkNS3Action(Model* model, double size, s4u::Host* src, s4u::Host* dst)
: NetworkAction(model, size, false)
{
- XBT_DEBUG("Communicate from %s to %s", src->cname(), dst->cname());
+ XBT_DEBUG("Communicate from %s to %s", src->getCname(), dst->getCname());
src_ = src;
dst_ = dst;
{
double start_time = this->last_updated;
double finish_time = surf_get_clock();
- double current_speed = host->speed();
+ double current_speed = host->getSpeed();
if (start_time < finish_time) {
double cpu_load;
XBT_DEBUG("[update_energy of %s] period=[%.2f-%.2f]; current power peak=%.0E flop/s; consumption change: %.2f J -> "
"%.2f J",
- host->cname(), start_time, finish_time, host->pimpl_cpu->speed_.peak, previous_energy, energy_this_step);
+ host->getCname(), start_time, finish_time, host->pimpl_cpu->speed_.peak, previous_energy,
+ energy_this_step);
}
/* Save data for the upcoming time interval: whether it's on/off and the pstate if it's on */
- this->pstate = host->isOn() ? host->pstate() : -1;
+ this->pstate = host->isOn() ? host->getPstate() : -1;
}
HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host(ptr), last_updated(surf_get_clock())
{
initWattsRangeList();
- const char* off_power_str = host->property("watt_off");
+ const char* off_power_str = host->getProperty("watt_off");
if (off_power_str != nullptr) {
- char* msg = bprintf("Invalid value for property watt_off of host %s: %%s", host->cname());
+ char* msg = bprintf("Invalid value for property watt_off of host %s: %%s", host->getCname());
this->watts_off = xbt_str_parse_double(off_power_str, msg);
xbt_free(msg);
}
double HostEnergy::getWattMinAt(int pstate)
{
- xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
+ xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->getCname());
return power_range_watts_list[pstate].min;
}
double HostEnergy::getWattMaxAt(int pstate)
{
- xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
+ xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->getCname());
return power_range_watts_list[pstate].max;
}
/** @brief Computes the power consumed by the host according to the current pstate and processor load */
double HostEnergy::getCurrentWattsValue(double cpu_load)
{
- xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
+ xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->getCname());
/* min_power corresponds to the power consumed when only one core is active */
/* max_power is the power consumed at 100% cpu load */
* (maxCpuLoad is by definition 1)
*/
double power_slope;
- int coreCount = host->coreCount();
+ int coreCount = host->getCoreCount();
double coreReciprocal = static_cast<double>(1) / static_cast<double>(coreCount);
if (coreCount > 1)
power_slope = (max_power - min_power) / (1 - coreReciprocal);
void HostEnergy::initWattsRangeList()
{
- const char* all_power_values_str = host->property("watt_per_state");
+ const char* all_power_values_str = host->getProperty("watt_per_state");
if (all_power_values_str == nullptr)
return;
std::vector<std::string> all_power_values;
boost::split(all_power_values, all_power_values_str, boost::is_any_of(","));
- XBT_DEBUG("%s: profile: %s, cores: %d", host->cname(), all_power_values_str, host->coreCount());
+ XBT_DEBUG("%s: profile: %s, cores: %d", host->getCname(), all_power_values_str, host->getCoreCount());
int i = 0;
for (auto current_power_values_str : all_power_values) {
/* retrieve the power values associated with the current pstate */
std::vector<std::string> current_power_values;
boost::split(current_power_values, current_power_values_str, boost::is_any_of(":"));
- if (host->coreCount() == 1) {
+ if (host->getCoreCount() == 1) {
xbt_assert(current_power_values.size() == 2 || current_power_values.size() == 3,
"Power properties incorrectly defined for host %s."
"It should be 'Idle:FullSpeed' power values because you have one core only.",
- host->cname());
+ host->getCname());
if (current_power_values.size() == 2) {
// In this case, 1core == AllCores
current_power_values.push_back(current_power_values.at(1));
"The energy profile of mono-cores should be formated as 'Idle:FullSpeed' only.\n"
"If you go for a 'Idle:OneCore:AllCores' power profile on mono-cores, then OneCore and AllCores "
"must be equal.",
- host->cname());
+ host->getCname());
}
} else {
xbt_assert(current_power_values.size() == 3,
"Power properties incorrectly defined for host %s."
"It should be 'Idle:OneCore:AllCores' power values because you have more than one core.",
- host->cname());
+ host->getCname());
}
/* min_power corresponds to the idle power (cpu load = 0) */
/* max_power is the power consumed at 100% cpu load */
- char* msg_idle = bprintf("Invalid idle value for pstate %d on host %s: %%s", i, host->cname());
- char* msg_min = bprintf("Invalid OneCore value for pstate %d on host %s: %%s", i, host->cname());
- char* msg_max = bprintf("Invalid AllCores value for pstate %d on host %s: %%s", i, host->cname());
+ char* msg_idle = bprintf("Invalid idle value for pstate %d on host %s: %%s", i, host->getCname());
+ char* msg_min = bprintf("Invalid OneCore value for pstate %d on host %s: %%s", i, host->getCname());
+ char* msg_max = bprintf("Invalid AllCores value for pstate %d on host %s: %%s", i, host->getCname());
PowerRange range(xbt_str_parse_double((current_power_values.at(0)).c_str(), msg_idle),
xbt_str_parse_double((current_power_values.at(1)).c_str(), msg_min),
xbt_str_parse_double((current_power_values.at(2)).c_str(), msg_max));
HostEnergy* host_energy = host.extension<HostEnergy>();
host_energy->update();
- XBT_INFO("Energy consumption of host %s: %f Joules", host.cname(), host_energy->getConsumedEnergy());
+ XBT_INFO("Energy consumption of host %s: %f Joules", host.getCname(), host_energy->getConsumedEnergy());
}
static void onSimulationEnd()
{
simgrid::simix::kernelImmediate([]() {
std::vector<simgrid::s4u::Host*> list;
- simgrid::s4u::Engine::instance()->hostList(&list);
+ simgrid::s4u::Engine::getInstance()->getHostList(&list);
for (auto host : list)
if (dynamic_cast<simgrid::s4u::VirtualMachine*>(host) == nullptr) // Ignore virtual machines
host->extension<HostEnergy>()->update();
{
xbt_assert(HostEnergy::EXTENSION_ID.valid(),
"The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
- double cpu_load = lmm_constraint_get_usage(host->pimpl_cpu->constraint()) / host->speed();
+ double cpu_load = lmm_constraint_get_usage(host->pimpl_cpu->constraint()) / host->getSpeed();
return host->extension<HostEnergy>()->getCurrentWattsValue(cpu_load);
}
double HostLoad::getCurrentLoad()
{
- return current_flops / (host->speed() * host->coreCount());
+ return current_flops / (host->getSpeed() * host->getCoreCount());
}
double HostLoad::getAverageLoad()
{
- return getComputedFlops() / (host->speed() * host->coreCount() * (surf_get_clock() - last_reset));
+ return getComputedFlops() / (host->getSpeed() * host->getCoreCount() * (surf_get_clock() - last_reset));
}
double HostLoad::getComputedFlops()
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
- xbt_assert(nullptr == simgrid::s4u::Engine::instance()->netpointByNameOrNull(name),
+ xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name),
"Refusing to create a router named '%s': this name already describes a node.", name);
simgrid::kernel::routing::NetPoint* netpoint =
dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
xbt_assert(cluster, "Only hosts from Cluster can get a backbone.");
- xbt_assert(nullptr == cluster->backbone_, "Cluster %s already has a backbone link!", cluster->name());
+ xbt_assert(nullptr == cluster->backbone_, "Cluster %s already has a backbone link!", cluster->getCname());
cluster->backbone_ = bb;
- XBT_DEBUG("Add a backbone to AS '%s'", current_routing->name());
+ XBT_DEBUG("Add a backbone to AS '%s'", current_routing->getCname());
}
void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet)
"' does not exist\nExisting hosts: '";
for (auto kv : simgrid::s4u::host_list) {
simgrid::s4u::Host* host = kv.second;
- msg += host->name();
+ msg += host->getName();
msg += "', '";
if (msg.length() > 1024) {
msg.pop_back(); // remove trailing quote
arg->kill_time = kill_time;
arg->properties = current_property_set;
- XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->cname(), start_time);
+ XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->getCname(), start_time);
SIMIX_timer_set(start_time, [arg, auto_restart]() {
smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), std::move(arg->code), arg->data,
arg->host, arg->properties, nullptr);
delete arg;
});
} else { // start_time <= SIMIX_get_clock()
- XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->cname());
+ XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->getCname());
smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), std::move(code), nullptr, host,
current_property_set, nullptr);
}
if (current_routing == nullptr) { /* it is the first one */
- xbt_assert(simgrid::s4u::Engine::instance()->pimpl->netRoot_ == nullptr,
+ xbt_assert(simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ == nullptr,
"All defined components must belong to a networking zone.");
- simgrid::s4u::Engine::instance()->pimpl->netRoot_ = new_as;
+ simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ = new_as;
} else {
/* set the father behavior */
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::recursive;
/* add to the sons dictionary */
- current_routing->children()->push_back(static_cast<simgrid::s4u::NetZone*>(new_as));
+ current_routing->getChildren()->push_back(static_cast<simgrid::s4u::NetZone*>(new_as));
}
/* set the new current component of the tree */
xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
current_routing->seal();
simgrid::s4u::NetZone::onSeal(*current_routing);
- current_routing = static_cast<simgrid::kernel::routing::NetZoneImpl*>(current_routing->father());
+ current_routing = static_cast<simgrid::kernel::routing::NetZoneImpl*>(current_routing->getFather());
}
/** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
msg += " Existing netpoints: \n";
std::vector<simgrid::kernel::routing::NetPoint*> list;
- simgrid::s4u::Engine::instance()->netpointList(&list);
+ simgrid::s4u::Engine::getInstance()->getNetpointList(&list);
std::sort(list.begin(), list.end(),
[](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
return a->name() < b->name();
{
if (ZONE_TAG) { // We need to retrieve the most recently opened zone
XBT_DEBUG("Set zone property %s -> %s", A_surfxml_prop_id, A_surfxml_prop_value);
- simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::instance()->netzoneByNameOrNull(A_surfxml_zone_id);
+ simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(A_surfxml_zone_id);
netzone->setProperty(A_surfxml_prop_id, A_surfxml_prop_value);
}
static void worker()
{
simgrid::s4u::this_actor::sleep_for(.5);
- XBT_INFO("Worker started (PID:%lu, PPID:%lu)", simgrid::s4u::this_actor::pid(), simgrid::s4u::this_actor::ppid());
+ XBT_INFO("Worker started (PID:%lu, PPID:%lu)", simgrid::s4u::this_actor::getPid(),
+ simgrid::s4u::this_actor::getPpid());
while (1) {
XBT_INFO("Plop i am %ssuspended", simgrid::s4u::this_actor::isSuspended() ? "" : "not ");
simgrid::s4u::this_actor::sleep_for(1);
{
simgrid::s4u::this_actor::sleep_for(1);
std::vector<simgrid::s4u::ActorPtr>* actor_list = new std::vector<simgrid::s4u::ActorPtr>();
- simgrid::s4u::this_actor::host()->actorList(actor_list);
+ simgrid::s4u::this_actor::getHost()->actorList(actor_list);
for (auto actor : *actor_list) {
- XBT_INFO("Actor (pid=%lu, ppid=%lu, name=%s)", actor->pid(), actor->ppid(), actor->name().c_str());
- if (simgrid::s4u::this_actor::pid() != actor->pid())
+ XBT_INFO("Actor (pid=%lu, ppid=%lu, name=%s)", actor->getPid(), actor->getPpid(), actor->getName().c_str());
+ if (simgrid::s4u::this_actor::getPid() != actor->getPid())
actor->kill();
}
simgrid::s4u::ActorPtr actor =
- simgrid::s4u::Actor::createActor("worker from master", simgrid::s4u::this_actor::host(), worker);
+ simgrid::s4u::Actor::createActor("worker from master", simgrid::s4u::this_actor::getHost(), worker);
simgrid::s4u::this_actor::sleep_for(2);
- XBT_INFO("Suspend Actor (pid=%lu)", actor->pid());
+ XBT_INFO("Suspend Actor (pid=%lu)", actor->getPid());
actor->suspend();
- XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->pid(), actor->isSuspended() ? "" : "not ");
+ XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
simgrid::s4u::this_actor::sleep_for(2);
- XBT_INFO("Resume Actor (pid=%lu)", actor->pid());
+ XBT_INFO("Resume Actor (pid=%lu)", actor->getPid());
actor->resume();
- XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->pid(), actor->isSuspended() ? "" : "not ");
+ XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
simgrid::s4u::this_actor::sleep_for(2);
actor->kill();
static void host()
{
char name[2048];
- int id = simgrid::s4u::this_actor::pid();
+ int id = simgrid::s4u::this_actor::getPid();
snprintf(name, 2048, "%s%i", FILENAME1, id);
simgrid::s4u::File* file = new simgrid::s4u::File(name, NULL);
XBT_INFO("process %d is writing!", id);
static void sendpid()
{
simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox");
- int pid = simgrid::s4u::this_actor::pid();
+ int pid = simgrid::s4u::this_actor::getPid();
double comm_size = 100000;
simgrid::s4u::this_actor::onExit((int_f_pvoid_pvoid_t)my_onexit, &pid);
static void display_storage_properties(simgrid::s4u::Storage* storage)
{
- xbt_dict_t props = storage->properties();
+ xbt_dict_t props = storage->getProperties();
if (xbt_dict_length(props) > 0) {
- XBT_INFO("\tProperties of mounted storage: %s", storage->name());
+ XBT_INFO("\tProperties of mounted storage: %s", storage->getName());
xbt_dict_cursor_t cursor = NULL;
char* key;
simgrid::s4u::File* file = new simgrid::s4u::File(dest, nullptr);
sg_size_t written = file->write(file_size);
XBT_INFO("%llu bytes on %llu bytes have been written by %s on /sd1", written, file_size,
- simgrid::s4u::Actor::self()->name().c_str());
+ simgrid::s4u::Actor::self()->getName().c_str());
delete file;
return written;
}
sg_size_t file_size = file->size();
sg_size_t read = file->read(file_size);
- XBT_INFO("%s has read %llu on %s", simgrid::s4u::Actor::self()->name().c_str(), read, src);
+ XBT_INFO("%s has read %llu on %s", simgrid::s4u::Actor::self()->getName().c_str(), read, src);
delete file;
return read;
sg_size_t read_size = read_local_file(src);
// Send file
- XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::name().c_str(), read_size, remote_host);
+ XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::getName().c_str(), read_size, remote_host);
char* payload = bprintf("%s %llu", dest, read_size);
simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(remote_host);
mailbox->put(payload, static_cast<double>(read_size));
static void display_storage_content(simgrid::s4u::Storage* storage)
{
- XBT_INFO("Print the content of the storage element: %s", storage->name());
- std::map<std::string, sg_size_t>* content = storage->content();
+ XBT_INFO("Print the content of the storage element: %s", storage->getName());
+ std::map<std::string, sg_size_t>* content = storage->getContent();
if (not content->empty()) {
for (auto entry : *content)
XBT_INFO("\t%s size: %llu bytes", entry.first.c_str(), entry.second);
XBT_INFO("*** GET/SET DATA for storage element: %s ***", storage_name);
simgrid::s4u::Storage* storage = simgrid::s4u::Storage::byName(storage_name);
- char* data = static_cast<char*>(storage->userdata());
+ char* data = static_cast<char*>(storage->getUserdata());
XBT_INFO("Get data: '%s'", data);
storage->setUserdata(xbt_strdup("Some data"));
- data = static_cast<char*>(storage->userdata());
+ data = static_cast<char*>(storage->getUserdata());
XBT_INFO("\tSet and get data: '%s'", data);
xbt_free(data);
}
std::map<std::string, simgrid::s4u::Storage*>* storages = simgrid::s4u::allStorages();
for (auto storage : *storages) {
- XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->host()->cname());
+ XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->getHost()->getCname());
storage.second->setProperty("other usage", xbt_strdup("gpfs"));
}
delete storages;
static void storage_info(simgrid::s4u::Host* host)
{
- XBT_INFO("*** Storage info on %s ***", host->cname());
+ XBT_INFO("*** Storage info on %s ***", host->getCname());
- for (auto elm : host->mountedStorages()) {
+ for (auto elm : host->getMountedStorages()) {
const char* mount_name = elm.first.c_str();
simgrid::s4u::Storage* storage = elm.second;
- XBT_INFO("\tStorage name: %s, mount name: %s", storage->name(), mount_name);
+ XBT_INFO("\tStorage name: %s, mount name: %s", storage->getName(), mount_name);
- sg_size_t free_size = storage->sizeFree();
- sg_size_t used_size = storage->sizeUsed();
+ sg_size_t free_size = storage->getSizeFree();
+ sg_size_t used_size = storage->getSizeUsed();
XBT_INFO("\t\tFree size: %llu bytes", free_size);
XBT_INFO("\t\tUsed size: %llu bytes", used_size);
display_storage_properties(storage);
- dump_storage_by_name(storage->name());
+ dump_storage_by_name(storage->getName());
}
}
static void server()
{
- storage_info(simgrid::s4u::this_actor::host());
- simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::host()->cname());
+ storage_info(simgrid::s4u::this_actor::getHost());
+ simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getCname());
XBT_INFO("Server waiting for transfers ...");
while (1) {
}
}
- storage_info(simgrid::s4u::this_actor::host());
+ storage_info(simgrid::s4u::this_actor::getHost());
dump_platform_storages();
}
std::qsort((void*)hosts, totalHosts, sizeof(sg_host_t), name_compare_hosts);
for (unsigned int i = 0; i < totalHosts; i++) {
- std::printf(" <host id=\"%s\" speed=\"%.0f\"", hosts[i]->cname(), sg_host_speed(hosts[i]));
+ std::printf(" <host id=\"%s\" speed=\"%.0f\"", hosts[i]->getCname(), sg_host_speed(hosts[i]));
props = sg_host_get_properties(hosts[i]);
- if (hosts[i]->coreCount() > 1) {
- std::printf(" core=\"%d\"", hosts[i]->coreCount());
+ if (hosts[i]->getCoreCount() > 1) {
+ std::printf(" core=\"%d\"", hosts[i]->getCoreCount());
}
if (props && not xbt_dict_is_empty(props)) {
std::printf(">\n");
// Routers
std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
- simgrid::s4u::Engine::instance()->netpointList(&netcardList);
+ simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
std::sort(netcardList.begin(), netcardList.end(),
[](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
return a->name() < b->name();
simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
if (not route.empty()) {
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->cname(), host2->cname());
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->getCname(), host2->getCname());
for (auto link : route)
std::printf("<link_ctn id=\"%s\"/>", link->cname());
std::printf("\n </route>\n");
}
for (auto netcardDst : netcardList) { // to router
if (netcardDst->isRouter()) {
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->cname(), netcardDst->cname());
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->getCname(), netcardDst->cname());
std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
for (auto link : route)
}
for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
simgrid::s4u::Host* host2 = hosts[it_dst];
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->cname(), host2->cname());
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->cname(), host2->getCname());
std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, &route, nullptr);
std::printf("Host count: %zu, link number: %d\n", sg_host_count(), sg_link_count());
std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
- simgrid::s4u::Engine::instance()->netpointList(&netcardList);
+ simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
std::sort(netcardList.begin(), netcardList.end(),
[](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
return a->name() < b->name();
type = "netzone";
if (nc->isHost())
type = "host";
- std::printf(" - Seen: \"%s\". Type: %s\n", host->cname(), type);
+ std::printf(" - Seen: \"%s\". Type: %s\n", host->getCname(), type);
}
xbt_dynar_free(&hosts);