Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Instr: for consistency, rename 'father' to 'parent' here too.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 8 Jul 2021 19:54:44 +0000 (21:54 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 8 Jul 2021 20:27:33 +0000 (22:27 +0200)
src/instr/instr_config.cpp
src/instr/instr_interface.cpp
src/instr/instr_paje_containers.cpp
src/instr/instr_paje_containers.hpp
src/instr/instr_paje_types.cpp
src/instr/instr_paje_types.hpp
src/instr/instr_paje_values.hpp
src/instr/instr_platform.cpp
src/instr/instr_private.hpp
src/smpi/internals/instr_smpi.cpp

index a8df9b1..528548b 100644 (file)
@@ -234,7 +234,7 @@ static void on_container_creation_paje(const Container& c)
             timestamp);
 
   stream << std::fixed << std::setprecision(trace_precision) << PajeEventType::CreateContainer << " ";
-  stream << timestamp << " " << c.get_id() << " " << c.type_->get_id() << " " << c.father_->get_id() << " \"";
+  stream << timestamp << " " << c.get_id() << " " << c.type_->get_id() << " " << c.parent_->get_id() << " \"";
   if (c.get_name().find("rank-") != 0)
     stream << c.get_name() << "\"";
   else
@@ -306,7 +306,7 @@ static void on_entity_value_creation(const EntityValue& value)
   std::stringstream stream;
   XBT_DEBUG("%s: event_type=%u", __func__, static_cast<unsigned>(PajeEventType::DefineEntityValue));
   stream << std::fixed << std::setprecision(trace_precision) << PajeEventType::DefineEntityValue;
-  stream << " " << value.get_id() << " " << value.get_father()->get_id() << " " << value.get_name();
+  stream << " " << value.get_id() << " " << value.get_parent()->get_id() << " " << value.get_name();
   if (not value.get_color().empty())
     stream << " \"" << value.get_color() << "\"";
   XBT_DEBUG("Dump %s", stream.str().c_str());
@@ -342,7 +342,7 @@ static void on_type_creation(const Type& type, PajeEventType event_type)
   std::stringstream stream;
   stream << std::fixed << std::setprecision(trace_precision);
   XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, static_cast<unsigned>(event_type), trace_precision, 0.);
-  stream << event_type << " " << type.get_id() << " " << type.get_father()->get_id() << " " << type.get_name();
+  stream << event_type << " " << type.get_id() << " " << type.get_parent()->get_id() << " " << type.get_name();
   if (type.is_colored())
     stream << " \"" << type.get_color() << "\"";
   XBT_DEBUG("Dump %s", stream.str().c_str());
@@ -354,7 +354,7 @@ static void on_link_type_creation(const Type& type, const Type& source, const Ty
   std::stringstream stream;
   XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, static_cast<unsigned>(PajeEventType::DefineLinkType),
             trace_precision, 0.);
-  stream << PajeEventType::DefineLinkType << " " << type.get_id() << " " << type.get_father()->get_id();
+  stream << PajeEventType::DefineLinkType << " " << type.get_id() << " " << type.get_parent()->get_id();
   stream << " " << source.get_id() << " " << dest.get_id() << " " << type.get_name();
   XBT_DEBUG("Dump %s", stream.str().c_str());
   tracing_file << stream.str() << std::endl;
index 9837381..a25a45c 100644 (file)
@@ -257,7 +257,7 @@ xbt_dynar_t TRACE_get_marks ()
   return instr_set_to_dynar(declared_marks);
 }
 
-static void instr_user_variable(double time, const char* resource, const char* variable_name, const char* father_type,
+static void instr_user_variable(double time, const char* resource, const char* variable_name, const char* parent_type,
                                 double value, InstrUserVariable what, const char* color,
                                 std::set<std::string, std::less<>>* filter)
 {
@@ -270,7 +270,7 @@ static void instr_user_variable(double time, const char* resource, const char* v
   if (what == InstrUserVariable::DECLARE) {
     if (created == filter->end()) { // not declared yet
       filter->insert(variable_name);
-      instr_new_user_variable_type(father_type, variable_name, color == nullptr ? "" : color);
+      instr_new_user_variable_type(parent_type, variable_name, color == nullptr ? "" : color);
     }
   }else{
     if (created != filter->end()) { // declared, let's work
@@ -293,8 +293,8 @@ static void instr_user_variable(double time, const char* resource, const char* v
   }
 }
 
-static void instr_user_srcdst_variable(double time, const char *src, const char *dst, const char *variable,
-                              const char *father_type, double value, InstrUserVariable what)
+static void instr_user_srcdst_variable(double time, const char* src, const char* dst, const char* variable,
+                                       const char* parent_type, double value, InstrUserVariable what)
 {
   const simgrid::kernel::routing::NetPoint* src_elm = sg_netpoint_by_name_or_null(src);
   xbt_assert(src_elm, "Element '%s' not found!", src);
@@ -305,7 +305,7 @@ static void instr_user_srcdst_variable(double time, const char *src, const char
   std::vector<simgrid::kernel::resource::LinkImpl*> route;
   simgrid::kernel::routing::NetZoneImpl::get_global_route(src_elm, dst_elm, route, nullptr);
   for (auto const& link : route)
-    instr_user_variable(time, link->get_cname(), variable, father_type, value, what, nullptr, &user_link_variables);
+    instr_user_variable(time, link->get_cname(), variable, parent_type, value, what, nullptr, &user_link_variables);
 }
 
 /** @ingroup TRACE_API
index f97d975..8442abd 100644 (file)
@@ -16,14 +16,14 @@ namespace instr {
 Container* Container::root_container_ = nullptr;              /* the root container */
 std::map<std::string, Container*, std::less<>> Container::all_containers_; /* all created containers indexed by name */
 
-NetZoneContainer::NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* father)
-    : Container::Container(name, "", father)
+NetZoneContainer::NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* parent)
+    : Container::Container(name, "", parent)
 {
   xbt_assert(s4u::Engine::get_instance()->netpoint_by_name_or_null(get_name()), "Element '%s' not found", get_cname());
-  if (father_) {
+  if (parent_) {
     std::string type_name = std::string("L") + std::to_string(level);
-    type_                 = father_->type_->by_name_or_create<ContainerType>(type_name);
-    father_->children_.insert({get_name(), this});
+    type_                 = parent_->type_->by_name_or_create<ContainerType>(type_name);
+    parent_->children_.insert({get_name(), this});
     on_creation(*this);
   } else {
     type_         = new ContainerType("0");
@@ -31,33 +31,33 @@ NetZoneContainer::NetZoneContainer(const std::string& name, unsigned int level,
   }
 }
 
-RouterContainer::RouterContainer(const std::string& name, Container* father)
-    : Container::Container(name, "ROUTER", father)
+RouterContainer::RouterContainer(const std::string& name, Container* parent)
+    : Container::Container(name, "ROUTER", parent)
 {
-  xbt_assert(father, "Only the Root container has no father");
+  xbt_assert(parent, "Only the Root container has no parent");
   xbt_assert(s4u::Engine::get_instance()->netpoint_by_name_or_null(get_name()), "Element '%s' not found", get_cname());
 }
 
-HostContainer::HostContainer(s4u::Host const& host, NetZoneContainer* father)
-    : Container::Container(host.get_name(), "HOST", father)
+HostContainer::HostContainer(s4u::Host const& host, NetZoneContainer* parent)
+    : Container::Container(host.get_name(), "HOST", parent)
 {
-  xbt_assert(father, "Only the Root container has no father");
+  xbt_assert(parent, "Only the Root container has no parent");
   xbt_assert(host.get_netpoint(), "Element '%s' not found", host.get_cname());
 }
 
-Container::Container(const std::string& name, const std::string& type_name, Container* father)
-    : name_(name), father_(father)
+Container::Container(const std::string& name, const std::string& type_name, Container* parent)
+    : name_(name), parent_(parent)
 {
   static long long int container_id = 0;
   id_                               = container_id; // id (or alias) of the container
   container_id++;
 
-  if (father_) {
-    XBT_DEBUG("new container %s, child of %s", get_cname(), father->get_cname());
+  if (parent_) {
+    XBT_DEBUG("new container %s, child of %s", get_cname(), parent->get_cname());
 
     if (not type_name.empty()) {
-      type_ = father_->type_->by_name_or_create<ContainerType>(type_name);
-      father_->children_.insert({name_, this});
+      type_ = parent_->type_->by_name_or_create<ContainerType>(type_name);
+      parent_->children_.insert({name_, this});
       on_creation(*this);
     }
   }
@@ -108,9 +108,9 @@ Container* Container::by_name(const std::string& name)
 
 void Container::remove_from_parent()
 {
-  if (father_) {
-    XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", get_cname(), father_->get_cname());
-    father_->children_.erase(name_);
+  if (parent_) {
+    XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", get_cname(), parent_->get_cname());
+    parent_->children_.erase(name_);
   }
   delete this;
 }
@@ -130,8 +130,8 @@ VariableType* Container::get_variable(const std::string& name)
   return static_cast<VariableType*>(type_->by_name(name)->set_calling_container(this));
 }
 
-EntityValue::EntityValue(const std::string& name, const std::string& color, Type* father)
-    : name_(name), color_(color), father_(father)
+EntityValue::EntityValue(const std::string& name, const std::string& color, Type* parent)
+    : name_(name), color_(color), parent_(parent)
 {
   on_creation(*this);
 }
index 3ab8fe8..c4befb6 100644 (file)
@@ -30,13 +30,13 @@ public:
   static xbt::signal<void(Container const&)> on_creation;
   static xbt::signal<void(Container const&)> on_destruction;
 
-  explicit Container(const std::string& name, const std::string& type_name, Container* father);
+  explicit Container(const std::string& name, const std::string& type_name, Container* parent);
   Container(const Container&) = delete;
   Container& operator=(const Container&) = delete;
   virtual ~Container();
 
   Type* type_; /* Type of this container */
-  Container* father_;
+  Container* parent_;
   std::map<std::string, Container*, std::less<>> children_;
 
   static Container* by_name_or_null(const std::string& name);
@@ -55,17 +55,17 @@ public:
 
 class NetZoneContainer : public Container {
 public:
-  NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* father);
+  NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* parent);
 };
 
 class RouterContainer : public Container {
 public:
-  RouterContainer(const std::string& name, Container* father);
+  RouterContainer(const std::string& name, Container* parent);
 };
 
 class HostContainer : public Container {
 public:
-  HostContainer(s4u::Host const& host, NetZoneContainer* father);
+  HostContainer(s4u::Host const& host, NetZoneContainer* parent);
 };
 } // namespace instr
 } // namespace simgrid
index 26658b9..41f66c9 100644 (file)
@@ -19,15 +19,15 @@ long long int new_paje_id()
 }
 
 Type::Type(PajeEventType event_type, const std::string& name, const std::string& alias, const std::string& color,
-           Type* father)
-    : name_(name), color_(color), father_(father)
+           Type* parent)
+    : name_(name), color_(color), parent_(parent)
 {
   if (name_.empty() || alias.empty())
     throw TracingError(XBT_THROW_POINT, "can't create a new type with no name or alias");
 
-  if (father != nullptr){
-    father->children_[alias].reset(this);
-    XBT_DEBUG("new type %s, child of %s", get_cname(), father->get_cname());
+  if (parent != nullptr) {
+    parent->children_[alias].reset(this);
+    XBT_DEBUG("new type %s, child of %s", get_cname(), parent->get_cname());
     on_creation(*this, event_type);
   }
 }
@@ -119,7 +119,7 @@ Type* Type::by_name(const std::string& name)
     }
   }
   if (ret == nullptr)
-    throw TracingError(XBT_THROW_POINT, xbt::string_printf("type with name (%s) not found in father type (%s)",
+    throw TracingError(XBT_THROW_POINT, xbt::string_printf("type with name (%s) not found in parent type (%s)",
                                                            name.c_str(), get_cname()));
   return ret;
 }
@@ -145,7 +145,7 @@ EntityValue* ValueType::get_entity_value(const std::string& name)
 {
   auto ret = values_.find(name);
   if (ret == values_.end()) {
-    throw TracingError(XBT_THROW_POINT, xbt::string_printf("value with name (%s) not found in father type (%s)",
+    throw TracingError(XBT_THROW_POINT, xbt::string_printf("value with name (%s) not found in parent type (%s)",
                                                            name.c_str(), get_cname()));
   }
   return &ret->second;
index a5e31d4..b30eb76 100644 (file)
@@ -22,7 +22,7 @@ class Type {
   long long int id_ = new_paje_id();
   std::string name_;
   std::string color_;
-  Type* father_;
+  Type* parent_;
   std::map<std::string, std::unique_ptr<Type>, std::less<>> children_;
   Container* issuer_ = nullptr;
 
@@ -33,14 +33,14 @@ public:
   static xbt::signal<void(Type const&, PajeEventType event_type)> on_creation;
 
   Type(PajeEventType event_type, const std::string& name, const std::string& alias, const std::string& color,
-       Type* father);
+       Type* parent);
   virtual ~Type() = default;
 
   long long int get_id() const { return id_; }
   const std::string& get_name() const { return name_; }
   const char* get_cname() const { return name_.c_str(); }
   const std::string& get_color() const { return color_; }
-  Type* get_father() const { return father_; }
+  Type* get_parent() const { return parent_; }
   const std::map<std::string, std::unique_ptr<Type>, std::less<>>& get_children() const { return children_; }
   bool is_colored() const { return not color_.empty(); }
 
@@ -64,15 +64,15 @@ public:
 class ContainerType : public Type {
 public:
   explicit ContainerType(const std::string& name) : Type(PajeEventType::DefineContainerType, name, name, "", nullptr){};
-  ContainerType(const std::string& name, Type* father)
-      : Type(PajeEventType::DefineContainerType, name, name, "", father){};
+  ContainerType(const std::string& name, Type* parent)
+      : Type(PajeEventType::DefineContainerType, name, name, "", parent){};
 };
 
 class VariableType : public Type {
   std::vector<VariableEvent*> events_;
 public:
-  VariableType(const std::string& name, const std::string& color, Type* father)
-      : Type(PajeEventType::DefineVariableType, name, name, color, father)
+  VariableType(const std::string& name, const std::string& color, Type* parent)
+      : Type(PajeEventType::DefineVariableType, name, name, color, parent)
   {
   }
   void instr_event(double now, double delta, const char* resource, double value);
@@ -84,10 +84,10 @@ public:
 class ValueType : public Type {
 public:
   std::map<std::string, EntityValue, std::less<>> values_;
-  ValueType(PajeEventType event_type, const std::string& name, const std::string& alias, Type* father)
-      : Type(event_type, name, alias, "", father){};
-  ValueType(PajeEventType event_type, const std::string& name, Type* father)
-      : Type(event_type, name, name, "", father){};
+  ValueType(PajeEventType event_type, const std::string& name, const std::string& alias, Type* parent)
+      : Type(event_type, name, alias, "", parent){};
+  ValueType(PajeEventType event_type, const std::string& name, Type* parent)
+      : Type(event_type, name, name, "", parent){};
   void add_entity_value(const std::string& name, const std::string& color);
   void add_entity_value(const std::string& name);
   EntityValue* get_entity_value(const std::string& name);
@@ -96,8 +96,8 @@ public:
 class LinkType : public ValueType {
 public:
   static xbt::signal<void(LinkType const&, Type const&, Type const&)> on_creation;
-  LinkType(const std::string& name, const Type* source, const Type* dest, const std::string& alias, Type* father)
-      : ValueType(PajeEventType::DefineLinkType, name, alias, father)
+  LinkType(const std::string& name, const Type* source, const Type* dest, const std::string& alias, Type* parent)
+      : ValueType(PajeEventType::DefineLinkType, name, alias, parent)
   {
     on_creation(*this, *source, *dest);
   }
@@ -108,13 +108,13 @@ public:
 
 class EventType : public ValueType {
 public:
-  EventType(const std::string& name, Type* father) : ValueType(PajeEventType::DefineEventType, name, father) {}
+  EventType(const std::string& name, Type* parent) : ValueType(PajeEventType::DefineEventType, name, parent) {}
 };
 
 class StateType : public ValueType {
   std::vector<StateEvent*> events_;
 public:
-  StateType(const std::string& name, Type* father) : ValueType(PajeEventType::DefineStateType, name, father) {}
+  StateType(const std::string& name, Type* parent) : ValueType(PajeEventType::DefineStateType, name, parent) {}
   void set_event(const std::string& value_name);
   void push_event(const std::string& value_name);
   void push_event(const std::string& value_name, TIData* extra);
index 9b3fa1e..ee9d3f9 100644 (file)
@@ -16,17 +16,17 @@ class EntityValue {
   long long int id_ = new_paje_id();
   std::string name_;
   std::string color_;
-  Type* father_;
+  Type* parent_;
 
 public:
   static xbt::signal<void(const EntityValue&)> on_creation;
-  explicit EntityValue(const std::string& name, const std::string& color, Type* father);
+  explicit EntityValue(const std::string& name, const std::string& color, Type* parent);
 
   long long int get_id() const { return id_; }
   std::string get_name() const { return name_; }
   const char* get_cname() const { return name_.c_str(); }
   std::string get_color() const { return color_; }
-  Type* get_father() const { return father_; }
+  Type* get_parent() const { return parent_; }
 };
 } // namespace instr
 } // namespace simgrid
index 6db1c3b..f38cb50 100644 (file)
@@ -33,17 +33,17 @@ static simgrid::instr::Container* lowestCommonAncestor(const simgrid::instr::Con
                                                        const simgrid::instr::Container* a2)
 {
   // this is only an optimization (since most of a1 and a2 share the same parent)
-  if (a1->father_ == a2->father_)
-    return a1->father_;
+  if (a1->parent_ == a2->parent_)
+    return a1->parent_;
 
   // create an array with all ancestors of a1
   std::vector<simgrid::instr::Container*> ancestors_a1;
-  for (auto* p = a1->father_; p != nullptr; p = p->father_)
+  for (auto* p = a1->parent_; p != nullptr; p = p->parent_)
     ancestors_a1.push_back(p);
 
   // create an array with all ancestors of a2
   std::vector<simgrid::instr::Container*> ancestors_a2;
-  for (auto* p = a2->father_; p != nullptr; p = p->father_)
+  for (auto* p = a2->parent_; p != nullptr; p = p->parent_)
     ancestors_a2.push_back(p);
 
   // find the lowest ancestor
@@ -73,9 +73,9 @@ static void linkContainers(simgrid::instr::Container* src, simgrid::instr::Conta
     return;
   }
 
-  // find common father
-  simgrid::instr::Container* father = lowestCommonAncestor(src, dst);
-  xbt_assert(father, "common father unknown, this is a tracing problem");
+  // find common parent
+  simgrid::instr::Container* parent = lowestCommonAncestor(src, dst);
+  xbt_assert(parent, "common parent unknown, this is a tracing problem");
 
   // check if we already register this pair (we only need one direction)
   std::string aux1 = src->get_name() + dst->get_name();
@@ -94,11 +94,11 @@ static void linkContainers(simgrid::instr::Container* src, simgrid::instr::Conta
   filter->insert(aux2);
 
   // declare type
-  std::string link_typename = father->type_->get_name() + "-" + src->type_->get_name() +
+  std::string link_typename = parent->type_->get_name() + "-" + src->type_->get_name() +
                               std::to_string(src->type_->get_id()) + "-" + dst->type_->get_name() +
                               std::to_string(dst->type_->get_id());
-  simgrid::instr::LinkType* link = father->type_->by_name_or_create(link_typename, src->type_, dst->type_);
-  link->set_calling_container(father);
+  simgrid::instr::LinkType* link = parent->type_->by_name_or_create(link_typename, src->type_, dst->type_);
+  link->set_calling_container(parent);
 
   // create the link
   static long long counter = 0;
@@ -162,35 +162,35 @@ void instr_new_variable_type(const std::string& new_typename, const std::string&
   recursiveNewVariableType(new_typename, color, simgrid::instr::Container::get_root()->type_);
 }
 
-static void recursiveNewUserVariableType(const std::string& father_type, const std::string& new_typename,
+static void recursiveNewUserVariableType(const std::string& parent_type, const std::string& new_typename,
                                          const std::string& color, simgrid::instr::Type* root)
 {
-  if (root->get_name() == father_type) {
+  if (root->get_name() == parent_type) {
     root->by_name_or_create(new_typename, color);
   }
   for (auto const& elm : root->get_children())
-    recursiveNewUserVariableType(father_type, new_typename, color, elm.second.get());
+    recursiveNewUserVariableType(parent_type, new_typename, color, elm.second.get());
 }
 
-void instr_new_user_variable_type(const std::string& father_type, const std::string& new_typename,
+void instr_new_user_variable_type(const std::string& parent_type, const std::string& new_typename,
                                   const std::string& color)
 {
-  recursiveNewUserVariableType(father_type, new_typename, color, simgrid::instr::Container::get_root()->type_);
+  recursiveNewUserVariableType(parent_type, new_typename, color, simgrid::instr::Container::get_root()->type_);
 }
 
-static void recursiveNewUserStateType(const std::string& father_type, const std::string& new_typename,
+static void recursiveNewUserStateType(const std::string& parent_type, const std::string& new_typename,
                                       simgrid::instr::Type* root)
 {
-  if (root->get_name() == father_type)
+  if (root->get_name() == parent_type)
     root->by_name_or_create<simgrid::instr::StateType>(new_typename);
 
   for (auto const& elm : root->get_children())
-    recursiveNewUserStateType(father_type, new_typename, elm.second.get());
+    recursiveNewUserStateType(parent_type, new_typename, elm.second.get());
 }
 
-void instr_new_user_state_type(const std::string& father_type, const std::string& new_typename)
+void instr_new_user_state_type(const std::string& parent_type, const std::string& new_typename)
 {
-  recursiveNewUserStateType(father_type, new_typename, simgrid::instr::Container::get_root()->type_);
+  recursiveNewUserStateType(parent_type, new_typename, simgrid::instr::Container::get_root()->type_);
 }
 
 static void recursiveNewValueForUserStateType(const std::string& type_name, const char* val, const std::string& color,
index 41f0467..59a9e6e 100644 (file)
@@ -265,9 +265,9 @@ XBT_PUBLIC bool TRACE_smpi_view_internals();
 
 /* instr_paje.c */
 void instr_new_variable_type(const std::string& new_typename, const std::string& color);
-void instr_new_user_variable_type(const std::string& father_type, const std::string& new_typename,
+void instr_new_user_variable_type(const std::string& parent_type, const std::string& new_typename,
                                   const std::string& color);
-void instr_new_user_state_type(const std::string& father_type, const std::string& new_typename);
+void instr_new_user_state_type(const std::string& parent_type, const std::string& new_typename);
 void instr_new_value_for_user_state_type(const std::string& new_typename, const char* value, const std::string& color);
 
 XBT_PRIVATE void TRACE_help();
index d58b680..f3e1b41 100644 (file)
@@ -137,12 +137,12 @@ static std::string TRACE_smpi_get_key(aid_t src, aid_t dst, int tag, int send)
 
 void TRACE_smpi_setup_container(aid_t pid, const_sg_host_t host)
 {
-  auto* father = simgrid::instr::Container::get_root();
+  auto* parent = simgrid::instr::Container::get_root();
   if (TRACE_smpi_is_grouped()) {
-    father = simgrid::instr::Container::by_name_or_null(host->get_name());
-    xbt_assert(father != nullptr, "Could not find a parent for mpi rank 'rank-%ld' at function %s", pid, __func__);
+    parent = simgrid::instr::Container::by_name_or_null(host->get_name());
+    xbt_assert(parent != nullptr, "Could not find a parent for mpi rank 'rank-%ld' at function %s", pid, __func__);
   }
-  father->create_child(std::string("rank-") + std::to_string(pid), "MPI"); // This container is of type MPI
+  parent->create_child(std::string("rank-") + std::to_string(pid), "MPI"); // This container is of type MPI
 }
 
 void TRACE_smpi_init(aid_t pid, const std::string& calling_func)