* smpi/cpu-threshold:-1 should become smpi/simulate-computation:no
smpi/running-power is renamed to smpi/host-speed
+ New functions and features
+ * MSG_parallel_task_execute_with_timeout, to timeout computations.
+
Dropped / renamed functions and features
* msg_mailbox_t and associated functions. Use s4u::Mailbox instead.
- MSG_mailbox_is_empty() -> Mailbox::empty()
graphNodeMap_ = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
/* Add the loopback if needed */
- if (routing_platf->loopback_ && hierarchy_ == RoutingMode::base) {
+ if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
xbt_dynar_foreach(xbt_graph_get_nodes(routeGraph_), cursor, node) {
xbt_edge_t edge = nullptr;
if (!found) {
sg_platf_route_cbarg_t e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
e_route->link_list = new std::vector<Link*>();
- e_route->link_list->push_back(routing_platf->loopback_);
+ e_route->link_list->push_back(surf_network_model->loopback_);
xbt_graph_new_edge(routeGraph_, node, node, e_route);
}
}
}
/* Add the loopback if needed */
- if (routing_platf->loopback_ && hierarchy_ == RoutingMode::base) {
+ if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
for (unsigned int i = 0; i < table_size; i++) {
sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i);
if (!e_route) {
e_route->gw_src = nullptr;
e_route->gw_dst = nullptr;
e_route->link_list = new std::vector<Link*>();
- e_route->link_list->push_back(routing_platf->loopback_);
+ e_route->link_list->push_back(surf_network_model->loopback_);
TO_FLOYD_LINK(i, i) = e_route;
TO_FLOYD_PRED(i, i) = i;
TO_FLOYD_COST(i, i) = 1;
routingTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
/* Add the loopback if needed */
- if (routing_platf->loopback_ && hierarchy_ == RoutingMode::base) {
+ if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
for (i = 0; i < table_size; i++) {
e_route = TO_ROUTE_FULL(i, i);
if (!e_route) {
e_route->gw_src = nullptr;
e_route->gw_dst = nullptr;
e_route->link_list = new std::vector<Link*>();
- e_route->link_list->push_back(routing_platf->loopback_);
+ e_route->link_list->push_back(surf_network_model->loopback_);
TO_ROUTE_FULL(i, i) = e_route;
}
}
#include "simgrid/s4u/host.hpp"
#include "src/kernel/routing/AsImpl.hpp"
+#include "src/surf/cpu_interface.hpp"
#include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(AsImpl,surf, "Implementation of S4U autonomous systems");
}
AsImpl::~AsImpl() = default;
- void AsImpl::attachHost(s4u::Host* host)
+ simgrid::s4u::Host* AsImpl::createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount)
{
+ simgrid::s4u::Host* res = new simgrid::s4u::Host(name);
+
if (hierarchy_ == RoutingMode::unset)
hierarchy_ = RoutingMode::base;
- host->pimpl_netcard = new NetCardImpl(host->name().c_str(), NetCard::Type::Host, this);
+ res->pimpl_netcard = new NetCardImpl(name, NetCard::Type::Host, this);
+
+ surf_cpu_model_pm->createCpu(res, speedPerPstate, coreAmount);
+
+ return res;
}
xbt_dynar_t AsImpl::getOneLinkRoutes()
~AsImpl() override;
public:
- /** @brief attach the given host to that AS */
- void attachHost(s4u::Host * host);
+ /** @brief Make an host within that AS */
+ simgrid::s4u::Host* createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount);
/**
* @brief Probe the routing path between two points
#include "xbt/asserts.h"
namespace simgrid {
-
namespace s4u {
VirtualMachine::VirtualMachine(const char* name, s4u::Host* Pm) : Host(name)
onDestruction(*this);
}
+/** @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)
{
- this->pimpl_->getParams(params);
+ static_cast<surf::VirtualMachineImpl*>(pimpl_)->getParams(params);
}
-
+/** @brief Sets the params of that VM/PM */
void VirtualMachine::setParameters(vm_params_t params)
{
- simgrid::simix::kernelImmediate([&]() { this->pimpl_->setParams(params); });
+ simgrid::simix::kernelImmediate([&]() { static_cast<surf::VirtualMachineImpl*>(pimpl_)->setParams(params); });
}
} // namespace simgrid
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "mc/mc.h"
+#include "simgrid/s4u/VirtualMachine.hpp"
#include "smx_private.h"
#include "src/surf/HostImpl.hpp"
#include "src/surf/VirtualMachineImpl.hpp"
static long host_get_ramsize(sg_host_t vm, int *overcommit)
{
s_vm_params_t params;
- vm->pimpl_->getParams(¶ms);
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->parameters(¶ms);
if (overcommit)
*overcommit = params.overcommit;
double* bytes_amount, double rate)
{
#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
- Action *action =nullptr;
- if ((host_nb == 1)
- && (cost_or_zero(bytes_amount, 0) == 0.0)){
+ Action* action = nullptr;
+ if ((host_nb == 1) && (cost_or_zero(bytes_amount, 0) == 0.0)) {
action = host_list[0]->pimpl_cpu->execution_start(flops_amount[0]);
- } else if ((host_nb == 1)
- && (cost_or_zero(flops_amount, 0) == 0.0)) {
+ } else if ((host_nb == 1) && (cost_or_zero(flops_amount, 0) == 0.0)) {
action = surf_network_model->communicate(host_list[0], host_list[0], bytes_amount[0], rate);
- } else if ((host_nb == 2)
- && (cost_or_zero(flops_amount, 0) == 0.0)
- && (cost_or_zero(flops_amount, 1) == 0.0)) {
- int i,nb = 0;
+ } else if ((host_nb == 2) && (cost_or_zero(flops_amount, 0) == 0.0) && (cost_or_zero(flops_amount, 1) == 0.0)) {
+ int i, nb = 0;
double value = 0.0;
for (i = 0; i < host_nb * host_nb; i++) {
if (nb == 1) {
action = surf_network_model->communicate(host_list[0], host_list[1], value, rate);
} else if (nb == 0) {
- xbt_die("Cannot have a communication with no flop to exchange in this model. You should consider using the ptask model");
- } else {
- xbt_die("Cannot have a communication that is not a simple point-to-point in this model. You should consider using the ptask model");
+ xbt_die("Cannot have a communication with no flop to exchange in this model. You should consider using the "
+ "ptask model");
+ } else {
+ xbt_die("Cannot have a communication that is not a simple point-to-point in this model. You should consider "
+ "using the ptask model");
}
- } else
- xbt_die("This model only accepts one of the following. You should consider using the ptask model for the other cases.\n - execution with one host only and no communication\n - Self-comms with one host only\n - Communications with two hosts and no computation");
+ } else
+ xbt_die("This model only accepts one of the following. You should consider using the ptask model for the other "
+ "cases.\n - execution with one host only and no communication\n - Self-comms with one host only\n - "
+ "Communications with two hosts and no computation");
#undef cost_or_zero
xbt_free(host_list);
return action;
/************
* Resource *
************/
-HostImpl::HostImpl(s4u::Host* host, xbt_dynar_t storage) : PropertyHolder(nullptr), storage_(storage), piface_(host)
+HostImpl::HostImpl(s4u::Host* host, xbt_dynar_t storage) : storage_(storage), piface_(host)
{
piface_->pimpl_ = this;
- params_.ramsize = 0;
}
/** @brief use destroy() instead of this destructor */
HostImpl::~HostImpl() = default;
-simgrid::surf::Storage *HostImpl::findStorageOnMountList(const char* mount)
+simgrid::surf::Storage* HostImpl::findStorageOnMountList(const char* mount)
{
- simgrid::surf::Storage *st = nullptr;
+ simgrid::surf::Storage* st = nullptr;
s_mount_t mnt;
unsigned int cursor;
XBT_DEBUG("Search for storage name '%s' on '%s'", mount, piface_->name().c_str());
- xbt_dynar_foreach(storage_,cursor,mnt){
- XBT_DEBUG("See '%s'",mnt.name);
- if(!strcmp(mount,mnt.name)){
+ xbt_dynar_foreach (storage_, cursor, mnt) {
+ XBT_DEBUG("See '%s'", mnt.name);
+ if (!strcmp(mount, mnt.name)) {
st = static_cast<simgrid::surf::Storage*>(mnt.storage);
break;
}
}
- if(!st)
+ if (!st)
xbt_die("Can't find mount '%s' for '%s'", mount, piface_->name().c_str());
return st;
}
s_mount_t mnt;
unsigned int i;
xbt_dict_t storage_list = xbt_dict_new_homogeneous(nullptr);
- char *storage_name = nullptr;
+ char* storage_name = nullptr;
- xbt_dynar_foreach(storage_,i,mnt){
- storage_name = (char *)static_cast<simgrid::surf::Storage*>(mnt.storage)->getName();
- xbt_dict_set(storage_list,mnt.name,storage_name,nullptr);
+ xbt_dynar_foreach (storage_, i, mnt) {
+ storage_name = (char*)static_cast<simgrid::surf::Storage*>(mnt.storage)->getName();
+ xbt_dict_set(storage_list, mnt.name, storage_name, nullptr);
}
return storage_list;
}
xbt_dynar_t HostImpl::getAttachedStorageList()
{
xbt_lib_cursor_t cursor;
- char *key;
- void **data;
+ char* key;
+ void** data;
xbt_dynar_t result = xbt_dynar_new(sizeof(void*), nullptr);
- xbt_lib_foreach(storage_lib, cursor, key, data) {
+ xbt_lib_foreach(storage_lib, cursor, key, data)
+ {
if (xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) {
simgrid::surf::Storage* storage = static_cast<simgrid::surf::Storage*>(
xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
if (!strcmp((const char*)storage->attach_, piface_->name().c_str())) {
xbt_dynar_push_as(result, void*, (void*)storage->getName());
}
- }
+ }
}
return result;
-}
-
-Action *HostImpl::open(const char* fullpath) {
-
- simgrid::surf::Storage *st = nullptr;
- s_mount_t mnt;
- unsigned int cursor;
- size_t longest_prefix_length = 0;
- char *path = nullptr;
- char *file_mount_name = nullptr;
- char *mount_name = nullptr;
-
- XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, piface_->name().c_str());
- xbt_dynar_foreach(storage_,cursor,mnt)
- {
- XBT_DEBUG("See '%s'",mnt.name);
- file_mount_name = (char *) xbt_malloc ((strlen(mnt.name)+1));
- strncpy(file_mount_name,fullpath,strlen(mnt.name)+1);
- file_mount_name[strlen(mnt.name)] = '\0';
-
- if(!strcmp(file_mount_name,mnt.name) && strlen(mnt.name)>longest_prefix_length)
- {/* The current mount name is found in the full path and is bigger than the previous*/
- longest_prefix_length = strlen(mnt.name);
- st = static_cast<simgrid::surf::Storage*>(mnt.storage);
}
- free(file_mount_name);
- }
- if(longest_prefix_length>0)
- { /* Mount point found, split fullpath into mount_name and path+filename*/
- path = (char *) xbt_malloc ((strlen(fullpath)-longest_prefix_length+1));
- mount_name = (char *) xbt_malloc ((longest_prefix_length+1));
- strncpy(mount_name, fullpath, longest_prefix_length+1);
- strncpy(path, fullpath+longest_prefix_length, strlen(fullpath)-longest_prefix_length+1);
- path[strlen(fullpath)-longest_prefix_length] = '\0';
- mount_name[longest_prefix_length] = '\0';
- }
- else
- xbt_die("Can't find mount point for '%s' on '%s'", fullpath, piface_->name().c_str());
-
- XBT_DEBUG("OPEN %s on disk '%s'",path, st->getName());
- Action *action = st->open((const char*)mount_name, (const char*)path);
- free((char*)path);
- free((char*)mount_name);
- return action;
-}
-
-Action *HostImpl::close(surf_file_t fd) {
- simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
- XBT_DEBUG("CLOSE %s on disk '%s'",fd->name, st->getName());
- return st->close(fd);
-}
-
-Action *HostImpl::read(surf_file_t fd, sg_size_t size) {
- simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
- XBT_DEBUG("READ %s on disk '%s'",fd->name, st->getName());
- return st->read(fd, size);
-}
-
-Action *HostImpl::write(surf_file_t fd, sg_size_t size) {
- simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
- XBT_DEBUG("WRITE %s on disk '%s'",fd->name, st->getName());
- return st->write(fd, size);
-}
-int HostImpl::unlink(surf_file_t fd) {
- if (!fd){
- XBT_WARN("No such file descriptor. Impossible to unlink");
- return -1;
- } else {
-
- simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
- /* Check if the file is on this storage */
- if (!xbt_dict_get_or_null(st->content_, fd->name)){
- XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name,
- st->getName());
- return -1;
- } else {
- XBT_DEBUG("UNLINK %s on disk '%s'",fd->name, st->getName());
- st->usedSize_ -= fd->size;
-
- // Remove the file from storage
- xbt_dict_remove(st->content_, fd->name);
+ Action* HostImpl::open(const char* fullpath)
+ {
+
+ simgrid::surf::Storage* st = nullptr;
+ s_mount_t mnt;
+ unsigned int cursor;
+ size_t longest_prefix_length = 0;
+ char* path = nullptr;
+ char* file_mount_name = nullptr;
+ char* mount_name = nullptr;
+
+ XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, piface_->name().c_str());
+ xbt_dynar_foreach (storage_, cursor, mnt) {
+ XBT_DEBUG("See '%s'", mnt.name);
+ file_mount_name = (char*)xbt_malloc((strlen(mnt.name) + 1));
+ strncpy(file_mount_name, fullpath, strlen(mnt.name) + 1);
+ file_mount_name[strlen(mnt.name)] = '\0';
+
+ if (!strcmp(file_mount_name, mnt.name) &&
+ strlen(mnt.name) > longest_prefix_length) { /* The current mount name is found in the full path and is
+ bigger than the previous*/
+ longest_prefix_length = strlen(mnt.name);
+ st = static_cast<simgrid::surf::Storage*>(mnt.storage);
+ }
+ free(file_mount_name);
+ }
+ if (longest_prefix_length > 0) { /* Mount point found, split fullpath into mount_name and path+filename*/
+ path = (char*)xbt_malloc((strlen(fullpath) - longest_prefix_length + 1));
+ mount_name = (char*)xbt_malloc((longest_prefix_length + 1));
+ strncpy(mount_name, fullpath, longest_prefix_length + 1);
+ strncpy(path, fullpath + longest_prefix_length, strlen(fullpath) - longest_prefix_length + 1);
+ path[strlen(fullpath) - longest_prefix_length] = '\0';
+ mount_name[longest_prefix_length] = '\0';
+ } else
+ xbt_die("Can't find mount point for '%s' on '%s'", fullpath, piface_->name().c_str());
+
+ XBT_DEBUG("OPEN %s on disk '%s'", path, st->getName());
+ Action* action = st->open((const char*)mount_name, (const char*)path);
+ free((char*)path);
+ free((char*)mount_name);
+ return action;
+ }
- xbt_free(fd->name);
- xbt_free(fd->mount);
- xbt_free(fd);
- return 0;
+ Action* HostImpl::close(surf_file_t fd)
+ {
+ simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+ XBT_DEBUG("CLOSE %s on disk '%s'", fd->name, st->getName());
+ return st->close(fd);
}
- }
-}
-sg_size_t HostImpl::getSize(surf_file_t fd){
- return fd->size;
-}
+ Action* HostImpl::read(surf_file_t fd, sg_size_t size)
+ {
+ simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+ XBT_DEBUG("READ %s on disk '%s'", fd->name, st->getName());
+ return st->read(fd, size);
+ }
-xbt_dynar_t HostImpl::getInfo( surf_file_t fd)
-{
- simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
- sg_size_t *psize = xbt_new(sg_size_t, 1);
- *psize = fd->size;
- xbt_dynar_t info = xbt_dynar_new(sizeof(void*), nullptr);
- xbt_dynar_push_as(info, sg_size_t *, psize);
- xbt_dynar_push_as(info, void *, fd->mount);
- xbt_dynar_push_as(info, void *, (void *)st->getName());
- xbt_dynar_push_as(info, void *, st->typeId_);
- xbt_dynar_push_as(info, void *, st->contentType_);
-
- return info;
-}
+ Action* HostImpl::write(surf_file_t fd, sg_size_t size)
+ {
+ simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+ XBT_DEBUG("WRITE %s on disk '%s'", fd->name, st->getName());
+ return st->write(fd, size);
+ }
-sg_size_t HostImpl::fileTell(surf_file_t fd){
- return fd->current_position;
-}
+ int HostImpl::unlink(surf_file_t fd)
+ {
+ if (!fd) {
+ XBT_WARN("No such file descriptor. Impossible to unlink");
+ return -1;
+ } else {
+
+ simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+ /* Check if the file is on this storage */
+ if (!xbt_dict_get_or_null(st->content_, fd->name)) {
+ XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name, st->getName());
+ return -1;
+ } else {
+ XBT_DEBUG("UNLINK %s on disk '%s'", fd->name, st->getName());
+ st->usedSize_ -= fd->size;
+
+ // Remove the file from storage
+ xbt_dict_remove(st->content_, fd->name);
+
+ xbt_free(fd->name);
+ xbt_free(fd->mount);
+ xbt_free(fd);
+ return 0;
+ }
+ }
+ }
-int HostImpl::fileSeek(surf_file_t fd, sg_offset_t offset, int origin){
-
- switch (origin) {
- case SEEK_SET:
- fd->current_position = offset;
- return 0;
- case SEEK_CUR:
- fd->current_position += offset;
- return 0;
- case SEEK_END:
- fd->current_position = fd->size + offset;
- return 0;
- default:
- return -1;
- }
-}
+ sg_size_t HostImpl::getSize(surf_file_t fd)
+ {
+ return fd->size;
+ }
-int HostImpl::fileMove(surf_file_t fd, const char* fullpath){
- /* Check if the new full path is on the same mount point */
- if(!strncmp((const char*)fd->mount, fullpath, strlen(fd->mount))) {
- sg_size_t *psize, *new_psize;
- psize = (sg_size_t*)
- xbt_dict_get_or_null(findStorageOnMountList(fd->mount)->content_,
- fd->name);
- new_psize = xbt_new(sg_size_t, 1);
- *new_psize = *psize;
- if (psize){// src file exists
- xbt_dict_remove(findStorageOnMountList(fd->mount)->content_, fd->name);
- char *path = (char *) xbt_malloc ((strlen(fullpath)-strlen(fd->mount)+1));
- strncpy(path, fullpath+strlen(fd->mount),
- strlen(fullpath)-strlen(fd->mount)+1);
- xbt_dict_set(findStorageOnMountList(fd->mount)->content_, path,
- new_psize,nullptr);
- XBT_DEBUG("Move file from %s to %s, size '%llu'",fd->name, fullpath, *psize);
- free(path);
- return 0;
- } else {
- XBT_WARN("File %s doesn't exist", fd->name);
- return -1;
+ xbt_dynar_t HostImpl::getInfo(surf_file_t fd)
+ {
+ simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+ sg_size_t* psize = xbt_new(sg_size_t, 1);
+ *psize = fd->size;
+ xbt_dynar_t info = xbt_dynar_new(sizeof(void*), nullptr);
+ xbt_dynar_push_as(info, sg_size_t*, psize);
+ xbt_dynar_push_as(info, void*, fd->mount);
+ xbt_dynar_push_as(info, void*, (void*)st->getName());
+ xbt_dynar_push_as(info, void*, st->typeId_);
+ xbt_dynar_push_as(info, void*, st->contentType_);
+
+ return info;
}
- } else {
- XBT_WARN("New full path %s is not on the same mount point: %s. Action has been canceled.",
- fullpath, fd->mount);
- return -1;
- }
-}
-xbt_dynar_t HostImpl::getVms()
-{
- xbt_dynar_t dyn = xbt_dynar_new(sizeof(simgrid::surf::VirtualMachineImpl*), nullptr);
+ sg_size_t HostImpl::fileTell(surf_file_t fd)
+ {
+ return fd->current_position;
+ }
- for (VirtualMachineImpl* ws_vm : VirtualMachineImpl::allVms_) {
- if (this == ws_vm->getPm()->pimpl_)
- xbt_dynar_push(dyn, &ws_vm);
- }
+ int HostImpl::fileSeek(surf_file_t fd, sg_offset_t offset, int origin)
+ {
+
+ switch (origin) {
+ case SEEK_SET:
+ fd->current_position = offset;
+ return 0;
+ case SEEK_CUR:
+ fd->current_position += offset;
+ return 0;
+ case SEEK_END:
+ fd->current_position = fd->size + offset;
+ return 0;
+ default:
+ return -1;
+ }
+ }
- return dyn;
-}
+ int HostImpl::fileMove(surf_file_t fd, const char* fullpath)
+ {
+ /* Check if the new full path is on the same mount point */
+ if (!strncmp((const char*)fd->mount, fullpath, strlen(fd->mount))) {
+ sg_size_t *psize, *new_psize;
+ psize = (sg_size_t*)xbt_dict_get_or_null(findStorageOnMountList(fd->mount)->content_, fd->name);
+ new_psize = xbt_new(sg_size_t, 1);
+ *new_psize = *psize;
+ if (psize) { // src file exists
+ xbt_dict_remove(findStorageOnMountList(fd->mount)->content_, fd->name);
+ char* path = (char*)xbt_malloc((strlen(fullpath) - strlen(fd->mount) + 1));
+ strncpy(path, fullpath + strlen(fd->mount), strlen(fullpath) - strlen(fd->mount) + 1);
+ xbt_dict_set(findStorageOnMountList(fd->mount)->content_, path, new_psize, nullptr);
+ XBT_DEBUG("Move file from %s to %s, size '%llu'", fd->name, fullpath, *psize);
+ free(path);
+ return 0;
+ } else {
+ XBT_WARN("File %s doesn't exist", fd->name);
+ return -1;
+ }
+ } else {
+ XBT_WARN("New full path %s is not on the same mount point: %s. Action has been canceled.", fullpath, fd->mount);
+ return -1;
+ }
+ }
-void HostImpl::getParams(vm_params_t params)
-{
- *params = params_;
-}
+ xbt_dynar_t HostImpl::getVms()
+ {
+ xbt_dynar_t dyn = xbt_dynar_new(sizeof(simgrid::surf::VirtualMachineImpl*), nullptr);
-void HostImpl::setParams(vm_params_t params)
-{
- /* may check something here. */
- params_ = *params;
-}
+ for (VirtualMachineImpl* ws_vm : VirtualMachineImpl::allVms_) {
+ if (this == ws_vm->getPm()->pimpl_)
+ xbt_dynar_push(dyn, &ws_vm);
+ }
-}}
+ return dyn;
+ }
+ }
+ }
class XBT_PRIVATE HostModel;
class XBT_PRIVATE HostImpl;
class XBT_PRIVATE HostAction;
-
-
}
}
HostModel() : Model() {}
virtual void adjustWeightOfDummyCpuActions();
- virtual Action *executeParallelTask(int host_nb, sg_host_t *host_list,
- double *flops_amount, double *bytes_amount, double rate);
+ virtual Action* executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount,
+ double rate);
};
/************
class HostImpl : public simgrid::surf::PropertyHolder {
public:
- /**
- * @brief Host constructor
- *
- * @param storage The Storage associated to this Host
- */
HostImpl(s4u::Host* host, xbt_dynar_t storage);
-
- /* Host destruction logic */
- /**************************/
virtual ~HostImpl();
public:
/** @brief Return the storage of corresponding mount point */
- virtual simgrid::surf::Storage *findStorageOnMountList(const char* storage);
+ virtual simgrid::surf::Storage* findStorageOnMountList(const char* storage);
/** @brief Get the xbt_dict_t of mount_point: Storage */
virtual xbt_dict_t getMountedStorageList();
* @param fullpath The full path to the file
* @return The StorageAction corresponding to the opening
*/
- virtual Action *open(const char* fullpath);
+ virtual Action* open(const char* fullpath);
/**
* @brief Close a file
* @param fd The file descriptor to close
* @return The StorageAction corresponding to the closing
*/
- virtual Action *close(surf_file_t fd);
+ virtual Action* close(surf_file_t fd);
/**
* @brief Unlink a file
* @param size The size in bytes to read
* @return The StorageAction corresponding to the reading
*/
- virtual Action *read(surf_file_t fd, sg_size_t size);
+ virtual Action* read(surf_file_t fd, sg_size_t size);
/**
* @brief Write a file
* @param size The size in bytes to write
* @return The StorageAction corresponding to the writing
*/
- virtual Action *write(surf_file_t fd, sg_size_t size);
+ virtual Action* write(surf_file_t fd, sg_size_t size);
/**
* @brief Get the information of a file descriptor
/** @brief Get the list of virtual machines on the current Host */
xbt_dynar_t getVms();
- /* common with vm */
- /** @brief Retrieve a copy of the parameters of that VM/PM
- * @details The ramsize and overcommit fields are used on the PM too */
- void getParams(vm_params_t params);
- /** @brief Sets the params of that VM/PM */
- void setParams(vm_params_t params);
simgrid::s4u::Host* getHost() { return piface_; }
-private:
- s_vm_params_t params_;
};
-
}
}
namespace simgrid {
namespace surf {
-PropertyHolder::PropertyHolder(xbt_dict_t props)
-: properties_(props)
-{
-}
+PropertyHolder::PropertyHolder() = default;
PropertyHolder::~PropertyHolder() {
xbt_dict_free(&properties_);
class PropertyHolder { // DO NOT DERIVE THIS CLASS, or the diamond inheritance mayhem will get you
public:
- explicit PropertyHolder(xbt_dict_t props);
+ explicit PropertyHolder();
~PropertyHolder();
const char *getProperty(const char*id);
/* FIXME: TODO: we have to periodically input GUESTOS_NOISE to the system? how ? */
action_ = sub_cpu->execution_start(0);
+ /* Initialize the VM parameters */
+ params_.ramsize = 0;
+
XBT_VERB("Create VM(%s)@PM(%s) with %ld mounted disks", piface->name().c_str(), hostPM_->name().c_str(),
xbt_dynar_length(storage_));
}
{
action_->setBound(bound);
}
+
+void VirtualMachineImpl::getParams(vm_params_t params)
+{
+ *params = params_;
+}
+
+void VirtualMachineImpl::setParams(vm_params_t params)
+{
+ /* may check something here. */
+ params_ = *params;
+}
}
}
*/
class VirtualMachineImpl : public HostImpl {
public:
- VirtualMachineImpl(s4u::Host* piface, s4u::Host* host);
+ explicit VirtualMachineImpl(s4u::Host* piface, s4u::Host* host);
~VirtualMachineImpl();
/** @brief Suspend the VM */
virtual void setBound(double bound);
+ void getParams(vm_params_t params);
+ void setParams(vm_params_t params);
+
/* The vm object of the lower layer */
CpuAction* action_ = nullptr;
void setState(e_surf_vm_state_t state);
static std::deque<VirtualMachineImpl*> allVms_;
+private:
+ s_vm_params_t params_;
+
protected:
e_surf_vm_state_t vmState_ = SURF_VM_STATE_CREATED;
};
}
maxminSystem_ = lmm_system_new(selectiveUpdate_);
+ loopback_ = createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
- routing_model_create(createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, nullptr));
+ routing_model_create();
if (updateMechanism_ == UM_LAZY) {
actionHeap_ = xbt_heap_new(8, nullptr);
NetworkCm02Model::~NetworkCm02Model() {}
-Link* NetworkCm02Model::createLink(const char *name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy,
- xbt_dict_t properties)
+Link* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy)
{
- return new NetworkCm02Link(this, name, properties, bandwidth, latency, policy, maxminSystem_);
+ return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxminSystem_);
}
void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
/************
* Resource *
************/
-NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, xbt_dict_t props, double bandwidth,
- double latency, e_surf_link_sharing_policy_t policy, lmm_system_t system)
- : Link(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth), props)
+NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy, lmm_system_t system)
+ : Link(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth))
{
bandwidth_.scale = 1.0;
bandwidth_.peak = bandwidth;
NetworkCm02Model();
explicit NetworkCm02Model(void (*solve_fun)(lmm_system_t self));
virtual ~NetworkCm02Model();
- Link* createLink(const char *name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy,
- xbt_dict_t properties) override;
+ Link* createLink(const char* name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy) override;
void updateActionsStateLazy(double now, double delta) override;
void updateActionsStateFull(double now, double delta) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
class NetworkCm02Link : public Link {
public:
- NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
- double bandwidth, double latency, e_surf_link_sharing_policy_t policy,
- lmm_system_t system);
+ NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy, lmm_system_t system);
~NetworkCm02Link() override;
void apply_event(tmgr_trace_iterator_t event, double value) override;
void setBandwidth(double value) override;
surf_network_model = new simgrid::surf::NetworkConstantModel();
all_existing_models->push_back(surf_network_model);
- routing_model_create(nullptr);
+ routing_model_create();
}
namespace simgrid {
namespace surf {
- Link* NetworkConstantModel::createLink(const char *name, double bw, double lat, e_surf_link_sharing_policy_t policy,
- xbt_dict_t properties) {
+ Link* NetworkConstantModel::createLink(const char* name, double bw, double lat, e_surf_link_sharing_policy_t policy)
+ {
- xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
- "Please remove any link from your platform (and switch to routing='None')", name);
- return nullptr;
+ xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
+ "Please remove any link from your platform (and switch to routing='None')",
+ name);
+ return nullptr;
}
double NetworkConstantModel::nextOccuringEvent(double /*now*/)
double nextOccuringEvent(double now) override;
void updateActionsState(double now, double delta) override;
- Link* createLink(const char *name, double bw, double lat, e_surf_link_sharing_policy_t policy, xbt_dict_t properties) override;
+ Link* createLink(const char* name, double bw, double lat, e_surf_link_sharing_policy_t policy) override;
};
/**********
* Resource *
************/
- Link::Link(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint, xbt_dict_t props)
- : Resource(model, name, constraint), PropertyHolder(props)
+ Link::Link(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint)
+ : Resource(model, name, constraint)
{
if (strcmp(name,"__loopback__"))
xbt_assert(!Link::byName(name), "Link '%s' declared several times in the platform.", name);
* @param bandwidth The initial bandwidth of the Link in bytes per second
* @param latency The initial latency of the Link in seconds
* @param policy The sharing policy of the Link
- * @param props Dictionary of properties associated to this Link
*/
- virtual Link* createLink(const char *name, double bandwidth, double latency,
- e_surf_link_sharing_policy_t policy, xbt_dict_t properties)=0;
+ virtual Link* createLink(const char* name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy) = 0;
/**
* @brief Create a communication between two hosts.
*/
virtual double bandwidthConstraint(double rate, double bound, double size);
double nextOccuringEventFull(double now) override;
+
+ Link* loopback_ = nullptr;
};
/************
public:
/** @brief Constructor of LMM links */
- Link(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint, xbt_dict_t props);
+ Link(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint);
/* Link destruction logic */
/**************************/
NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
ns3_initialize(ns3_tcp_model.get().c_str());
- routing_model_create(nullptr);
+ routing_model_create();
simgrid::s4u::Host::onCreation.connect(ns3_add_host);
simgrid::kernel::routing::netcardCreatedCallbacks.connect(ns3_add_netcard);
simgrid::surf::on_cluster.connect (&parse_ns3_add_cluster);
xbt_dict_free(&flowFromSock);
}
-Link* NetworkNS3Model::createLink(const char *name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy,
- xbt_dict_t properties){
-
- return new LinkNS3(this, name, properties, bandwidth, latency);
+Link* NetworkNS3Model::createLink(const char* name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy)
+{
+ return new LinkNS3(this, name, bandwidth, latency);
}
Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
* Resource *
************/
-LinkNS3::LinkNS3(NetworkNS3Model* model, const char* name, xbt_dict_t props, double bandwidth, double latency)
- : Link(model, name, nullptr, props)
+LinkNS3::LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency)
+ : Link(model, name, nullptr)
{
bandwidth_.peak = bandwidth;
latency_.peak = latency;
public:
NetworkNS3Model();
~NetworkNS3Model();
- Link* createLink(const char *name, double bandwidth, double latency,
- e_surf_link_sharing_policy_t policy, xbt_dict_t properties) override;
+ Link* createLink(const char* name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
double nextOccuringEvent(double now) override;
bool nextOccuringEventIsIdempotent() {return false;}
************/
class LinkNS3 : public Link {
public:
- LinkNS3(NetworkNS3Model *model, const char *name, xbt_dict_t props, double bandwidth, double latency);
+ explicit LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency);
~LinkNS3();
void apply_event(tmgr_trace_iterator_t event, double value) override;
surf_network_model = new NetworkL07Model(this,maxminSystem_);
surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_);
- routing_model_create(surf_network_model->createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, nullptr));
+ routing_model_create();
}
HostL07Model::~HostL07Model() = default;
, hostModel_(hmodel)
{
maxminSystem_ = sys;
+ loopback_ = createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
}
NetworkL07Model::~NetworkL07Model()
{
return new CpuL07(this, host, speedPerPstate, core);
}
-Link* NetworkL07Model::createLink(const char *name, double bandwidth, double latency,
- e_surf_link_sharing_policy_t policy, xbt_dict_t properties)
+Link* NetworkL07Model::createLink(const char* name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy)
{
- return new LinkL07(this, name, properties, bandwidth, latency, policy);
+ return new LinkL07(this, name, bandwidth, latency, policy);
}
/************
CpuL07::~CpuL07()=default;
-LinkL07::LinkL07(NetworkL07Model* model, const char* name, xbt_dict_t props, double bandwidth, double latency,
+LinkL07::LinkL07(NetworkL07Model* model, const char* name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
- : Link(model, name, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth), props)
+ : Link(model, name, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth))
{
bandwidth_.peak = bandwidth;
latency_.peak = latency;
public:
NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys);
~NetworkL07Model();
- Link* createLink(const char *name, double bandwidth, double latency,
- e_surf_link_sharing_policy_t policy,
- xbt_dict_t properties) override;
+ Link* createLink(const char* name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
class LinkL07 : public Link {
public:
- LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
- double bandwidth, double latency, e_surf_link_sharing_policy_t policy);
+ LinkL07(NetworkL07Model* model, const char* name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy);
~LinkL07(){ };
bool isUsed() override;
void apply_event(tmgr_trace_iterator_t event, double value) override;
}
/** @brief Add an host to the current AS */
-void sg_platf_new_host(sg_platf_host_cbarg_t host)
+void sg_platf_new_host(sg_platf_host_cbarg_t args)
{
- simgrid::kernel::routing::AsImpl* current_routing = routing_get_current();
-
- simgrid::s4u::Host* h = new simgrid::s4u::Host(host->id);
- current_routing->attachHost(h);
-
- if (host->coord && strcmp(host->coord, "")) {
- new simgrid::kernel::routing::vivaldi::Coords(h, host->coord);
- }
-
- simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu( h, &host->speed_per_pstate, host->core_amount);
- if (host->state_trace)
- cpu->setStateTrace(host->state_trace);
- if (host->speed_trace)
- cpu->setSpeedTrace(host->speed_trace);
-
- new simgrid::surf::HostImpl(h, mount_list);
- xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, static_cast<void*>(mount_list));
+ simgrid::s4u::Host* host = routing_get_current()->createHost(args->id, &args->speed_per_pstate, args->core_amount);
+ new simgrid::surf::HostImpl(host, mount_list);
+ xbt_lib_set(storage_lib, args->id, ROUTING_STORAGE_HOST_LEVEL, static_cast<void*>(mount_list));
mount_list = nullptr;
- if (host->properties) {
+ if (args->properties) {
xbt_dict_cursor_t cursor=nullptr;
char *key,*data;
- xbt_dict_foreach(host->properties,cursor,key,data)
- h->setProperty(key,data);
- xbt_dict_free(&host->properties);
+ xbt_dict_foreach (args->properties, cursor, key, data)
+ host->setProperty(key, data);
+ xbt_dict_free(&args->properties);
}
- if (host->pstate != 0)
- cpu->setPState(host->pstate);
+ /* Change from the defaults */
+ if (args->state_trace)
+ host->pimpl_cpu->setStateTrace(args->state_trace);
+ if (args->speed_trace)
+ host->pimpl_cpu->setSpeedTrace(args->speed_trace);
+ if (args->pstate != 0)
+ host->pimpl_cpu->setPState(args->pstate);
+ if (args->coord && strcmp(args->coord, ""))
+ new simgrid::kernel::routing::vivaldi::Coords(host, args->coord);
- simgrid::s4u::Host::onCreation(*h);
+ simgrid::s4u::Host::onCreation(*host);
if (TRACE_is_enabled() && TRACE_needs_platform())
- sg_instr_new_host(*h);
+ sg_instr_new_host(*host);
}
/** @brief Add a "router" to the network element list */
names.push_back(xbt_strdup(link->id));
}
for (auto link_name : names) {
- Link *l = surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy, link->properties);
+ Link* l = surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy);
+
+ if (link->properties) {
+ xbt_dict_cursor_t cursor = nullptr;
+ char *key, *data;
+ xbt_dict_foreach (link->properties, cursor, key, data)
+ l->setProperty(key, data);
+ xbt_dict_free(&link->properties);
+ }
if (link->latency_trace)
l->setLatencyTrace(link->latency_trace);
storage->content_type,
storage->properties);
- surf_storage_model->createStorage(storage->id,
- ((storage_type_t) stype)->type_id,
- storage->content,
- storage->content_type,
- storage->properties,
- storage->attach);
+ auto s = surf_storage_model->createStorage(storage->id, ((storage_type_t)stype)->type_id, storage->content,
+ storage->content_type, storage->attach);
+
+ if (storage->properties) {
+ xbt_dict_cursor_t cursor = nullptr;
+ char *key, *data;
+ xbt_dict_foreach (storage->properties, cursor, key, data)
+ s->setProperty(key, data);
+ xbt_dict_free(&storage->properties);
+ }
}
void sg_platf_new_storage_type(sg_platf_storage_type_cbarg_t storage_type){
* Resource *
************/
-Storage::Storage(Model *model, const char *name, xbt_dict_t props,
- lmm_system_t maxminSystem, double bread, double bwrite,
- double bconnection, const char* type_id, const char *content_name,
- const char *content_type, sg_size_t size, const char *attach)
- : Resource(model, name, lmm_constraint_new(maxminSystem, this, bconnection))
- , PropertyHolder(props)
- , contentType_(xbt_strdup(content_type))
- , size_(size), usedSize_(0)
- , typeId_(xbt_strdup(type_id))
- , writeActions_(std::vector<StorageAction*>())
+Storage::Storage(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
+ double bconnection, const char* type_id, const char* content_name, const char* content_type,
+ sg_size_t size, const char* attach)
+ : Resource(model, name, lmm_constraint_new(maxminSystem, this, bconnection))
+ , contentType_(xbt_strdup(content_type))
+ , size_(size)
+ , usedSize_(0)
+ , typeId_(xbt_strdup(type_id))
+ , writeActions_(std::vector<StorageAction*>())
{
content_ = parseContent(content_name);
attach_ = xbt_strdup(attach);
StorageModel();
~StorageModel();
- virtual Storage *createStorage(const char* id, const char* type_id,
- const char* content_name, const char* content_type,
- xbt_dict_t properties, const char *attach) = 0;
+ virtual Storage* createStorage(const char* id, const char* type_id, const char* content_name,
+ const char* content_type, const char* attach) = 0;
std::vector<Storage*> p_storageList;
};
* @param name The name of the Storage
* @param props Dictionary of properties associated to this Storage
*/
- Storage(Model *model, const char *name, xbt_dict_t props,
- lmm_system_t maxminSystem, double bread, double bwrite,
- double bconnection,
- const char* type_id, const char *content_name, const char *content_type,
- sg_size_t size, const char *attach);
+ Storage(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
+ const char* type_id, const char* content_name, const char* content_type, sg_size_t size, const char* attach);
~Storage();
namespace surf {
#include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
-Storage *StorageN11Model::createStorage(const char* id, const char* type_id,
- const char* content_name, const char* content_type, xbt_dict_t properties, const char* attach)
+Storage* StorageN11Model::createStorage(const char* id, const char* type_id, const char* content_name,
+ const char* content_type, const char* attach)
{
xbt_assert(!surf_storage_resource_priv(surf_storage_resource_by_name(id)),
double Bconnection = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection"),
"property Bconnection, storage",type_id);
- Storage *storage = new StorageN11(this, id, properties, maxminSystem_,
- Bread, Bwrite, Bconnection, type_id, (char *)content_name,
- content_type, storage_type->size, (char *) attach);
+ Storage* storage = new StorageN11(this, id, maxminSystem_, Bread, Bwrite, Bconnection, type_id, (char*)content_name,
+ content_type, storage_type->size, (char*)attach);
storageCreatedCallbacks(storage);
xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, storage);
- XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tproperties '%p'\n\t\tBread '%f'\n",
- id, type_id, properties, Bread);
+ XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tBread '%f'\n", id, type_id, Bread);
p_storageList.push_back(storage);
* Resource *
************/
-StorageN11::StorageN11(StorageModel *model, const char* name,
- xbt_dict_t properties, lmm_system_t maxminSystem, double bread,
- double bwrite, double bconnection, const char* type_id, char *content_name,
- const char *content_type, sg_size_t size, char *attach)
-: Storage(model, name, properties,
- maxminSystem, bread, bwrite, bconnection, type_id, content_name, content_type, size, attach) {
+StorageN11::StorageN11(StorageModel* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
+ double bconnection, const char* type_id, char* content_name, const char* content_type,
+ sg_size_t size, char* attach)
+ : Storage(model, name, maxminSystem, bread, bwrite, bconnection, type_id, content_name, content_type, size, attach)
+{
XBT_DEBUG("Create resource with Bconnection '%f' Bread '%f' Bwrite '%f' and Size '%llu'", bconnection, bread, bwrite, size);
}
class StorageN11Model : public StorageModel {
public:
- Storage *createStorage(const char* id, const char* type_id,
- const char* content_name, const char* content_type, xbt_dict_t properties, const char* attach) override;
+ Storage* createStorage(const char* id, const char* type_id, const char* content_name, const char* content_type,
+ const char* attach) override;
double nextOccuringEvent(double now) override;
void updateActionsState(double now, double delta) override;
};
class StorageN11 : public Storage {
public:
- StorageN11(StorageModel *model, const char* name, xbt_dict_t properties,
- lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
- const char* type_id, char *content_name, const char *content_type, sg_size_t size, char *attach);
+ StorageN11(StorageModel* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
+ double bconnection, const char* type_id, char* content_name, const char* content_type, sg_size_t size,
+ char* attach);
StorageAction *open(const char* mount, const char* path);
StorageAction *close(surf_file_t fd);
StorageAction *ls(const char *path);
- StorageAction *read(surf_file_t fd, sg_size_t size); //FIXME:why we have a useless param *??
- StorageAction *write(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param *??
+ StorageAction* read(surf_file_t fd, sg_size_t size);
+ StorageAction* write(surf_file_t fd, sg_size_t size);
void rename(const char *src, const char *dest);
};
namespace simgrid {
namespace surf {
-Resource::Resource(Model *model, const char *name, lmm_constraint_t constraint)
- : name_(xbt_strdup(name))
- , model_(model)
- , constraint_(constraint)
+Resource::Resource(Model* model, const char* name, lmm_constraint_t constraint)
+ : name_(name), model_(model), constraint_(constraint)
{}
-Resource::~Resource() {
- free(name_);
-}
+Resource::~Resource() = default;
bool Resource::isOn() const {
return isOn_;
}
const char *Resource::getName() const {
- return name_;
+ return name_.c_str();
}
bool Resource::operator==(const Resource &other) const {
- return strcmp(name_, other.name_);
+ return name_ == other.name_;
}
lmm_constraint_t Resource::getConstraint() const {
virtual void turnOff();
private:
- char* name_;
+ std::string name_;
Model *model_;
bool isOn_ = true;
}}}
/** @brief create the root AS */
-void routing_model_create(Link *loopback)
+void routing_model_create()
{
- routing_platf = new simgrid::kernel::routing::RoutingPlatf(loopback);
+ routing_platf = new simgrid::kernel::routing::RoutingPlatf();
}
/* ************************************************************************** */
delete routing_platf;
}
-simgrid::kernel::routing::RoutingPlatf::RoutingPlatf(simgrid::surf::Link *loopback)
-: loopback_(loopback)
-{
-}
+simgrid::kernel::routing::RoutingPlatf::RoutingPlatf() = default;
simgrid::kernel::routing::RoutingPlatf::~RoutingPlatf()
{
delete root_;
#include <vector>
SG_BEGIN_DECL()
-XBT_PUBLIC(void) routing_model_create(Link *loopback);
+XBT_PUBLIC(void) routing_model_create();
XBT_PRIVATE xbt_node_t new_xbt_graph_node (xbt_graph_t graph, const char *name, xbt_dict_t nodes);
XBT_PRIVATE xbt_edge_t new_xbt_graph_edge (xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xbt_dict_t edges);
SG_END_DECL()
*/
XBT_PUBLIC_CLASS RoutingPlatf {
public:
- explicit RoutingPlatf(Link *loopback);
+ explicit RoutingPlatf();
~RoutingPlatf();
AsImpl *root_ = nullptr;
- Link *loopback_;
xbt_dynar_t getOneLinkRoutes();
void getRouteAndLatency(NetCard *src, NetCard *dst, std::vector<Link*> * links, double *latency);
};
set(NS3_HINT ${ns3_path} CACHE PATH "Path to search for NS3 lib and include")
find_library(NS3_LIBRARIES
- NAME ns3-core ns3.14-core ns3.15-core ns3.16-core ns3.17-core ns3.18-core ns3.19-core ns3.20-core ns3.21-core ns3.22-core ns3.25-core
+ NAME ns3-core ns3.14-core ns3.15-core ns3.16-core ns3.17-core ns3.18-core ns3.19-core ns3.20-core ns3.21-core ns3.22-core ns3.25-core ns3.26-core ns3.27-core ns3.28-core
PATH_SUFFIXES lib64 lib ns3/lib
PATHS
${NS3_HINT}
find_path(NS3_INCLUDE_DIR
NAME ns3/core-module.h
- PATH_SUFFIXES include ns3/include include/ns3.14 include/ns3.15 include/ns3.16 include/ns3.17 include/ns3.18 include/ns3.19 include/ns3.20 include/ns3.21 include/ns3.22 include/ns3.25
+ PATH_SUFFIXES include ns3/include include/ns3.14 include/ns3.15 include/ns3.16 include/ns3.17 include/ns3.18 include/ns3.19 include/ns3.20 include/ns3.21 include/ns3.22 include/ns3.25 include/ns3.26 include/ns3.27 include/ns3.28
PATHS
${NS3_HINT}
)