std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(src_elm, dst_elm, &route, nullptr);
for (auto const& link : route)
- instr_user_variable(time, link->cname(), variable, father_type, value, what, nullptr, &user_link_variables);
+ instr_user_variable(time, link->getCname(), variable, father_type, value, what, nullptr, &user_link_variables);
}
/** \ingroup TRACE_API
xbt_node_t backboneNode = nullptr;
if (backbone_) {
- backboneNode = new_xbt_graph_node(graph, backbone_->cname(), nodes);
+ backboneNode = new_xbt_graph_node(graph, backbone_->getCname(), nodes);
new_xbt_graph_edge(graph, routerNode, backboneNode, edges);
}
std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id());
if (info.first) { // link up
- xbt_node_t current = new_xbt_graph_node(graph, info.first->cname(), nodes);
+ xbt_node_t current = new_xbt_graph_node(graph, info.first->getCname(), nodes);
new_xbt_graph_edge(graph, previous, current, edges);
if (backbone_) {
}
if (info.second) { // link down
- xbt_node_t current = new_xbt_graph_node(graph, info.second->cname(), nodes);
+ xbt_node_t current = new_xbt_graph_node(graph, info.second->getCname(), nodes);
new_xbt_graph_edge(graph, previous, current, edges);
if (backbone_) {
}
for (auto const& link : *route->link_list) {
- const char* link_name = link->cname();
+ const char* link_name = link->getCname();
current = new_xbt_graph_node(graph, link_name, nodes);
current_name = link_name;
new_xbt_graph_edge(graph, previous, current, edges);
XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", getCname(), dest->getCname(),
(latency == nullptr ? -1 : *latency));
for (auto const& link : *links)
- XBT_CDEBUG(surf_route, "Link %s", link->cname());
+ XBT_CDEBUG(surf_route, "Link %s", link->getCname());
}
}
}
const char* Link::name()
{
- return this->pimpl_->cname();
+ return this->pimpl_->getCname();
}
bool Link::isUsed()
{
const char* Storage::getName()
{
- return pimpl_->cname();
+ return pimpl_->getCname();
}
const char* Storage::getType()
});
simgrid::surf::storageCreatedCallbacks.connect([](simgrid::surf::StorageImpl* storage) {
- sg_storage_t s = simgrid::s4u::Storage::byName(storage->cname());
- xbt_assert(s != nullptr, "Storage not found for name %s", storage->cname());
+ sg_storage_t s = simgrid::s4u::Storage::byName(storage->getCname());
+ xbt_assert(s != nullptr, "Storage not found for name %s", storage->getCname());
});
}
Action* FileImpl::read(sg_size_t size)
{
- XBT_DEBUG("READ %s on disk '%s'", cname(), location_->cname());
+ XBT_DEBUG("READ %s on disk '%s'", cname(), location_->getCname());
if (current_position_ + size > size_) {
if (current_position_ > size_) {
size = 0;
Action* FileImpl::write(sg_size_t size)
{
- XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu'", cname(), location_->cname(), size, size_);
+ XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu'", cname(), location_->getCname(), size, size_);
StorageAction* action = location_->write(size);
action->file_ = this;
{
/* Check if the file is on this storage */
if (location_->getContent()->find(path_) == location_->getContent()->end()) {
- XBT_WARN("File %s is not on disk %s. Impossible to unlink", cname(), location_->cname());
+ XBT_WARN("File %s is not on disk %s. Impossible to unlink", cname(), location_->getCname());
return -1;
} else {
- XBT_DEBUG("UNLINK %s on disk '%s'", cname(), location_->cname());
+ XBT_DEBUG("UNLINK %s on disk '%s'", cname(), location_->getCname());
location_->usedSize_ -= size_;
// Remove the file from storage
-/* Copyright (c) 2009-2011, 2013-2016. The SimGrid Team.
+/* Copyright (c) 2009-2011, 2013-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
if (duration > 0)
duration = MAX(duration, sg_surf_precision);
- XBT_IN("(%s,%g)", cname(), duration);
+ XBT_IN("(%s,%g)", getCname(), duration);
CpuCas01Action* action = new CpuCas01Action(model(), 1.0, isOff(), speed_.scale * speed_.peak, constraint());
// FIXME: sleep variables should not consume 1.0 in lmm_expand
XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
if (TRACE_is_enabled()) {
Cpu *cpu = static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)));
- TRACE_surf_host_set_utilization(cpu->cname(), action->getCategory(), lmm_variable_getvalue(action->getVariable()),
- action->getLastUpdate(), now - action->getLastUpdate());
+ TRACE_surf_host_set_utilization(cpu->getCname(), action->getCategory(),
+ lmm_variable_getvalue(action->getVariable()), action->getLastUpdate(),
+ now - action->getLastUpdate());
}
action->finish(Action::State::done);
if (TRACE_is_enabled()) {
Cpu *cpu = static_cast<Cpu*> (lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)) );
- TRACE_surf_host_set_utilization(cpu->cname(), action->getCategory(), lmm_variable_getvalue(action->getVariable()),
- now - delta, delta);
+ TRACE_surf_host_set_utilization(cpu->getCname(), action->getCategory(),
+ lmm_variable_getvalue(action->getVariable()), now - delta, delta);
TRACE_last_timestamp_to_dump = now - delta;
}
void Cpu::setPState(int pstate_index)
{
xbt_assert(pstate_index <= static_cast<int>(speedPerPstate_.size()),
- "Invalid parameters for CPU %s (pstate %d > length of pstates %d)", cname(), pstate_index,
+ "Invalid parameters for CPU %s (pstate %d > length of pstates %d)", getCname(), pstate_index,
static_cast<int>(speedPerPstate_.size()));
double new_peak_speed = speedPerPstate_[pstate_index];
}
void Cpu::onSpeedChange() {
- TRACE_surf_host_set_speed(surf_get_clock(), cname(), coresAmount_ * speed_.scale * speed_.peak);
+ TRACE_surf_host_set_speed(surf_get_clock(), getCname(), coresAmount_ * speed_.scale * speed_.peak);
s4u::Host::onSpeedChange(*host_);
}
if (TRACE_is_enabled()) {
Cpu *cpu = static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0)));
- TRACE_surf_host_set_utilization(cpu->cname(), getCategory(), lastValue_, lastUpdate_, now - lastUpdate_);
+ TRACE_surf_host_set_utilization(cpu->getCname(), getCategory(), lastValue_, lastUpdate_, now - lastUpdate_);
}
XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, remains_);
}
if (min_finish > NO_MAX_DURATION)
xbt_heap_push(static_cast<CpuTiModel*>(model())->tiActionHeap_, action, min_finish);
- XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", cname(), action,
- action->getStartTime(), action->finishTime_, action->getMaxDuration());
+ XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", getCname(),
+ action, action->getStartTime(), action->finishTime_, action->getMaxDuration());
}
/* remove from modified cpu */
modified(false);
CpuAction *CpuTi::execution_start(double size)
{
- XBT_IN("(%s,%g)", cname(), size);
+ XBT_IN("(%s,%g)", getCname(), size);
CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), size, isOff(), this);
actionSet_->push_back(*action);
if (duration > 0)
duration = MAX(duration, sg_surf_precision);
- XBT_IN("(%s,%g)", cname(), duration);
+ XBT_IN("(%s,%g)", getCname(), duration);
CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), 1.0, isOff(), this);
action->maxDuration_ = duration;
NetworkCm02Link *link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
double value = lmm_variable_getvalue(action->getVariable())*
lmm_get_cnst_weight_from_var(maxminSystem_, action->getVariable(), i);
- TRACE_surf_link_set_utilization(link->cname(), action->getCategory(), value, action->getLastUpdate(),
+ TRACE_surf_link_set_utilization(link->getCname(), action->getCategory(), value, action->getLastUpdate(),
now - action->getLastUpdate());
}
}
lmm_constraint_t constraint = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i);
NetworkCm02Link* link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
- TRACE_surf_link_set_utilization(link->cname(), action->getCategory(),
+ TRACE_surf_link_set_utilization(link->getCname(), action->getCategory(),
(lmm_variable_getvalue(action->getVariable()) *
lmm_get_cnst_weight_from_var(maxminSystem_, action->getVariable(), i)),
action->getLastUpdate(), now - action->getLastUpdate());
lmm_update_constraint_bound(model()->getMaxminSystem(), constraint(),
sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale));
- TRACE_surf_link_set_bandwidth(surf_get_clock(), cname(), sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale);
+ TRACE_surf_link_set_bandwidth(surf_get_clock(), getCname(), sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale);
if (sg_weight_S_parameter > 0) {
double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale);
}
void LinkImpl::setStateTrace(tmgr_trace_t trace)
{
- xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Link %s", cname());
+ xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Link %s", getCname());
stateEvent_ = future_evt_set->add_trace(trace, this);
}
void LinkImpl::setBandwidthTrace(tmgr_trace_t trace)
{
- xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth trace to Link %s", cname());
+ xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth trace to Link %s", getCname());
bandwidth_.event = future_evt_set->add_trace(trace, this);
}
void LinkImpl::setLatencyTrace(tmgr_trace_t trace)
{
- xbt_assert(latency_.event == nullptr, "Cannot set a second latency trace to Link %s", cname());
+ xbt_assert(latency_.event == nullptr, "Cannot set a second latency trace to Link %s", getCname());
latency_.event = future_evt_set->add_trace(trace, this);
}
if (link_list->size() == 1) {
simgrid::surf::LinkNS3* link = static_cast<simgrid::surf::LinkNS3*>(link_list->at(0));
- XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->getCname(), dst->getCname(), link->cname(),
+ XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->getCname(), dst->getCname(), link->getCname(),
(symmetrical ? "(symmetrical)" : "(not symmetrical)"));
// XBT_DEBUG("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id);
- XBT_DEBUG("\tLink (%s) bw:%fbps lat:%fs", link->cname(), link->bandwidth(),
- link->latency());
+ XBT_DEBUG("\tLink (%s) bw:%fbps lat:%fs", link->getCname(), link->bandwidth(), link->latency());
// create link ns3
NetPointNs3* host_src = src->extension<NetPointNs3>();
action->src_->routeTo(action->dst_, &route, nullptr);
for (auto const& link : route)
- TRACE_surf_link_set_utilization(link->cname(), action->getCategory(), (data_delta_sent) / delta, now - delta,
+ TRACE_surf_link_set_utilization(link->getCname(), action->getCategory(), (data_delta_sent) / delta, now - delta,
delta);
action->lastSent_ = sgFlow->sentBytes_;
latency = MAX(latency, lat);
for (auto const& link : route)
- affected_links.insert(link->cname());
+ affected_links.insert(link->getCname());
}
}
}
void CpuL07::apply_event(tmgr_trace_event_t triggered, double value)
{
- XBT_DEBUG("Updating cpu %s (%p) with value %g", cname(), this, value);
+ XBT_DEBUG("Updating cpu %s (%p) with value %g", getCname(), this, value);
if (triggered == speed_.event) {
speed_.scale = value;
onSpeedChange();
void LinkL07::apply_event(tmgr_trace_event_t triggered, double value)
{
- XBT_DEBUG("Updating link %s (%p) with value=%f", cname(), this, value);
+ XBT_DEBUG("Updating link %s (%p) with value=%f", getCname(), this, value);
if (triggered == bandwidth_.event) {
setBandwidth(value);
tmgr_trace_event_unref(&bandwidth_.event);
for (auto const& s : *simgrid::surf::StorageImpl::storagesMap()) {
simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(s.second->getHost().c_str());
if (not host_elm)
- surf_parse_error(std::string("Unable to attach storage ") + s.second->cname() + ": host " + s.second->getHost() +
- " does not exist.");
+ surf_parse_error(std::string("Unable to attach storage ") + s.second->getCname() + ": host " +
+ s.second->getHost() + " does not exist.");
else
s.second->piface_.attached_to_ = sg_host_by_name(s.second->getHost().c_str());
}
e_surf_action_storage_type_t type)
: StorageAction(model, cost, failed, lmm_variable_new(model->getMaxminSystem(), this, 1.0, -1.0, 3), storage, type)
{
- XBT_IN("(%s,%g", storage->cname(), cost);
+ XBT_IN("(%s,%g", storage->getCname(), cost);
// Must be less than the max bandwidth for all actions
lmm_expand(model->getMaxminSystem(), storage->constraint(), getVariable(), 1.0);
XBT_DEBUG("Updating models (min = %g, NOW = %g, next_event_date = %g)", time_delta, NOW, next_event_date);
while ((event = future_evt_set->pop_leq(next_event_date, &value, &resource))) {
- if (resource->isUsed() || (watched_hosts.find(resource->cname()) != watched_hosts.end())) {
+ if (resource->isUsed() || (watched_hosts.find(resource->getCname()) != watched_hosts.end())) {
time_delta = next_event_date - NOW;
XBT_DEBUG("This event invalidates the next_occuring_event() computation of models. Next event set to %f", time_delta);
}
NOW = next_event_date;
/* update state of the corresponding resource to the new value. Does not touch lmm.
It will be modified if needed when updating actions */
- XBT_DEBUG("Calling update_resource_state for resource %s", resource->cname());
+ XBT_DEBUG("Calling update_resource_state for resource %s", resource->getCname());
resource->apply_event(event, value);
NOW = round_start;
}
return model_;
}
-const char* Resource::cname() const
+const std::string& Resource::getName() const
+{
+ return name_;
+}
+
+const char* Resource::getCname() const
{
return name_.c_str();
}
Model* model() const;
/** @brief Get the name of the current Resource */
- const char* cname() const;
+ const std::string& getName() const;
+ /** @brief Get the name of the current Resource */
+ const char* getCname() const;
bool operator==(const Resource &other) const;
namespace std {
template <> class hash<simgrid::surf::Resource> {
public:
- std::size_t operator()(const simgrid::surf::Resource& r) const { return (std::size_t)xbt_str_hash(r.cname()); }
- };
+ std::size_t operator()(const simgrid::surf::Resource& r) const { return (std::size_t)xbt_str_hash(r.getCname()); }
+};
}
#endif /* SURF_MODEL_H_ */
if (not route.empty()) {
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->getCname(), host2->getCname());
for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->cname());
+ std::printf("<link_ctn id=\"%s\"/>", link->getCname());
std::printf("\n </route>\n");
}
}
std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->cname());
+ std::printf("<link_ctn id=\"%s\"/>", link->getCname());
std::printf("\n </route>\n");
}
}
std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, &route, nullptr);
for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->cname());
+ std::printf("<link_ctn id=\"%s\"/>", link->getCname());
std::printf("\n </route>\n");
}
}
simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, &route, nullptr);
for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->cname());
+ std::printf("<link_ctn id=\"%s\"/>", link->getCname());
std::printf("\n </route>\n");
}
}