simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName(mark_type);
if (not type) {
THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
- }
-
- if (not mark_color)
- mark_color = "1.0 1.0 1.0" /*white*/;
+ } else {
+ if (not mark_color)
+ mark_color = "1.0 1.0 1.0" /*white*/;
- XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
- type->addEntityValue(mark_value, mark_color);
+ XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
+ type->addEntityValue(mark_value, mark_color);
+ }
}
/** \ingroup TRACE_mark
simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName(mark_type);
if (not type) {
THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
+ } else {
+ XBT_DEBUG("MARK %s %s", mark_type, mark_value);
+ new simgrid::instr::NewEvent(MSG_get_clock(), PJ_container_get_root(), type, type->getEntityValue(mark_value));
}
-
- XBT_DEBUG("MARK %s %s", mark_type, mark_value);
- new simgrid::instr::NewEvent(MSG_get_clock(), PJ_container_get_root(), type, type->getEntityValue(mark_value));
}
/** \ingroup TRACE_mark
namespace simgrid {
namespace instr {
-Container::Container(std::string name, e_container_types kind, Container* father)
- : kind_(kind), name_(name), father_(father)
+NetZoneContainer::NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father)
+ : Container::Container(name, "", father)
+{
+ netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+ xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
+ if (father_) {
+ type_ = father_->type_->getOrCreateContainerType(std::string("L") + std::to_string(level));
+ father_->children_.insert({getName(), this});
+ logCreation();
+ } else {
+ type_ = Type::createRootType();
+ PJ_container_set_root(this);
+ }
+}
+
+RouterContainer::RouterContainer(std::string name, Container* father) : Container::Container(name, "ROUTER", father)
+{
+ xbt_assert(father, "Only the Root container has no father");
+
+ netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+ xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
+
+ trivaNodeTypes.insert(type_->getName());
+}
+
+HostContainer::HostContainer(simgrid::s4u::Host& host, NetZoneContainer* father)
+ : Container::Container(host.getCname(), "HOST", father)
+{
+ xbt_assert(father, "Only the Root container has no father");
+
+ netpoint_ = host.pimpl_netpoint;
+ xbt_assert(netpoint_, "Element '%s' not found", host.getCname());
+
+ trivaNodeTypes.insert(type_->getName());
+}
+
+Container::Container(std::string name, std::string type_name, Container* father) : name_(name), father_(father)
{
static long long int container_id = 0;
- id_ = std::to_string(container_id); // id (or alias) of the container
+ id_ = container_id; // id (or alias) of the container
container_id++;
if (father_) {
- level_ = father_->level_ + 1;
XBT_DEBUG("new container %s, child of %s", name.c_str(), father->name_.c_str());
- }
- // Search for network_element_t for AS, ROUTER and HOST
- // Name the kind of container. For AS otherwise, the name depends on its level
- std::string typeNameBuff;
- switch (kind_) {
- case INSTR_AS:
- netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
- xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
- typeNameBuff = std::string("L") + std::to_string(level_);
- break;
- case INSTR_ROUTER:
- netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
- xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
- typeNameBuff = std::string("ROUTER");
- break;
- case INSTR_HOST:
- netpoint_ = sg_host_by_name(name.c_str())->pimpl_netpoint;
- xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
- typeNameBuff = std::string("HOST");
- break;
- case INSTR_LINK:
- typeNameBuff = std::string("LINK");
- break;
- case INSTR_SMPI:
- typeNameBuff = std::string("MPI");
- break;
- case INSTR_MSG_PROCESS:
- typeNameBuff = std::string("MSG_PROCESS");
- break;
- case INSTR_MSG_VM:
- typeNameBuff = std::string("MSG_VM");
- break;
- case INSTR_MSG_TASK:
- typeNameBuff = std::string("MSG_TASK");
- break;
- default:
- THROWF(tracing_error, 0, "new container kind is unknown.");
- break;
- }
-
- if (father_) {
- type_ = father_->type_->getOrCreateContainerType(typeNameBuff);
- father_->children_.insert({name_, this});
- logCreation();
- } else if (kind_ == INSTR_AS) {
- type_ = Type::createRootType();
+ if (not type_name.empty()) {
+ type_ = father_->type_->getOrCreateContainerType(type_name);
+ father_->children_.insert({name_, this});
+ logCreation();
+ }
}
//register all kinds by name
XBT_DEBUG("Add container name '%s'", name_.c_str());
//register NODE types for triva configuration
- if (kind_ == INSTR_HOST || kind_ == INSTR_LINK || kind_ == INSTR_ROUTER)
+ if (type_name == "LINK")
trivaNodeTypes.insert(type_->getName());
}
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_ << " " << value;
+ stream << " " << type->getId() << " " << container->getId() << " " << value;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_ << " " << value;
+ stream << " " << type->getId() << " " << container->getId() << " " << value;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_ << " " << value;
+ stream << " " << type->getId() << " " << container->getId() << " " << value;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_;
+ stream << " " << type->getId() << " " << container->getId();
stream << " " << value->getId();
#if HAVE_SMPI
if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_;
+ stream << " " << type->getId() << " " << container->getId();
stream << " " << value->getId();
if (TRACE_display_sizes()) {
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_;
+ stream << " " << type->getId() << " " << container->getId();
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_;
+ stream << " " << type->getId() << " " << container->getId();
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_ << " " << value_;
- stream << " " << sourceContainer_->id_ << " " << key_;
+ stream << " " << type->getId() << " " << container->getId() << " " << value_;
+ stream << " " << sourceContainer_->getId() << " " << key_;
if (TRACE_display_sizes()) {
stream << " " << size_;
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_ << " " << value;
- stream << " " << destContainer->id_ << " " << key;
+ stream << " " << type->getId() << " " << container->getId() << " " << value;
+ stream << " " << destContainer->getId() << " " << key;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
stream << std::fixed << std::setprecision(TRACE_precision());
stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->getId() << " " << container->id_ << " " << val->getId();
+ stream << " " << type->getId() << " " << container->getId() << " " << val->getId();
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
static Type* getRootType();
};
-//--------------------------------------------------
class Value {
std::string name_;
std::string id_;
void print();
};
-//--------------------------------------------------
-enum e_container_types {
- INSTR_HOST,
- INSTR_LINK,
- INSTR_ROUTER,
- INSTR_AS,
- INSTR_SMPI,
- INSTR_MSG_VM,
- INSTR_MSG_PROCESS,
- INSTR_MSG_TASK
-};
-
class Container {
- e_container_types kind_; /* This container is of what kind */
+ long long int id_;
std::string name_; /* Unique name of this container */
- int level_ = 0; /* Level in the hierarchy, root level is 0 */
- sg_netpoint_t netpoint_ = nullptr;
-
public:
- Container(std::string name, simgrid::instr::e_container_types kind, Container* father);
+ Container(std::string name, std::string type_name, Container* father);
virtual ~Container();
- std::string id_; /* Unique id of this container */
Type* type_; /* Type of this container */
Container* father_;
std::map<std::string, Container*> children_;
+ sg_netpoint_t netpoint_ = nullptr;
+
static Container* byNameOrNull(std::string name);
static Container* byName(std::string name);
std::string getName() { return name_; }
const char* getCname() { return name_.c_str(); }
+ long long int getId() { return id_; }
void removeFromParent();
void logCreation();
void logDestruction();
};
-//--------------------------------------------------
+class NetZoneContainer : public Container {
+public:
+ NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father);
+};
+
+class RouterContainer : public Container {
+public:
+ RouterContainer(std::string name, Container* father);
+};
+
+class HostContainer : public Container {
+public:
+ HostContainer(simgrid::s4u::Host& host, NetZoneContainer* father);
+};
+
class PajeEvent {
protected:
Container* container;
{
if (TRACE_msg_process_is_enabled()){
container_t host_container = simgrid::instr::Container::byName(host->getName());
- new simgrid::instr::Container(std::string(process_name) + "-" + std::to_string(process_pid),
- simgrid::instr::INSTR_MSG_PROCESS, host_container);
+ new simgrid::instr::Container(std::string(process_name) + "-" + std::to_string(process_pid), "MSG_PROCESS",
+ host_container);
}
}
delete existing_container;
// create new container on the new_host location
- new simgrid::instr::Container(vm->getCname(), simgrid::instr::INSTR_MSG_VM,
- simgrid::instr::Container::byName(ms->dst_pm->getName()));
+ new simgrid::instr::Container(vm->getCname(), "MSG_VM", simgrid::instr::Container::byName(ms->dst_pm->getName()));
// end link
msg = simgrid::instr::Container::byName(vm->getName());
if (TRACE_msg_vm_is_enabled()) {
container_t host_container = simgrid::instr::Container::byName(pm->getName());
- new simgrid::instr::Container(name, simgrid::instr::INSTR_MSG_VM, host_container);
+ new simgrid::instr::Container(name, "MSG_VM", host_container);
}
}
#if HAVE_PAPI
container_t container =
#endif
- new simgrid::instr::Container(str, simgrid::instr::INSTR_SMPI, father);
+ new simgrid::instr::Container(str, "MPI", father);
#if HAVE_PAPI
papi_counter_t counters = smpi_process()->papi_counters();
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
static int platform_created = 0; /* indicate whether the platform file has been traced */
-static std::vector<container_t> currentContainer; /* push and pop, used only in creation */
+static std::vector<simgrid::instr::NetZoneContainer*> currentContainer; /* push and pop, used only in creation */
static const char *instr_node_name (xbt_node_t node)
{
std::string id = netzone.getName();
if (PJ_container_get_root() == nullptr){
- container_t root = new simgrid::instr::Container(id, simgrid::instr::INSTR_AS, nullptr);
- PJ_container_set_root (root);
+ simgrid::instr::NetZoneContainer* root = new simgrid::instr::NetZoneContainer(id, 0, nullptr);
if (TRACE_smpi_is_enabled()) {
simgrid::instr::Type* mpi = root->type_->getOrCreateContainerType("MPI");
}
if (TRACE_needs_platform()){
- container_t father = currentContainer.back();
- container_t container = new simgrid::instr::Container(id, simgrid::instr::INSTR_AS, father);
+ simgrid::instr::NetZoneContainer* container =
+ new simgrid::instr::NetZoneContainer(id, currentContainer.size(), currentContainer.back());
currentContainer.push_back(container);
}
}
return;
container_t father = currentContainer.back();
- container_t container = new simgrid::instr::Container(link.getName(), simgrid::instr::INSTR_LINK, father);
+ container_t container = new simgrid::instr::Container(link.getName(), "LINK", father);
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_link())) {
simgrid::instr::Type* bandwidth = container->type_->getOrCreateVariableType("bandwidth", "");
static void sg_instr_new_host(simgrid::s4u::Host& host)
{
- container_t father = currentContainer.back();
- container_t container = new simgrid::instr::Container(host.getName(), simgrid::instr::INSTR_HOST, father);
+ container_t container = new simgrid::instr::HostContainer(host, currentContainer.back());
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_speed())) {
simgrid::instr::Type* speed = container->type_->getOrCreateVariableType("power", "");
static void sg_instr_new_router(simgrid::kernel::routing::NetPoint * netpoint)
{
- if (not netpoint->isRouter())
- return;
- if (TRACE_is_enabled() && TRACE_needs_platform())
- new simgrid::instr::Container(netpoint->getCname(), simgrid::instr::INSTR_ROUTER, currentContainer.back());
+ if (netpoint->isRouter() && TRACE_is_enabled() && TRACE_needs_platform())
+ new simgrid::instr::RouterContainer(netpoint->getCname(), currentContainer.back());
}
static void instr_routing_parse_end_platform ()