TRACE_last_timestamp_to_dump = surf_get_clock();
TRACE_paje_dump_buffer(true);
- simgrid::instr::Type* root_type = simgrid::instr::Container::getRootContainer()->type_;
+ simgrid::instr::Type* root_type = simgrid::instr::Container::getRoot()->type_;
/* destroy all data structures of tracing (and free) */
- delete simgrid::instr::Container::getRootContainer();
+ delete simgrid::instr::Container::getRoot();
delete root_type;
/* close the trace files */
}
XBT_DEBUG("MARK,declare %s", mark_type);
- simgrid::instr::Container::getRootContainer()->type_->getOrCreateEventType(mark_type);
+ simgrid::instr::Container::getRoot()->type_->getOrCreateEventType(mark_type);
declared_marks.insert(mark_type);
}
THROWF (tracing_error, 1, "mark_value is nullptr");
simgrid::instr::EventType* type =
- static_cast<simgrid::instr::EventType*>(simgrid::instr::Container::getRootContainer()->type_->byName(mark_type));
+ static_cast<simgrid::instr::EventType*>(simgrid::instr::Container::getRoot()->type_->byName(mark_type));
if (not type) {
THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
} else {
//check if mark_type is already declared
simgrid::instr::EventType* type =
- static_cast<simgrid::instr::EventType*>(simgrid::instr::Container::getRootContainer()->type_->byName(mark_type));
+ static_cast<simgrid::instr::EventType*>(simgrid::instr::Container::getRoot()->type_->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(), simgrid::instr::Container::getRootContainer(), type,
+ new simgrid::instr::NewEvent(MSG_get_clock(), simgrid::instr::Container::getRoot(), type,
type->getEntityValue(mark_value));
}
}
namespace simgrid {
namespace instr {
-container_t Container::getRootContainer()
+container_t Container::getRoot()
{
return rootContainer;
}
TRACE_paje_dump_buffer(true);
// trace my destruction, but not if user requests so or if the container is root
- if (not TRACE_disable_destroy() && this != Container::getRootContainer())
+ if (not TRACE_disable_destroy() && this != Container::getRoot())
logDestruction();
// remove me from the allContainers data structure
LinkType* Container::getLink(std::string name)
{
- return dynamic_cast<LinkType*>(type_->byName(name));
+ LinkType* ret = dynamic_cast<LinkType*>(type_->byName(name));
+ ret->setCallingContainer(this);
+ return ret;
}
VariableType* Container::getVariable(std::string name)
LinkType* getLink(std::string name);
VariableType* getVariable(std::string name);
- static Container* getRootContainer();
+ static Container* getRoot();
};
class NetZoneContainer : public Container {
LinkType::LinkType(std::string name, std::string alias, Type* father) : ValueType(name, alias, father)
{
}
-void LinkType::startEvent(Container* container, container_t endpoint, std::string value, std::string key)
+void LinkType::startEvent(container_t startContainer, std::string value, std::string key)
{
- startEvent(container, endpoint, value, key, -1);
+ startEvent(startContainer, value, key, -1);
}
-void LinkType::startEvent(Container* container, container_t endpoint, std::string value, std::string key, int size)
+void LinkType::startEvent(container_t startContainer, std::string value, std::string key, int size)
{
- new LinkEvent(SIMIX_get_clock(), container, this, PAJE_StartLink, endpoint, value, key, size);
+ new LinkEvent(SIMIX_get_clock(), issuer_, this, PAJE_StartLink, startContainer, value, key, size);
}
-void LinkType::endEvent(Container* container, container_t endpoint, std::string value, std::string key)
+void LinkType::endEvent(container_t endContainer, std::string value, std::string key)
{
- new LinkEvent(SIMIX_get_clock(), container, this, PAJE_EndLink, endpoint, value, key);
+ new LinkEvent(SIMIX_get_clock(), issuer_, this, PAJE_EndLink, endContainer, value, key);
}
void Type::logDefinition(e_event_type event_type)
public:
std::map<std::string, Type*> children_;
+ Container* issuer_ = nullptr;
Type(std::string name, std::string alias, std::string color, Type* father);
virtual ~Type();
StateType* getOrCreateStateType(std::string name);
VariableType* getOrCreateVariableType(std::string name, std::string color);
+ void setCallingContainer(Container* container) { issuer_ = container; }
+
void logDefinition(e_event_type event_type);
void logDefinition(Type* source, Type* dest);
};
class VariableType : public Type {
std::vector<VariableEvent*> events_;
- Container* issuer_ = nullptr;
-
public:
VariableType(std::string name, std::string color, Type* father);
~VariableType();
- void setCallingContainer(Container* container) { issuer_ = container; }
void setEvent(double timestamp, double value);
void addEvent(double timestamp, double value);
void subEvent(double timestamp, double value);
class LinkType : public ValueType {
public:
LinkType(std::string name, std::string alias, Type* father);
- void startEvent(Container* source_container, Container* sourceContainer, std::string value, std::string key);
- void startEvent(Container* source_container, Container* sourceContainer, std::string value, std::string key,
- int size);
- void endEvent(Container* source_container, Container* destContainer, std::string value, std::string key);
+ void startEvent(Container* startContainer, std::string value, std::string key);
+ void startEvent(Container* startContainer, std::string value, std::string key, int size);
+ void endEvent(Container* endContainer, std::string value, std::string key);
};
class EventType : public ValueType {
class StateType : public ValueType {
std::vector<StateEvent*> events_;
- Container* issuer_ = nullptr;
-
public:
StateType(std::string name, Type* father);
~StateType();
- void setCallingContainer(Container* container) { issuer_ = container; }
void setEvent(std::string value_name);
void pushEvent(std::string value_name);
void pushEvent(std::string value_name, void* extra);
//start link
container_t msg = simgrid::instr::Container::byName(instr_pid(process));
- container_t root = simgrid::instr::Container::getRootContainer();
- simgrid::instr::LinkType* link = root->getLink("MSG_PROCESS_LINK");
- link->startEvent(root, msg, "M", key);
+ simgrid::instr::LinkType* link = simgrid::instr::Container::getRoot()->getLink("MSG_PROCESS_LINK");
+ link->startEvent(msg, "M", key);
//destroy existing container of this process
TRACE_msg_process_destroy (MSG_process_get_name (process), MSG_process_get_PID (process));
//end link
msg = simgrid::instr::Container::byName(instr_pid(process));
- link->endEvent(root, msg, "M", key);
+ link->endEvent(msg, "M", key);
}
}
process_container->getState("MSG_PROCESS_STATE")->popEvent();
std::string key = std::string("p") + std::to_string(task->counter);
- container_t root = simgrid::instr::Container::getRootContainer();
- simgrid::instr::LinkType* link = root->getLink("MSG_PROCESS_TASK_LINK");
- link->endEvent(root, process_container, "SR", key);
+ simgrid::instr::Container::getRoot()->getLink("MSG_PROCESS_TASK_LINK")->endEvent(process_container, "SR", key);
}
}
process_container->getState("MSG_PROCESS_STATE")->pushEvent("send");
std::string key = std::string("p") + std::to_string(task->counter);
- container_t root = simgrid::instr::Container::getRootContainer();
- simgrid::instr::LinkType* link = root->getLink("MSG_PROCESS_TASK_LINK");
- link->startEvent(root, process_container, "SR", key);
+ simgrid::instr::Container::getRoot()->getLink("MSG_PROCESS_TASK_LINK")->startEvent(process_container, "SR", key);
}
return 1;
counter++;
// start link
- container_t msg = simgrid::instr::Container::byName(vm->getName());
- simgrid::instr::LinkType* link = simgrid::instr::Container::getRootContainer()->getLink("MSG_VM_LINK");
- link->startEvent(simgrid::instr::Container::getRootContainer(), msg, "M", key);
+ container_t msg = simgrid::instr::Container::byName(vm->getName());
+ simgrid::instr::Container::getRoot()->getLink("MSG_VM_LINK")->startEvent(msg, "M", key);
// destroy existing container of this vm
container_t existing_container = simgrid::instr::Container::byName(vm->getName());
// end link
msg = simgrid::instr::Container::byName(vm->getName());
- link->endEvent(simgrid::instr::Container::getRootContainer(), msg, "M", key);
+ simgrid::instr::Container::getRoot()->getLink("MSG_VM_LINK")->endEvent(msg, "M", key);
}
// Inform the SRC that the migration has been correctly performed
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <cfloat>
-
#include <exception>
#include "colls_private.hpp"
#include "smpi_process.hpp"
-
//attempt to do a quick autotuning version of the collective,
-
#define TRACE_AUTO_COLL(cat) \
if (TRACE_is_enabled()) { \
- simgrid::instr::EventType* type = \
- simgrid::instr::Container::getRootContainer()->type_->getOrCreateEventType(#cat); \
+ simgrid::instr::EventType* type = simgrid::instr::Container::getRoot()->type_->getOrCreateEventType(#cat); \
\
- char cont_name[25]; \
- snprintf(cont_name, 25, "rank-%d", smpi_process()->index()); \
+ std::string cont_name = std::string("rank-" + std::to_string(smpi_process()->index())); \
type->addEntityValue(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0"); \
new simgrid::instr::NewEvent(SIMIX_get_clock(), simgrid::instr::Container::byName(cont_name), type, \
type->getEntityValue(Colls::mpi_coll_##cat##_description[i].name)); \
if (TRACE_smpi_is_grouped()){
father = simgrid::instr::Container::byNameOrNull(sg_host_self_get_name());
}else{
- father = simgrid::instr::Container::getRootContainer();
+ father = simgrid::instr::Container::getRoot();
}
xbt_assert(father != nullptr, "Could not find a parent for mpi rank %s at function %s", str.c_str(), __FUNCTION__);
#if HAVE_PAPI
std::string key = TRACE_smpi_get_key(src, dst, tag, 1);
- container_t container = simgrid::instr::Container::byName(smpi_container(rank));
- simgrid::instr::LinkType* link = simgrid::instr::Container::getRootContainer()->getLink("MPI_LINK");
XBT_DEBUG("Send tracing from %d to %d, tag %d, with key %s", src, dst, tag, key.c_str());
- link->startEvent(simgrid::instr::Container::getRootContainer(), container, "PTP", key, size);
+ container_t startContainer = simgrid::instr::Container::byName(smpi_container(rank));
+ simgrid::instr::Container::getRoot()->getLink("MPI_LINK")->startEvent(startContainer, "PTP", key, size);
}
void TRACE_smpi_recv(int src, int dst, int tag)
std::string key = TRACE_smpi_get_key(src, dst, tag, 0);
- container_t container = simgrid::instr::Container::byName(smpi_container(dst));
- simgrid::instr::LinkType* link = simgrid::instr::Container::getRootContainer()->getLink("MPI_LINK");
XBT_DEBUG("Recv tracing from %d to %d, tag %d, with key %s", src, dst, tag, key.c_str());
- link->endEvent(simgrid::instr::Container::getRootContainer(), container, "PTP", key);
+ container_t endContainer = simgrid::instr::Container::byName(smpi_container(dst));
+ simgrid::instr::Container::getRoot()->getLink("MPI_LINK")->endEvent(endContainer, "PTP", key);
}
std::to_string(src->type_->getId()) + "-" + dst->type_->getName() +
std::to_string(dst->type_->getId());
simgrid::instr::LinkType* link = father->type_->getOrCreateLinkType(link_typename, src->type_, dst->type_);
+ link->setCallingContainer(father);
//register EDGE types for triva configuration
trivaEdgeTypes.insert(link->getName());
std::string key = std::to_string(counter);
counter++;
- link->startEvent(father, src, "topology", key);
- link->endEvent(father, dst, "topology", key);
+ link->startEvent(src, "topology", key);
+ link->endEvent(dst, "topology", key);
XBT_DEBUG(" linkContainers %s <-> %s", src->getCname(), dst->getCname());
}
{
std::string id = netzone.getName();
- if (simgrid::instr::Container::getRootContainer() == nullptr) {
+ if (simgrid::instr::Container::getRoot() == nullptr) {
simgrid::instr::NetZoneContainer* root = new simgrid::instr::NetZoneContainer(id, 0, nullptr);
if (TRACE_smpi_is_enabled()) {
static void sg_instr_new_host(simgrid::s4u::Host& host)
{
container_t container = new simgrid::instr::HostContainer(host, currentContainer.back());
- container_t root = simgrid::instr::Container::getRootContainer();
+ container_t root = simgrid::instr::Container::getRoot();
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_speed())) {
simgrid::instr::VariableType* power = container->type_->getOrCreateVariableType("power", "");
currentContainer.clear();
std::set<std::string>* filter = new std::set<std::string>;
XBT_DEBUG ("Starting graph extraction.");
- recursiveGraphExtraction(simgrid::s4u::Engine::getInstance()->getNetRoot(),
- simgrid::instr::Container::getRootContainer(), filter);
+ recursiveGraphExtraction(simgrid::s4u::Engine::getInstance()->getNetRoot(), simgrid::instr::Container::getRoot(),
+ filter);
XBT_DEBUG ("Graph extraction finished.");
delete filter;
platform_created = 1;
void instr_new_variable_type(std::string new_typename, std::string color)
{
- recursiveNewVariableType(new_typename, color, simgrid::instr::Container::getRootContainer()->type_);
+ recursiveNewVariableType(new_typename, color, simgrid::instr::Container::getRoot()->type_);
}
static void recursiveNewUserVariableType(std::string father_type, std::string new_typename, std::string color,
void instr_new_user_variable_type(std::string father_type, std::string new_typename, std::string color)
{
- recursiveNewUserVariableType(father_type, new_typename, color, simgrid::instr::Container::getRootContainer()->type_);
+ recursiveNewUserVariableType(father_type, new_typename, color, simgrid::instr::Container::getRoot()->type_);
}
static void recursiveNewUserStateType(std::string father_type, std::string new_typename, simgrid::instr::Type* root)
void instr_new_user_state_type(std::string father_type, std::string new_typename)
{
- recursiveNewUserStateType(father_type, new_typename, simgrid::instr::Container::getRootContainer()->type_);
+ recursiveNewUserStateType(father_type, new_typename, simgrid::instr::Container::getRoot()->type_);
}
static void recursiveNewValueForUserStateType(std::string type_name, const char* val, std::string color,
void instr_new_value_for_user_state_type(std::string type_name, const char* value, std::string color)
{
- recursiveNewValueForUserStateType(type_name, value, color, simgrid::instr::Container::getRootContainer()->type_);
+ recursiveNewValueForUserStateType(type_name, value, color, simgrid::instr::Container::getRoot()->type_);
}
int instr_platform_traced ()
std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::getInstance()->getNetRoot(),
- simgrid::instr::Container::getRootContainer());
+ simgrid::instr::Container::getRoot());
delete nodes;
delete edges;
return ret;