Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
snake_case jedule
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 18 Jun 2018 13:16:31 +0000 (15:16 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 18 Jun 2018 21:54:03 +0000 (23:54 +0200)
include/simgrid/jedule/jedule.hpp
include/simgrid/jedule/jedule_events.hpp
include/simgrid/jedule/jedule_platform.hpp
src/instr/jedule/jedule.cpp
src/instr/jedule/jedule_events.cpp
src/instr/jedule/jedule_platform.cpp
src/instr/jedule/jedule_sd_binding.cpp

index 8c9ef39..1a1e859 100644 (file)
@@ -21,9 +21,17 @@ public:
   std::vector<Event *> event_set;
   Container* root_container = nullptr;
   std::unordered_map<char*, char*> meta_info;
-  void addMetaInfo(char* key, char* value);
-  void cleanupOutput();
-  void writeOutput(FILE *file);
+  void add_meta_info(char* key, char* value);
+  void cleanup_output();
+  void write_output(FILE* file);
+
+  // deprecated
+  XBT_ATTRIB_DEPRECATED_v323("Please use Jedule::add_meta_info()") void addMetaInfo(char* key, char* value)
+  {
+    add_meta_info(key, value);
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Jedule::cleanup_output()") void cleanupOutput() { cleanup_output(); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Jedule::write_output()") void writeOutput(FILE* file) { write_output(file); }
 };
 
 }
index 71bced7..54d0002 100644 (file)
@@ -21,11 +21,26 @@ class XBT_PUBLIC Event {
 public:
   Event(std::string name, double start_time, double end_time, std::string type);
   ~Event();
-  void addCharacteristic(char* characteristic);
-  void addResources(std::vector<sg_host_t>* host_selection);
-  void addInfo(char* key, char* value);
+  void add_characteristic(char* characteristic);
+  void add_resources(std::vector<sg_host_t>* host_selection);
+  void add_info(char* key, char* value);
   void print(FILE* file);
 
+  // deprecated
+  XBT_ATTRIB_DEPRECATED_v323("Please use Event::add_characteristic()") void addCharacteristic(char* characteristic)
+  {
+    add_characteristic(characteristic);
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Event::add_resources()") void addResources(
+      std::vector<sg_host_t>* host_selection)
+  {
+    add_resources(host_selection);
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Event::add_info()") void addInfo(char* key, char* value)
+  {
+    add_info(key, value);
+  }
+
 private:
   std::string name;
   double start_time;
index 5e40d67..e5d5f64 100644 (file)
@@ -28,13 +28,36 @@ public:
   Container *parent = nullptr;
   std::vector<Container*> children;
   std::vector<sg_host_t> resource_list;
-  void addChild(Container* child);
-  void addResources(std::vector<sg_host_t> hosts);
-  void createHierarchy(sg_netzone_t from_as);
-  std::vector<int> getHierarchy();
-  std::string getHierarchyAsString();
+  void add_child(Container* child);
+  void add_resources(std::vector<sg_host_t> hosts);
+  void create_hierarchy(sg_netzone_t from_as);
+  std::vector<int> get_hierarchy();
+  std::string get_hierarchy_as_string();
   void print(FILE *file);
-  void printResources(FILE *file);
+  void print_resources(FILE* file);
+
+  // deprecated
+  XBT_ATTRIB_DEPRECATED_v323("Please use Container::add_child()") void addChild(Container* child) { add_child(child); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Container::add_resources()") void addResources(std::vector<sg_host_t> hosts)
+  {
+    add_resources(hosts);
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Container::create_hierarchy()") void createHierarchy(sg_netzone_t from_as)
+  {
+    create_hierarchy(from_as);
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Container::get_hierarchy()") std::vector<int> getHierarchy()
+  {
+    return get_hierarchy();
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Container::get_hierarchy_as_string()") std::string getHierarchyAsString()
+  {
+    return get_hierarchy_as_string();
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Container::print_resources()") void printResources(FILE* file)
+  {
+    print_resources(file);
+  }
 };
 
 class XBT_PUBLIC Subset {
index 475b615..762b1d4 100644 (file)
@@ -19,14 +19,16 @@ Jedule::~Jedule() {
   this->event_set.clear();
 }
 
-void Jedule::addMetaInfo(char *key, char *value) {
+void Jedule::add_meta_info(char* key, char* value)
+{
   xbt_assert(key != nullptr);
   xbt_assert(value != nullptr);
 
   this->meta_info.insert({key, value});
 }
 
-void Jedule::writeOutput(FILE *file) {
+void Jedule::write_output(FILE* file)
+{
   if (not this->event_set.empty()) {
     fprintf(file, "<jedule>\n");
 
index 5789db9..7047f22 100644 (file)
@@ -27,18 +27,19 @@ Event::~Event()
   }
 }
 
-void Event::addResources(std::vector<sg_host_t> *host_selection)
+void Event::add_resources(std::vector<sg_host_t>* host_selection)
 {
   get_resource_selection_by_hosts(this->resource_subsets, host_selection);
 }
 
-void Event::addCharacteristic(char *characteristic)
+void Event::add_characteristic(char* characteristic)
 {
   xbt_assert( characteristic != nullptr );
   this->characteristics_list.push_back(characteristic);
 }
 
-void Event::addInfo(char* key, char *value) {
+void Event::add_info(char* key, char* value)
+{
   xbt_assert((key != nullptr) && value != nullptr);
   this->info_map.insert({key, value});
 }
@@ -55,7 +56,7 @@ void Event::print(FILE *jed_file)
   fprintf(jed_file, "      <res_util>\n");
   for (auto const& subset : *this->resource_subsets) {
     fprintf(jed_file, "        <select resources=\"");
-    fprintf(jed_file, "%s", subset->parent->getHierarchyAsString().c_str());
+    fprintf(jed_file, "%s", subset->parent->get_hierarchy_as_string().c_str());
     fprintf(jed_file, ".[%d-%d]", subset->start_idx, subset->start_idx + subset->nres-1);
     fprintf(jed_file, "\" />\n");
   }
index c0060d5..1c4ad33 100644 (file)
@@ -37,14 +37,14 @@ Container::~Container()
       delete child;
 }
 
-void Container::addChild(jed_container_t child)
+void Container::add_child(jed_container_t child)
 {
   xbt_assert(child != nullptr);
   this->children.push_back(child);
   child->parent = this;
 }
 
-void Container::addResources(std::vector<sg_host_t> hosts)
+void Container::add_resources(std::vector<sg_host_t> hosts)
 {
   this->is_lowest = 1;
   this->children.clear();
@@ -61,30 +61,30 @@ void Container::addResources(std::vector<sg_host_t> hosts)
   }
 }
 
-void Container::createHierarchy(sg_netzone_t from_as)
+void Container::create_hierarchy(sg_netzone_t from_as)
 {
 
   if (from_as->get_children()->empty()) {
     // I am no AS
     // add hosts to jedule platform
     std::vector<sg_host_t> table = from_as->get_all_hosts();
-    this->addResources(table);
+    this->add_resources(table);
   } else {
     for (auto const& nz : *from_as->get_children()) {
       jed_container_t child_container = new simgrid::jedule::Container(std::string(nz->get_cname()));
-      this->addChild(child_container);
-      child_container->createHierarchy(nz);
+      this->add_child(child_container);
+      child_container->create_hierarchy(nz);
     }
   }
 }
 
-std::vector<int> Container::getHierarchy()
+std::vector<int> Container::get_hierarchy()
 {
   if(this->parent != nullptr ) {
 
     if (not this->parent->children.empty()) {
       // we are in the last level
-      return this->parent->getHierarchy();
+      return this->parent->get_hierarchy();
     } else {
       unsigned int i =0;
       int child_nb = -1;
@@ -98,7 +98,7 @@ std::vector<int> Container::getHierarchy()
       }
 
       xbt_assert( child_nb > - 1);
-      std::vector<int> heir_list = this->parent->getHierarchy();
+      std::vector<int> heir_list = this->parent->get_hierarchy();
       heir_list.insert(heir_list.begin(), child_nb);
       return heir_list;
     }
@@ -109,11 +109,11 @@ std::vector<int> Container::getHierarchy()
   }
 }
 
-std::string Container::getHierarchyAsString()
+std::string Container::get_hierarchy_as_string()
 {
   std::string output("");
 
-  std::vector<int> heir_list = this->getHierarchy();
+  std::vector<int> heir_list = this->get_hierarchy();
 
   unsigned int length = heir_list.size();
   unsigned int i = 0;
@@ -127,13 +127,13 @@ std::string Container::getHierarchyAsString()
   return output;
 }
 
-void Container::printResources(FILE * jed_file)
+void Container::print_resources(FILE* jed_file)
 {
   unsigned int i=0;
   xbt_assert(not this->resource_list.empty());
 
   unsigned int res_nb = this->resource_list.size();
-  std::string resid = this->getHierarchyAsString();
+  std::string resid   = this->get_hierarchy_as_string();
 
   fprintf(jed_file, "      <rset id=\"%s\" nb=\"%u\" names=\"", resid.c_str(), res_nb);
   for (auto const& res : this->resource_list) {
@@ -155,7 +155,7 @@ void Container::print(FILE* jed_file)
       child->print(jed_file);
     }
   } else {
-    this->printResources(jed_file);
+    this->print_resources(jed_file);
   }
   fprintf(jed_file, "    </res>\n");
 }
index 70292bc..bc3e415 100644 (file)
@@ -22,7 +22,7 @@ void jedule_log_sd_event(SD_task_t task)
 
   jed_event_t event = new simgrid::jedule::Event(std::string(SD_task_get_name(task)),
                                                  SD_task_get_start_time(task), SD_task_get_finish_time(task), "SD");
-  event->addResources(task->allocation);
+  event->add_resources(task->allocation);
   my_jedule->event_set.push_back(event);
 }
 
@@ -34,7 +34,7 @@ void jedule_sd_init()
   my_jedule = new simgrid::jedule::Jedule();
 
   jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->get_cname()));
-  root_container->createHierarchy(root_comp);
+  root_container->create_hierarchy(root_comp);
   my_jedule->root_container = root_container;
 }
 
@@ -55,7 +55,7 @@ void jedule_sd_dump(const char * filename)
 
     FILE *fh = fopen(fname, "w");
 
-    my_jedule->writeOutput(fh);
+    my_jedule->write_output(fh);
 
     fclose(fh);
     xbt_free(fname);