Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
quickly review the code of Fred, as requested. Nice job, pal
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 7 Sep 2016 21:22:47 +0000 (23:22 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 7 Sep 2016 21:22:47 +0000 (23:22 +0200)
include/simgrid/jedule/jedule_events.hpp
include/simgrid/jedule/jedule_platform.hpp
src/instr/jedule/jedule_events.cpp
src/instr/jedule/jedule_output.cpp
src/instr/jedule/jedule_platform.cpp

index 1ccee5c..1a4cd5a 100644 (file)
@@ -21,7 +21,7 @@ namespace jedule{
 
 XBT_PUBLIC_CLASS Event{
   private:
-    ~Event()=default;
+    virtual ~Event()=default;
   public:
     Event(std::string name, double start_time, double end_time, std::string type)
       : name(name), start_time(start_time), end_time(end_time), type(type){}
index 618f9e0..2c06a75 100644 (file)
@@ -22,14 +22,14 @@ namespace jedule{
 XBT_PUBLIC_CLASS Container {
 public:
   Container(std::string name);
-  ~Container()=default;
+  virtual ~Container()=default;
 private:
   int last_id;
-  int is_lowest;
+  int is_lowest = 0;
 public:
   std::string name;
   std::unordered_map<const char*, int> name2id;
-  Container *parent;
+  Container *parent = nullptr;
   std::vector<Container*> children;
   std::vector<sg_host_t> resource_list;
   void addChild(Container* child);
@@ -46,6 +46,7 @@ public:
 SG_BEGIN_DECL()
 typedef simgrid::jedule::Container * jed_container_t;
 
+/* FIXME: jedule_container should be objectified too */
 /** selection of a subset of resources from the original set */
 struct jed_res_subset {
   jed_container_t parent;
@@ -55,6 +56,8 @@ struct jed_res_subset {
 
 typedef struct jed_res_subset s_jed_res_subset_t, *jed_res_subset_t;
 
+/* FIXME: jedule should be objectified too */
+
 typedef struct jedule_struct {
   jed_container_t root_container;
   std::unordered_map<char*, char*> jedule_meta_info;
index 93f494c..4303c36 100644 (file)
@@ -16,6 +16,7 @@
 namespace simgrid{
 namespace jedule{
 
+  /* FIXME: this should could maybe be merged into the destructor? */
 void Event::deleteEvent(){
   while (!this->resource_subsets.empty()){
     xbt_free(this->resource_subsets.back());
index 986762b..99a71dc 100644 (file)
@@ -16,8 +16,6 @@
 
 #if HAVE_JEDULE
 
-#define STR_BUF_SIZE 1024
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_out, jedule, "Logging specific to Jedule output");
 
 xbt_dynar_t jedule_event_list;
index d04c00f..a4373b0 100644 (file)
@@ -28,9 +28,6 @@ namespace jedule {
 Container::Container(std::string name)
 : name(name) {
 
-  this->is_lowest = 0;
-  this->parent = nullptr;
-
   xbt_dict_set(container_name2container, this->name.c_str(), this, nullptr);
 }
 
@@ -136,12 +133,10 @@ std::string Container::getHierarchyAsString(){
 }
 
 void Container::printResources(FILE * jed_file){
-  unsigned int res_nb;
   unsigned int i=0;
   xbt_assert(!this->resource_list.empty());
 
-  res_nb = this->resource_list.size();
-
+  unsigned int res_nb = this->resource_list.size();
   std::string resid = this->getHierarchyAsString();
 
   fprintf(jed_file, "      <rset id=\"%s\" nb=\"%u\" names=\"", resid.c_str(), res_nb);
@@ -176,6 +171,7 @@ static int compare_ids(const void *num1, const void *num2) {
   return *((int*) num1) - *((int*) num2);
 }
 
+/* FIXME: That should be the destructor, shouldnt it? */
 static void jed_free_container(jed_container_t container) {
   if(!container->children.empty()) {
     for (auto child: container->children){