- simgrid::s4u::VirtualMachine::on_suspend.connect([](simgrid::s4u::VirtualMachine& vm) {
- simgrid::instr::Container::by_name(vm.get_name())->get_state("VM_STATE")->push_event("suspend");
- });
- simgrid::s4u::VirtualMachine::on_resume.connect([](simgrid::s4u::VirtualMachine& vm) {
- simgrid::instr::Container::by_name(vm.get_name())->get_state("VM_STATE")->pop_event();
- });
- simgrid::s4u::Host::on_destruction.connect(
- [](simgrid::s4u::Host& host) { simgrid::instr::Container::by_name(host.get_name())->remove_from_parent(); });
- }
-}
-/*
- * user categories support
- */
-static void recursiveNewVariableType(const std::string& new_typename, const std::string& color,
- simgrid::instr::Type* root)
-{
- if (root->get_name() == "HOST" || root->get_name() == "VM")
- root->by_name_or_create(std::string("p") + new_typename, color);
-
- if (root->get_name() == "LINK")
- root->by_name_or_create(std::string("b") + new_typename, color);
-
- for (auto elm : root->children_) {
- recursiveNewVariableType(new_typename, color, elm.second);
- }
-}
-
-void instr_new_variable_type(const std::string& new_typename, const std::string& color)
-{
- recursiveNewVariableType(new_typename, color, simgrid::instr::Container::get_root()->type_);
-}
-
-static void recursiveNewUserVariableType(const std::string& father_type, const std::string& new_typename,
- const std::string& color, simgrid::instr::Type* root)
-{
- if (root->get_name() == father_type) {
- root->by_name_or_create(new_typename, color);
- }
- for (auto elm : root->children_)
- recursiveNewUserVariableType(father_type, new_typename, color, elm.second);
-}
-
-void instr_new_user_variable_type(const std::string& father_type, const std::string& new_typename,
- const std::string& color)
-{
- recursiveNewUserVariableType(father_type, new_typename, color, simgrid::instr::Container::get_root()->type_);
-}
-
-static void recursiveNewUserStateType(const std::string& father_type, const std::string& new_typename,
- simgrid::instr::Type* root)
-{
- if (root->get_name() == father_type)
- root->by_name_or_create<simgrid::instr::StateType>(new_typename);
-
- for (auto elm : root->children_)
- recursiveNewUserStateType(father_type, new_typename, elm.second);
-}
-
-void instr_new_user_state_type(const std::string& father_type, const std::string& new_typename)
-{
- recursiveNewUserStateType(father_type, new_typename, simgrid::instr::Container::get_root()->type_);
-}
-
-static void recursiveNewValueForUserStateType(const std::string& type_name, const char* val, const std::string& color,
- simgrid::instr::Type* root)
-{
- if (root->get_name() == type_name)
- static_cast<simgrid::instr::StateType*>(root)->add_entity_value(val, color);
-
- for (auto elm : root->children_)
- recursiveNewValueForUserStateType(type_name, val, color, elm.second);
-}
-
-void instr_new_value_for_user_state_type(const std::string& type_name, const char* value, const std::string& color)
-{
- recursiveNewValueForUserStateType(type_name, value, color, simgrid::instr::Container::get_root()->type_);
-}
-
-#define GRAPHICATOR_SUPPORT_FUNCTIONS
-
-static void recursiveXBTGraphExtraction(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
- std::map<std::string, xbt_edge_t>* edges, sg_netzone_t netzone,
- container_t container)
-{
- if (not netzone->get_children().empty()) {
- // bottom-up recursion
- for (auto const& netzone_child : netzone->get_children()) {
- container_t child_container = container->children_.at(netzone_child->get_name());
- recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);
- }