From: Martin Quinson Date: Tue, 22 Nov 2016 23:24:20 +0000 (+0100) Subject: move VM into their namespace, and greatly reduce the amount of sg_host_get_name ... X-Git-Tag: v3_14~143 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d22f65624615098a556403243579dd7c4ceb69dd move VM into their namespace, and greatly reduce the amount of sg_host_get_name (prefer C++) --- diff --git a/examples/msg/platform-failures/platform-failures.tesh b/examples/msg/platform-failures/platform-failures.tesh index bfa2aa4dec..7cc23e675d 100644 --- a/examples/msg/platform-failures/platform-failures.tesh +++ b/examples/msg/platform-failures/platform-failures.tesh @@ -10,10 +10,10 @@ $ $SG_TEST_EXENV ${bindir:=.}/platform-failures$EXEEXT --log=xbt_cfg.thres:criti > [ 0.010309] (2:worker@Tremblay) Received "Task" > [ 0.010309] (2:worker@Tremblay) Communication time : "0.010309" > [ 0.010309] (2:worker@Tremblay) Processing "Task" -> [ 1.000000] (0:maestro@) Restart processes on host: Fafard +> [ 1.000000] (0:maestro@) Restart processes on host Fafard > [ 1.000000] (1:master@Tremblay) Mmh. Something went wrong with 'worker-1'. Nevermind. Let's keep going! > [ 1.000000] (3:worker@Jupiter) Gloups. The cpu on which I'm running just turned off!. See you! -> [ 2.000000] (0:maestro@) Restart processes on host: Jupiter +> [ 2.000000] (0:maestro@) Restart processes on host Jupiter > [ 2.010309] (2:worker@Tremblay) "Task" done > [ 11.000000] (1:master@Tremblay) Mmh. Got timeouted while speaking to 'worker-2'. Nevermind. Let's keep going! > [ 12.030928] (1:master@Tremblay) Send completed @@ -105,10 +105,10 @@ $ $SG_TEST_EXENV ${bindir:=.}/platform-failures$EXEEXT --log=xbt_cfg.thres:criti > [ 0.010825] (2:worker@Tremblay) Received "Task" > [ 0.010825] (2:worker@Tremblay) Communication time : "0.010825" > [ 0.010825] (2:worker@Tremblay) Processing "Task" -> [ 1.000000] (0:maestro@) Restart processes on host: Fafard +> [ 1.000000] (0:maestro@) Restart processes on host Fafard > [ 1.000000] (1:master@Tremblay) Mmh. Something went wrong with 'worker-1'. Nevermind. Let's keep going! > [ 1.000000] (3:worker@Jupiter) Gloups. The cpu on which I'm running just turned off!. See you! -> [ 2.000000] (0:maestro@) Restart processes on host: Jupiter +> [ 2.000000] (0:maestro@) Restart processes on host Jupiter > [ 2.010825] (2:worker@Tremblay) "Task" done > [ 11.000000] (1:master@Tremblay) Mmh. Got timeouted while speaking to 'worker-2'. Nevermind. Let's keep going! > [ 12.082474] (1:master@Tremblay) Send completed @@ -200,10 +200,10 @@ $ $SG_TEST_EXENV ${bindir:=.}/platform-failures$EXEEXT --log=xbt_cfg.thres:criti > [ 0.010825] (2:worker@Tremblay) Received "Task" > [ 0.010825] (2:worker@Tremblay) Communication time : "0.010825" > [ 0.010825] (2:worker@Tremblay) Processing "Task" -> [ 1.000000] (0:maestro@) Restart processes on host: Fafard +> [ 1.000000] (0:maestro@) Restart processes on host Fafard > [ 1.000000] (1:master@Tremblay) Mmh. Something went wrong with 'worker-1'. Nevermind. Let's keep going! > [ 1.000000] (3:worker@Jupiter) Gloups. The cpu on which I'm running just turned off!. See you! -> [ 2.000000] (0:maestro@) Restart processes on host: Jupiter +> [ 2.000000] (0:maestro@) Restart processes on host Jupiter > [ 2.010825] (2:worker@Tremblay) "Task" done > [ 11.000000] (1:master@Tremblay) Mmh. Got timeouted while speaking to 'worker-2'. Nevermind. Let's keep going! > [ 12.082474] (1:master@Tremblay) Send completed diff --git a/include/simgrid/s4u/VirtualMachine.hpp b/include/simgrid/s4u/VirtualMachine.hpp index b603af48e1..de3ecc0fdf 100644 --- a/include/simgrid/s4u/VirtualMachine.hpp +++ b/include/simgrid/s4u/VirtualMachine.hpp @@ -21,7 +21,7 @@ typedef enum { } e_surf_vm_state_t; namespace simgrid { -namespace surf { +namespace vm { class VirtualMachineImpl; }; namespace s4u { @@ -55,7 +55,7 @@ public: double getRamsize(); /* FIXME: protect me */ - simgrid::surf::VirtualMachineImpl* pimpl_vm_ = nullptr; + simgrid::vm::VirtualMachineImpl* pimpl_vm_ = nullptr; }; } } // namespace simgrid::s4u diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index 7598c39ee1..0bb97c3120 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -303,7 +303,7 @@ static int java_main(int argc, char *argv[]) for (int i = 1; i < argc; i++) env->SetObjectArrayElement(args,i - 1, env->NewStringUTF(argv[i])); //Retrieve the host for the process. - jstring jhostName = env->NewStringUTF(MSG_host_get_name(MSG_host_self())); + jstring jhostName = env->NewStringUTF(MSG_host_self()->cname()); jobject jhost = Java_org_simgrid_msg_Host_getByName(env, nullptr, jhostName); //creates the process jobject jprocess = env->NewObject(class_Process, constructor_Process, jhost, jname, args); diff --git a/src/bindings/java/jmsg_as.cpp b/src/bindings/java/jmsg_as.cpp index cd18404d41..ea4134969c 100644 --- a/src/bindings/java/jmsg_as.cpp +++ b/src/bindings/java/jmsg_as.cpp @@ -153,7 +153,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo jhost = static_cast(host->extension(JAVA_HOST_LEVEL)); if (!jhost) { - jname = env->NewStringUTF(MSG_host_get_name(host)); + jname = env->NewStringUTF(host->cname()); jhost = Java_org_simgrid_msg_Host_getByName(env, cls, jname); diff --git a/src/bindings/java/jmsg_host.cpp b/src/bindings/java/jmsg_host.cpp index 9e16cc0218..85ad9cbbe3 100644 --- a/src/bindings/java/jmsg_host.cpp +++ b/src/bindings/java/jmsg_host.cpp @@ -50,7 +50,7 @@ msg_host_t jhost_get_native(JNIEnv * env, jobject jhost) { const char *jhost_get_name(jobject jhost, JNIEnv * env) { msg_host_t host = jhost_get_native(env, jhost); - return MSG_host_get_name(host); + return host->cname(); } jboolean jhost_is_valid(jobject jhost, JNIEnv * env) { @@ -144,8 +144,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost(JNIEnv * env, jc return nullptr; } /* Sets the host name */ - const char *name = MSG_host_get_name(host); - jobject jname = env->NewStringUTF(name); + jobject jname = env->NewStringUTF(host->cname()); env->SetObjectField(jhost, jhost_field_Host_name, jname); /* Bind & store it */ jhost_bind(jhost, host, env); @@ -351,7 +350,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_all(JNIEnv * env, jclas jhost = (jobject) host->extension(JAVA_HOST_LEVEL); if (!jhost) { - jname = env->NewStringUTF(MSG_host_get_name(host)); + jname = env->NewStringUTF(host->cname()); jhost = Java_org_simgrid_msg_Host_getByName(env, cls_arg, jname); /* FIXME: leak of jname ? */ diff --git a/src/bindings/lua/lua_host.cpp b/src/bindings/lua/lua_host.cpp index 74d4f8208d..a89c19acfc 100644 --- a/src/bindings/lua/lua_host.cpp +++ b/src/bindings/lua/lua_host.cpp @@ -78,7 +78,7 @@ static int l_host_get_by_name(lua_State * L) static int l_host_get_name(lua_State * L) { sg_host_t ht = sglua_check_host(L, 1); - lua_pushstring(L, sg_host_get_name(ht)); + lua_pushstring(L, ht->cname()); return 1; } diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index c8d73987cf..9ad9cc9a12 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -41,7 +41,6 @@ namespace surf { class Model; class CpuModel; class HostModel; -class VMModel; class NetworkModel; class StorageModel; class Resource; @@ -52,6 +51,9 @@ class Action; class ActionLmm; class StorageActionLmm; } +namespace vm { +class VMModel; // FIXME: KILLME +} namespace kernel { namespace routing { class RoutingPlatf; @@ -62,7 +64,7 @@ class RoutingPlatf; typedef simgrid::surf::Model surf_Model; typedef simgrid::surf::CpuModel surf_CpuModel; typedef simgrid::surf::HostModel surf_HostModel; -typedef simgrid::surf::VMModel surf_VMModel; +typedef simgrid::vm::VMModel surf_VMModel; typedef simgrid::surf::NetworkModel surf_NetworkModel; typedef simgrid::surf::StorageModel surf_StorageModel; typedef simgrid::surf::Resource surf_Resource; diff --git a/src/mc/mc_smx.cpp b/src/mc/mc_smx.cpp index 69a1e87901..e4c41faff7 100644 --- a/src/mc/mc_smx.cpp +++ b/src/mc/mc_smx.cpp @@ -143,7 +143,7 @@ smx_actor_t MC_smx_simcall_get_issuer(s_smx_simcall_t const* req) const char* MC_smx_process_get_host_name(smx_actor_t p) { if (mc_model_checker == nullptr) - return sg_host_get_name(p->host); + return p->host->cname(); simgrid::mc::Process* process = &mc_model_checker->process(); diff --git a/src/msg/instr_msg_process.cpp b/src/msg/instr_msg_process.cpp index bcdb775ff8..c1c7ea87b3 100644 --- a/src/msg/instr_msg_process.cpp +++ b/src/msg/instr_msg_process.cpp @@ -1,11 +1,11 @@ -/* Copyright (c) 2010, 2012-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010, 2012-2016. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "src/simix/ActorImpl.hpp" #include "msg_private.h" +#include "src/simix/ActorImpl.hpp" +#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg_process, instr, "MSG process"); @@ -58,7 +58,7 @@ void TRACE_msg_process_create (const char *process_name, int process_pid, msg_ho int len = INSTR_DEFAULT_STR_SIZE; char str[INSTR_DEFAULT_STR_SIZE]; - container_t host_container = PJ_container_get (sg_host_get_name(host)); + container_t host_container = PJ_container_get(host->cname()); PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container); } } diff --git a/src/msg/msg_io.cpp b/src/msg/msg_io.cpp index 510ac65395..a27f8796bb 100644 --- a/src/msg/msg_io.cpp +++ b/src/msg/msg_io.cpp @@ -103,7 +103,7 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size) msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname); read_size = simcall_file_read(file_priv->simdata->smx_file, size, attached_host); - if(strcmp(storage_priv_src->hostname, MSG_host_get_name(MSG_host_self()))){ + if (strcmp(storage_priv_src->hostname, MSG_host_self()->cname())) { /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */ XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_priv_src->hostname, read_size); msg_host_t *m_host_list = nullptr; @@ -121,7 +121,7 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size) xbt_free(m_host_list); if(transfer != MSG_OK){ if (transfer == MSG_HOST_FAILURE) - XBT_WARN("Transfer error, %s remote host just turned off!", MSG_host_get_name(attached_host)); + XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->cname()); if (transfer == MSG_TASK_CANCELED) XBT_WARN("Transfer error, task has been canceled!"); @@ -150,7 +150,7 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src); msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname); - if(strcmp(storage_priv_src->hostname, MSG_host_get_name(MSG_host_self()))){ + if (strcmp(storage_priv_src->hostname, MSG_host_self()->cname())) { /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */ XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_priv_src->hostname, size); msg_host_t *m_host_list = nullptr; @@ -168,7 +168,7 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) free(m_host_list); if(transfer != MSG_OK){ if (transfer == MSG_HOST_FAILURE) - XBT_WARN("Transfer error, %s remote host just turned off!", MSG_host_get_name(attached_host)); + XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->cname()); if (transfer == MSG_TASK_CANCELED) XBT_WARN("Transfer error, task has been canceled!"); @@ -201,7 +201,7 @@ msg_file_t MSG_file_open(const char* fullpath, void* data) priv->simdata->smx_file = simcall_file_open(fullpath, MSG_host_self()); priv->desc_id = __MSG_host_get_file_descriptor_id(MSG_host_self()); - name = bprintf("%s:%s:%d", priv->fullpath, MSG_host_get_name(MSG_host_self()), priv->desc_id); + name = bprintf("%s:%s:%d", priv->fullpath, MSG_host_self()->cname(), priv->desc_id); xbt_lib_set(file_lib, name, MSG_FILE_LEVEL, priv); msg_file_t fd = static_cast(xbt_lib_get_elm_or_null(file_lib, name)); @@ -225,7 +225,7 @@ int MSG_file_close(msg_file_t fd) xbt_free(priv->data); int res = simcall_file_close(priv->simdata->smx_file, MSG_host_self()); - name = bprintf("%s:%s:%d", priv->fullpath, MSG_host_get_name(MSG_host_self()), priv->desc_id); + name = bprintf("%s:%s:%d", priv->fullpath, MSG_host_self()->cname(), priv->desc_id); __MSG_host_release_file_descriptor_id(MSG_host_self(), priv->desc_id); xbt_lib_unset(file_lib, name, MSG_FILE_LEVEL, 1); xbt_free(name); @@ -359,7 +359,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa host_name_dest = (char*)storage_dest_priv->hostname; host_dest = MSG_host_by_name(host_name_dest); }else{ - XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, sg_host_get_name(host)); + XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->cname()); return MSG_TASK_CANCELED; } diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index 866d533d0d..6189fe77ba 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -199,7 +199,7 @@ msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host, simdata->last_errno = MSG_OK; /* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */ - process = SIMIX_process_attach(name, simdata, sg_host_get_name(host), properties, nullptr); + process = SIMIX_process_attach(name, simdata, host->cname(), properties, nullptr); if (!process) xbt_die("Could not attach"); simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process); diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 417e55a84b..12a577e081 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -215,13 +215,13 @@ void MSG_vm_start(msg_vm_t vm) if (pm_ramsize && !pm_overcommit) { /* Only verify that we don't overcommit on need */ /* Retrieve the memory occupied by the VMs on that host. Yep, we have to traverse all VMs of all hosts for that */ long total_ramsize_of_vms = 0; - for (simgrid::s4u::VirtualMachine* ws_vm : simgrid::surf::VirtualMachineImpl::allVms_) + for (simgrid::s4u::VirtualMachine* ws_vm : simgrid::vm::VirtualMachineImpl::allVms_) if (pm == ws_vm->pimpl_vm_->getPm()) total_ramsize_of_vms += ws_vm->pimpl_vm_->getRamsize(); 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).", - sg_host_get_name(vm), sg_host_get_name(pm), vm_ramsize, pm_ramsize - total_ramsize_of_vms, pm_ramsize); + 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()); } } @@ -341,17 +341,17 @@ static int migration_rx_fun(int argc, char *argv[]) snprintf(key, INSTR_DEFAULT_STR_SIZE, "%lld", counter++); // start link - container_t msg = PJ_container_get(vm->name().c_str()); + container_t msg = PJ_container_get(vm->cname()); type_t type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root()); new_pajeStartLink(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->name().c_str()); + container_t existing_container = PJ_container_get(vm->cname()); 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(sg_host_get_name(ms->dst_pm))); + PJ_container_new(vm->cname(), INSTR_MSG_VM, PJ_container_get(ms->dst_pm->cname())); // end link msg = PJ_container_get(vm->name().c_str()); @@ -383,7 +383,7 @@ static int migration_rx_fun(int argc, char *argv[]) static void start_dirty_page_tracking(msg_vm_t vm) { - simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; + simgrid::vm::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; pimpl->dp_enabled = 1; if (!pimpl->dp_objs) @@ -411,15 +411,15 @@ static double get_computed(char *key, msg_vm_t vm, dirty_page_t dp, double remai double computed = dp->prev_remaining - remaining; double duration = clock - dp->prev_clock; - XBT_DEBUG("%s@%s: computed %f ops (remaining %f -> %f) in %f secs (%f -> %f)", - key, sg_host_get_name(vm), computed, dp->prev_remaining, remaining, duration, dp->prev_clock, clock); + XBT_DEBUG("%s@%s: computed %f ops (remaining %f -> %f) in %f secs (%f -> %f)", key, vm->cname(), computed, + dp->prev_remaining, remaining, duration, dp->prev_clock, clock); return computed; } static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug, int stage2_round_for_fancy_debug) { - simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; + simgrid::vm::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; double total = 0; char *key = nullptr; @@ -455,7 +455,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task) simgrid::s4u::VirtualMachine* vm = dynamic_cast(host); if (vm == nullptr) return; - simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; + simgrid::vm::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; double remaining = MSG_task_get_flops_amount(task); char *key = bprintf("%s-%p", task->name, task); @@ -470,7 +470,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task) pimpl->dp_objs = xbt_dict_new(); 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, sg_host_get_name(host), remaining, pimpl->dp_enabled); + XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, host->cname(), remaining, pimpl->dp_enabled); xbt_free(key); } @@ -480,7 +480,7 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task) simgrid::s4u::VirtualMachine* vm = dynamic_cast(host); if (vm == nullptr) return; - simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; + simgrid::vm::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; char *key = bprintf("%s-%p", task->name, task); dirty_page_t dp = (dirty_page_t)(pimpl->dp_objs ? xbt_dict_get_or_null(pimpl->dp_objs, key) : NULL); @@ -500,7 +500,7 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task) xbt_dict_remove(pimpl->dp_objs, key); xbt_free(dp); - XBT_DEBUG("del %s on %s", key, sg_host_get_name(host)); + XBT_DEBUG("del %s on %s", key, host->cname()); xbt_free(key); } @@ -535,11 +535,11 @@ static sg_size_t send_migration_data(msg_vm_t vm, msg_host_t src_pm, msg_host_t if(ret == MSG_HOST_FAILURE){ //XBT_DEBUG("SRC host failed during migration of %s (stage %d)", sg_host_name(vm), stage); MSG_task_destroy(task); - THROWF(host_error, 0, "SRC host failed during migration of %s (stage %d)", sg_host_get_name(vm), stage); + THROWF(host_error, 0, "SRC host failed during migration of %s (stage %d)", vm->cname(), stage); }else if(ret == MSG_TRANSFER_FAILURE){ //XBT_DEBUG("DST host failed during migration of %s (stage %d)", sg_host_name(vm), stage); MSG_task_destroy(task); - THROWF(host_error, 0, "DST host failed during migration of %s (stage %d)", sg_host_get_name(vm), stage); + THROWF(host_error, 0, "DST host failed during migration of %s (stage %d)", vm->cname(), stage); } double clock_end = MSG_get_clock(); @@ -755,9 +755,9 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t dst_pm) * The second one would be easier. */ - simgrid::s4u::VirtualMachine* typedVm = static_cast(vm); - simgrid::surf::VirtualMachineImpl* pimpl = typedVm->pimpl_vm_; - msg_host_t src_pm = pimpl->getPm(); + simgrid::s4u::VirtualMachine* typedVm = static_cast(vm); + simgrid::vm::VirtualMachineImpl* pimpl = typedVm->pimpl_vm_; + 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()); diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index b01ab0a7e4..8f9c116a4f 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -13,26 +13,26 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm, surf, "Logging specific to the SURF VM module"); -simgrid::surf::VMModel* surf_vm_model = nullptr; +simgrid::vm::VMModel* surf_vm_model = nullptr; void surf_vm_model_init_HL13() { if (surf_cpu_model_vm) { - surf_vm_model = new simgrid::surf::VMModel(); + surf_vm_model = new simgrid::vm::VMModel(); all_existing_models->push_back(surf_vm_model); } } namespace simgrid { -namespace surf { +namespace vm { /************* * Callbacks * *************/ -simgrid::xbt::signal onVmCreation; -simgrid::xbt::signal onVmDestruction; -simgrid::xbt::signal onVmStateChange; +simgrid::xbt::signal onVmCreation; +simgrid::xbt::signal onVmDestruction; +simgrid::xbt::signal onVmStateChange; /********* * Model * @@ -73,7 +73,7 @@ double VMModel::nextOccuringEvent(double now) /* iterate for all virtual machines */ for (s4u::VirtualMachine* ws_vm : VirtualMachineImpl::allVms_) { - Cpu* cpu = ws_vm->pimpl_cpu; + surf::Cpu* cpu = ws_vm->pimpl_cpu; xbt_assert(cpu, "cpu-less host"); double solved_value = ws_vm->pimpl_vm_->action_->getVariable()->value; @@ -199,10 +199,10 @@ void VirtualMachineImpl::migrate(s4u::Host* host_dest) /* Update vcpu's action for the new pm */ /* create a cpu action bound to the pm model at the destination. */ - CpuAction* new_cpu_action = static_cast(host_dest->pimpl_cpu->execution_start(0)); + surf::CpuAction* new_cpu_action = static_cast(host_dest->pimpl_cpu->execution_start(0)); - Action::State state = action_->getState(); - if (state != Action::State::done) + surf::Action::State state = action_->getState(); + if (state != surf::Action::State::done) XBT_CRITICAL("FIXME: may need a proper handling, %d", static_cast(state)); if (action_->getRemainsNoUpdate() > 0) XBT_CRITICAL("FIXME: need copy the state(?), %f", action_->getRemainsNoUpdate()); diff --git a/src/plugins/vm/VirtualMachineImpl.hpp b/src/plugins/vm/VirtualMachineImpl.hpp index 4df8c25555..6f3398476a 100644 --- a/src/plugins/vm/VirtualMachineImpl.hpp +++ b/src/plugins/vm/VirtualMachineImpl.hpp @@ -19,7 +19,7 @@ // It corresponds to the cost of a VM running no tasks. namespace simgrid { -namespace surf { +namespace vm { /*********** * Classes * @@ -35,17 +35,17 @@ class XBT_PRIVATE VirtualMachineImpl; /** @ingroup SURF_callbacks * @brief Callbacks fired after VM creation. Signature: `void(VirtualMachine*)` */ -extern XBT_PRIVATE simgrid::xbt::signal onVmCreation; +extern XBT_PRIVATE simgrid::xbt::signal onVmCreation; /** @ingroup SURF_callbacks * @brief Callbacks fired after VM destruction. Signature: `void(VirtualMachine*)` */ -extern XBT_PRIVATE simgrid::xbt::signal onVmDestruction; +extern XBT_PRIVATE simgrid::xbt::signal onVmDestruction; /** @ingroup SURF_callbacks * @brief Callbacks after VM State changes. Signature: `void(VirtualMachine*)` */ -extern XBT_PRIVATE simgrid::xbt::signal onVmStateChange; +extern XBT_PRIVATE simgrid::xbt::signal onVmStateChange; /************ * Resource * @@ -55,7 +55,7 @@ extern XBT_PRIVATE simgrid::xbt::signalpimpl_netcard; // Create a VCPU for this VM @@ -37,7 +37,7 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm) : Host(name) extension_set(new simgrid::simix::Host()); if (TRACE_msg_vm_is_enabled()) { - container_t host_container = PJ_container_get(sg_host_get_name(pm)); + container_t host_container = PJ_container_get(pm->cname()); PJ_container_new(name, INSTR_MSG_VM, host_container); } } diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 9ccb263369..77e84c3818 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -198,10 +198,10 @@ void sg_host_dump(sg_host_t host) xbt_dict_cursor_t cursor=nullptr; char *key,*data; - XBT_INFO("Displaying host %s", sg_host_get_name(host)); + XBT_INFO("Displaying host %s", host->cname()); XBT_INFO(" - speed: %.0f", host->speed()); XBT_INFO(" - available speed: %.2f", sg_host_get_available_speed(host)); - props = sg_host_get_properties(host); + props = host->properties(); if (!xbt_dict_is_empty(props)){ XBT_INFO(" - properties:"); diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 2329d65388..99b2569fe8 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -222,8 +222,7 @@ void SIMIX_process_stop(smx_actor_t arg) { arg->properties, arg->auto_restart); } - XBT_DEBUG("Process %s (%s) is dead", - arg->name.c_str(), sg_host_get_name(arg->host)); + XBT_DEBUG("Process %s@%s is dead", arg->cname(), arg->host->cname()); arg->context->stop(); } @@ -303,20 +302,18 @@ smx_actor_t SIMIX_process_create( /* Now insert it in the global process list and in the process to run list */ xbt_swag_insert(process, simix_global->process_list); - XBT_DEBUG("Inserting %s(%s) in the to_run list", - process->name.c_str(), sg_host_get_name(host)); + XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->cname()); xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process); if (kill_time > SIMIX_get_clock() && simix_global->kill_process_function) { - XBT_DEBUG("Process %s(%s) will be kill at time %f", - process->name.c_str(), sg_host_get_name(process->host), kill_time); + XBT_DEBUG("Process %s(%s) will be kill at time %f", process->cname(), process->host->cname(), kill_time); process->kill_timer = SIMIX_timer_set(kill_time, [=]() { simix_global->kill_process_function(process); }); } /* Tracing the process creation */ - TRACE_msg_process_create(process->name.c_str(), process->pid, process->host); + TRACE_msg_process_create(process->cname(), process->pid, process->host); } return process; } @@ -383,12 +380,11 @@ smx_actor_t SIMIX_process_attach( /* Now insert it in the global process list and in the process to run list */ xbt_swag_insert(process, simix_global->process_list); - XBT_DEBUG("Inserting %s(%s) in the to_run list", - process->name.c_str(), sg_host_get_name(host)); + XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->cname()); xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process); /* Tracing the process creation */ - TRACE_msg_process_create(process->name.c_str(), process->pid, process->host); + TRACE_msg_process_create(process->cname(), process->pid, process->host); auto context = dynamic_cast(process->context); if (!context) @@ -449,8 +445,7 @@ void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_actor_t process) { */ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) { - XBT_DEBUG("Killing process %s on %s", - process->name.c_str(), sg_host_get_name(process->host)); + XBT_DEBUG("Killing process %s@%s", process->cname(), process->host->cname()); process->context->iwannadie = 1; process->blocked = 0; @@ -789,9 +784,8 @@ smx_activity_t SIMIX_process_sleep(smx_actor_t process, double duration) { sg_host_t host = process->host; - /* check if the host is active */ if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); + THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->cname()); simgrid::kernel::activity::Sleep *synchro = new simgrid::kernel::activity::Sleep(); synchro->host = host; @@ -942,7 +936,7 @@ smx_actor_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_actor_t p } /** @brief Restart a process, starting it again from the beginning. */ smx_actor_t SIMIX_process_restart(smx_actor_t process, smx_actor_t issuer) { - XBT_DEBUG("Restarting process %s on %s", process->name.c_str(), sg_host_get_name(process->host)); + XBT_DEBUG("Restarting process %s on %s", process->cname(), process->host->cname()); //retrieve the arguments of the old process //FIXME: Factorize this with SIMIX_host_add_auto_restart_process ? diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index ff1073cc80..f9623d190e 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -51,6 +51,7 @@ public: unsigned long pid = 0; unsigned long ppid = 0; simgrid::xbt::string name; + const char* cname() { return name.c_str(); } sg_host_t host = nullptr; /* the host on which the process is running */ smx_context_t context = nullptr; /* the context (uctx/raw/thread) that executes the user function */ diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 1322fcdc24..7ccc835004 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -342,8 +342,7 @@ void simcall_process_set_kill_time(smx_actor_t process, double kill_time) if (kill_time <= SIMIX_get_clock() || simix_global->kill_process_function == nullptr) return; - XBT_DEBUG("Set kill time %f for process %s(%s)", - kill_time, process->name.c_str(), sg_host_get_name(process->host)); + XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->cname(), process->host->cname()); process->kill_timer = SIMIX_timer_set(kill_time, [=] { simix_global->kill_process_function(process); process->kill_timer=nullptr; diff --git a/src/simix/smx_deployment.cpp b/src/simix/smx_deployment.cpp index b34c5bb805..ffc3d902a3 100644 --- a/src/simix/smx_deployment.cpp +++ b/src/simix/smx_deployment.cpp @@ -129,7 +129,7 @@ void SIMIX_process_set_function(const char *process_host, sg_host_t host = sg_host_by_name(process_host); if (!host) THROWF(arg_error, 0, "Host '%s' unknown", process_host); - process.host = sg_host_get_name(host); + process.host = host->cname(); process.argc = 1 + xbt_dynar_length(arguments); process.argv = (const char**)xbt_new(char *, process.argc + 1); diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index dd161f1117..6ed45ba6ea 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -535,7 +535,7 @@ void SIMIX_run() /* Autorestart all process */ for (auto host: host_that_restart) { - XBT_INFO("Restart processes on host: %s", sg_host_get_name(host)); + XBT_INFO("Restart processes on host %s", host->cname()); SIMIX_host_autorestart(host); } host_that_restart.clear(); @@ -678,13 +678,12 @@ void SIMIX_display_process_status() break; */ - XBT_INFO("Process %lu (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", - process->pid, process->name.c_str(), sg_host_get_name(process->host), - synchro_description, process->waiting_synchro, - process->waiting_synchro->name.c_str(), (int)process->waiting_synchro->state); + 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, + process->waiting_synchro->name.c_str(), (int)process->waiting_synchro->state); } else { - XBT_INFO("Process %lu (%s@%s)", process->pid, process->name.c_str(), sg_host_get_name(process->host)); + XBT_INFO("Process %lu (%s@%s)", process->pid, process->cname(), process->host->cname()); } } } diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 014a49d91b..69043697a9 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -91,12 +91,11 @@ void SIMIX_host_off(sg_host_t h, smx_actor_t issuer) smx_actor_t process = nullptr; xbt_swag_foreach(process, host->process_list) { SIMIX_process_kill(process, issuer); - XBT_DEBUG("Killing %s@%s on behalf of %s", process->name.c_str(), sg_host_get_name(process->host), - issuer->name.c_str()); + XBT_DEBUG("Killing %s@%s on behalf of %s", process->cname(), process->host->cname(), issuer->cname()); } } } else { - XBT_INFO("Host %s is already off", h->name().c_str()); + XBT_INFO("Host %s is already off", h->cname()); } } @@ -113,7 +112,7 @@ const char* SIMIX_host_self_get_name() if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process) return ""; - return sg_host_get_name(host); + return host->cname(); } void _SIMIX_host_free_process_arg(void *data) @@ -141,9 +140,9 @@ void SIMIX_host_add_auto_restart_process( arg->properties = properties; arg->auto_restart = auto_restart; - if( host->isOff() && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_get_name(host))){ - xbt_dict_set(watched_hosts_lib,sg_host_get_name(host),host,nullptr); - XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_get_name(host)); + if (host->isOff() && !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()); } sg_host_simix(host)->auto_restart_processes.push_back(arg); } @@ -156,7 +155,7 @@ void SIMIX_host_autorestart(sg_host_t host) for (auto arg : process_list) { - XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->name().c_str()); + XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->cname()); simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host, arg->kill_time, arg->properties, arg->auto_restart, nullptr); } @@ -278,7 +277,7 @@ void SIMIX_execution_finish(simgrid::kernel::activity::Exec *exec) break; case SIMIX_FAILED: - XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", sg_host_get_name(simcall->issuer->host)); + XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->cname()); simcall->issuer->context->iwannadie = 1; SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); break; diff --git a/src/simix/smx_io.cpp b/src/simix/smx_io.cpp index 1485d5903a..44b42f3931 100644 --- a/src/simix/smx_io.cpp +++ b/src/simix/smx_io.cpp @@ -67,8 +67,7 @@ smx_activity_t SIMIX_file_read(smx_file_t fd, sg_size_t size, sg_host_t host) { /* check if the host is active */ if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); - + THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname()); simgrid::kernel::activity::Io *synchro = new simgrid::kernel::activity::Io(); synchro->host = host; @@ -91,7 +90,7 @@ void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t smx_activity_t SIMIX_file_write(smx_file_t fd, sg_size_t size, sg_host_t host) { if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); + THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname()); simgrid::kernel::activity::Io *synchro = new simgrid::kernel::activity::Io(); synchro->host = host; @@ -113,7 +112,7 @@ void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, sg_h smx_activity_t SIMIX_file_open(const char* fullpath, sg_host_t host) { if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); + THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname()); simgrid::kernel::activity::Io *synchro = new simgrid::kernel::activity::Io(); synchro->host = host; @@ -135,7 +134,7 @@ void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, sg_host_t smx_activity_t SIMIX_file_close(smx_file_t fd, sg_host_t host) { if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); + THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname()); simgrid::kernel::activity::Io *synchro = new simgrid::kernel::activity::Io(); synchro->host = host; @@ -150,7 +149,7 @@ smx_activity_t SIMIX_file_close(smx_file_t fd, sg_host_t host) int SIMIX_file_unlink(smx_file_t fd, sg_host_t host) { if (host->isOff()) - THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); + THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname()); int res = surf_host_unlink(host, fd->surf_file); xbt_free(fd); diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 3999fe7d57..1c168bc7fc 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -545,7 +545,7 @@ static inline void SIMIX_comm_start(smx_activity_t synchro) simgrid::s4u::Host* sender = comm->src_proc->host; simgrid::s4u::Host* receiver = comm->dst_proc->host; - XBT_DEBUG("Starting communication %p from '%s' to '%s'", synchro, sg_host_get_name(sender), sg_host_get_name(receiver)); + XBT_DEBUG("Starting communication %p from '%s' to '%s'", synchro, sender->cname(), receiver->cname()); comm->surf_comm = surf_network_model->communicate(sender, receiver, comm->task_size, comm->rate); comm->surf_comm->setData(synchro); @@ -553,8 +553,8 @@ static inline void SIMIX_comm_start(smx_activity_t synchro) /* 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", - sg_host_get_name(sender), sg_host_get_name(receiver)); + XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->cname(), + receiver->cname()); comm->state = SIMIX_LINK_FAILURE; comm->cleanupSurf(); } @@ -563,11 +563,13 @@ static inline void SIMIX_comm_start(smx_activity_t synchro) it will be restarted when the sender process resume */ if (SIMIX_process_is_suspended(comm->src_proc) || SIMIX_process_is_suspended(comm->dst_proc)) { if (SIMIX_process_is_suspended(comm->src_proc)) - XBT_DEBUG("The communication is suspended on startup because src (%s@%s) was suspended since it initiated the communication", - comm->src_proc->name.c_str(), sg_host_get_name(comm->src_proc->host)); + 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()); else - XBT_DEBUG("The communication is suspended on startup because dst (%s@%s) was suspended since it initiated the communication", - comm->dst_proc->name.c_str(), sg_host_get_name(comm->dst_proc->host)); + 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->surf_comm->suspend(); } @@ -649,11 +651,11 @@ void SIMIX_comm_finish(smx_activity_t synchro) case SIMIX_LINK_FAILURE: - XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) detached:%d", - synchro, - comm->src_proc ? sg_host_get_name(comm->src_proc->host) : nullptr, - comm->dst_proc ? sg_host_get_name(comm->dst_proc->host) : nullptr, - simcall->issuer->name.c_str(), simcall->issuer, comm->detached); + XBT_DEBUG( + "Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) detached:%d", + synchro, 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); if (comm->src_proc == simcall->issuer) { XBT_DEBUG("I'm source"); } else if (comm->dst_proc == simcall->issuer) { @@ -773,12 +775,9 @@ void SIMIX_comm_copy_data(smx_activity_t synchro) if (!comm->src_buff || !comm->dst_buff || comm->copied) return; - XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", - comm, - comm->src_proc ? sg_host_get_name(comm->src_proc->host) : "a finished process", - comm->src_buff, - comm->dst_proc ? sg_host_get_name(comm->dst_proc->host) : "a finished process", - comm->dst_buff, buff_size); + XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", comm, + 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); /* Copy at most dst_buff_size bytes of the message to receiver's buffer */ if (comm->dst_buff_size) diff --git a/src/simix/smx_vm.cpp b/src/simix/smx_vm.cpp index 10def72ddd..12a040634e 100644 --- a/src/simix/smx_vm.cpp +++ b/src/simix/smx_vm.cpp @@ -81,19 +81,16 @@ void SIMIX_vm_resume(sg_host_t vm) */ void SIMIX_vm_save(sg_host_t vm, smx_actor_t issuer) { - const char *name = sg_host_get_name(vm); - if (static_cast(vm)->pimpl_vm_->getState() != SURF_VM_STATE_RUNNING) - THROWF(vm_error, 0, "VM(%s) is not running", name); + THROWF(vm_error, 0, "VM(%s) is not running", vm->cname()); - XBT_DEBUG("save VM(%s), where %d processes exist", name, xbt_swag_size(sg_host_simix(vm)->process_list)); + XBT_DEBUG("save VM(%s), where %d processes exist", vm->cname(), xbt_swag_size(sg_host_simix(vm)->process_list)); - /* jump to vm_ws_save() */ static_cast(vm)->pimpl_vm_->save(); smx_actor_t smx_process, smx_process_safe; xbt_swag_foreach_safe(smx_process, smx_process_safe, sg_host_simix(vm)->process_list) { - XBT_DEBUG("suspend %s", smx_process->name.c_str()); + XBT_DEBUG("suspend %s", smx_process->cname()); SIMIX_process_suspend(smx_process, issuer); } } diff --git a/src/smpi/smpi_pmpi.cpp b/src/smpi/smpi_pmpi.cpp index 90bd6cb81d..dc589718ec 100644 --- a/src/smpi/smpi_pmpi.cpp +++ b/src/smpi/smpi_pmpi.cpp @@ -1,10 +1,9 @@ - -/* Copyright (c) 2007-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include #include #include "private.h" @@ -2328,9 +2327,9 @@ int PMPI_Get_processor_name(char *name, int *resultlen) { int retval = MPI_SUCCESS; - strncpy(name, sg_host_get_name(SIMIX_host_self()), - strlen(sg_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ? - strlen(sg_host_get_name(SIMIX_host_self())) +1 : MPI_MAX_PROCESSOR_NAME - 1 ); + strncpy(name, SIMIX_host_self()->cname(), strlen(SIMIX_host_self()->cname()) < MPI_MAX_PROCESSOR_NAME - 1 + ? strlen(SIMIX_host_self()->cname()) + 1 + : MPI_MAX_PROCESSOR_NAME - 1); *resultlen = strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name); return retval; diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index bda7540fb7..bc39f8ff97 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -35,7 +35,7 @@ namespace surf { void HostModel::adjustWeightOfDummyCpuActions() { /* iterate for all virtual machines */ - for (s4u::VirtualMachine* ws_vm : VirtualMachineImpl::allVms_) { + for (s4u::VirtualMachine* ws_vm : vm::VirtualMachineImpl::allVms_) { Cpu* cpu = ws_vm->pimpl_cpu; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index cb5a0d4b41..6d6ba0c771 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -567,8 +567,7 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process) delete arg; }); } else { // start_time <= SIMIX_get_clock() - XBT_DEBUG("Starting Process %s(%s) right now", - arg->name.c_str(), sg_host_get_name(host)); + XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->cname()); process_created = simix_global->create_process_function( arg->name.c_str(), std::move(code), nullptr, diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index 96b7ded9d7..6035034bfd 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -104,7 +104,7 @@ int main(int argc, char **argv) std::qsort((void *) hosts, totalHosts, sizeof(sg_host_t), name_compare_hosts); for (i = 0; i < totalHosts; i++) { - std::printf(" cname(), sg_host_speed(hosts[i])); props = sg_host_get_properties(hosts[i]); if (hosts[i]->coreCount()>1) { std::printf(" core=\"%d\"", hosts[i]->coreCount());