Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename a type to better match its purpose
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 14 May 2017 21:08:25 +0000 (23:08 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 14 May 2017 21:08:38 +0000 (23:08 +0200)
19 files changed:
src/surf/cpu_cas01.cpp
src/surf/cpu_cas01.hpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/storage_interface.cpp
src/surf/storage_interface.hpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.hpp
src/surf/trace_mgr.cpp
src/surf/trace_mgr.hpp
src/surf/trace_mgr_test.cpp

index 1f5ebb5..8c11636 100644 (file)
@@ -119,7 +119,7 @@ void CpuCas01::onSpeedChange() {
   Cpu::onSpeedChange();
 }
 
   Cpu::onSpeedChange();
 }
 
-void CpuCas01::apply_event(tmgr_trace_iterator_t event, double value)
+void CpuCas01::apply_event(tmgr_trace_event_t event, double value)
 {
   if (event == speed_.event) {
     /* TODO (Hypervisor): do the same thing for constraint_core[i] */
 {
   if (event == speed_.event) {
     /* TODO (Hypervisor): do the same thing for constraint_core[i] */
index f05453d..0955ce2 100644 (file)
@@ -39,7 +39,7 @@ class CpuCas01 : public Cpu {
 public:
   CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core);
   ~CpuCas01() override;
 public:
   CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core);
   ~CpuCas01() override;
-  void apply_event(tmgr_trace_iterator_t event, double value) override;
+  void apply_event(tmgr_trace_event_t event, double value) override;
   CpuAction *execution_start(double size) override;
   CpuAction *sleep(double duration) override;
 
   CpuAction *execution_start(double size) override;
   CpuAction *sleep(double duration) override;
 
index 11c8ca0..c36600b 100644 (file)
@@ -121,7 +121,7 @@ public:
   virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values (0 or 1). */
   virtual void setSpeedTrace(tmgr_trace_t trace); /*< setup the trace file with availability events (peak speed changes due to external load). Trace must contain relative values (ratio between 0 and 1) */
 
   virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values (0 or 1). */
   virtual void setSpeedTrace(tmgr_trace_t trace); /*< setup the trace file with availability events (peak speed changes due to external load). Trace must contain relative values (ratio between 0 and 1) */
 
-  tmgr_trace_iterator_t stateEvent_ = nullptr;
+  tmgr_trace_event_t stateEvent_ = nullptr;
   s_surf_metric_t speed_ = {1.0, 0, nullptr};
 };
 
   s_surf_metric_t speed_ = {1.0, 0, nullptr};
 };
 
index a03ab80..21ca9d7 100644 (file)
@@ -428,7 +428,7 @@ void CpuTi::setSpeedTrace(tmgr_trace_t trace)
   }
 }
 
   }
 }
 
-void CpuTi::apply_event(tmgr_trace_iterator_t event, double value)
+void CpuTi::apply_event(tmgr_trace_event_t event, double value)
 {
   if (event == speed_.event) {
     tmgr_trace_t speedTrace;
 {
   if (event == speed_.event) {
     tmgr_trace_t speedTrace;
index 6eca45a..4059783 100644 (file)
@@ -116,7 +116,7 @@ public:
 
   void setSpeedTrace(tmgr_trace_t trace) override;
 
 
   void setSpeedTrace(tmgr_trace_t trace) override;
 
-  void apply_event(tmgr_trace_iterator_t event, double value) override;
+  void apply_event(tmgr_trace_event_t event, double value) override;
   void updateActionsFinishTime(double now);
   void updateRemainingAmount(double now);
 
   void updateActionsFinishTime(double now);
   void updateRemainingAmount(double now);
 
index ec1edd5..75af96b 100644 (file)
@@ -390,7 +390,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, doub
   simgrid::s4u::Link::onCreation(this->piface_);
 }
 
   simgrid::s4u::Link::onCreation(this->piface_);
 }
 
-void NetworkCm02Link::apply_event(tmgr_trace_iterator_t triggered, double value)
+void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
 {
   /* Find out which of my iterators was triggered, and react accordingly */
   if (triggered == bandwidth_.event) {
 {
   /* Find out which of my iterators was triggered, and react accordingly */
   if (triggered == bandwidth_.event) {
index 5fb0290..0870271 100644 (file)
@@ -60,7 +60,7 @@ namespace simgrid {
       NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
                       e_surf_link_sharing_policy_t policy, lmm_system_t system);
       virtual ~NetworkCm02Link() = default;
       NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
                       e_surf_link_sharing_policy_t policy, lmm_system_t system);
       virtual ~NetworkCm02Link() = default;
-      void apply_event(tmgr_trace_iterator_t event, double value) override;
+      void apply_event(tmgr_trace_event_t event, double value) override;
       void setBandwidth(double value) override;
       void setLatency(double value) override;
       virtual void gapAppend(double size, const LinkImpl* link, NetworkAction* action);
       void setBandwidth(double value) override;
       void setLatency(double value) override;
       virtual void gapAppend(double size, const LinkImpl* link, NetworkAction* action);
index 2e6d67b..01a2372 100644 (file)
@@ -157,7 +157,7 @@ public:
       tmgr_trace_t trace); /*< setup the trace file with latency events (peak latency changes due to external load).
                                    Trace must contain absolute values */
 
       tmgr_trace_t trace); /*< setup the trace file with latency events (peak latency changes due to external load).
                                    Trace must contain absolute values */
 
-  tmgr_trace_iterator_t stateEvent_ = nullptr;
+  tmgr_trace_event_t stateEvent_    = nullptr;
   s_surf_metric_t latency_          = {1.0, 0, nullptr};
   s_surf_metric_t bandwidth_        = {1.0, 0, nullptr};
 
   s_surf_metric_t latency_          = {1.0, 0, nullptr};
   s_surf_metric_t bandwidth_        = {1.0, 0, nullptr};
 
index e27db35..adf7d54 100644 (file)
@@ -271,7 +271,7 @@ LinkNS3::LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, dou
 
 LinkNS3::~LinkNS3() = default;
 
 
 LinkNS3::~LinkNS3() = default;
 
-void LinkNS3::apply_event(tmgr_trace_iterator_t event, double value)
+void LinkNS3::apply_event(tmgr_trace_event_t event, double value)
 {
   THROW_UNIMPLEMENTED;
 }
 {
   THROW_UNIMPLEMENTED;
 }
index be32134..ecdb950 100644 (file)
@@ -35,7 +35,7 @@ public:
   explicit LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency);
   ~LinkNS3();
 
   explicit LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency);
   ~LinkNS3();
 
-  void apply_event(tmgr_trace_iterator_t event, double value) override;
+  void apply_event(tmgr_trace_event_t event, double value) override;
   void setBandwidth(double value) override { THROW_UNIMPLEMENTED; }
   void setLatency(double value) override { THROW_UNIMPLEMENTED; }
   void setBandwidthTrace(tmgr_trace_t trace) override;
   void setBandwidth(double value) override { THROW_UNIMPLEMENTED; }
   void setLatency(double value) override { THROW_UNIMPLEMENTED; }
   void setBandwidthTrace(tmgr_trace_t trace) override;
index cc883f5..a963b8c 100644 (file)
@@ -326,7 +326,8 @@ bool LinkL07::isUsed(){
   return lmm_constraint_used(model()->getMaxminSystem(), constraint());
 }
 
   return lmm_constraint_used(model()->getMaxminSystem(), constraint());
 }
 
-void CpuL07::apply_event(tmgr_trace_iterator_t triggered, double value){
+void CpuL07::apply_event(tmgr_trace_event_t triggered, double value)
+{
   XBT_DEBUG("Updating cpu %s (%p) with value %g", cname(), this, value);
   if (triggered == speed_.event) {
     speed_.scale = value;
   XBT_DEBUG("Updating cpu %s (%p) with value %g", cname(), this, value);
   if (triggered == speed_.event) {
     speed_.scale = value;
@@ -345,7 +346,8 @@ void CpuL07::apply_event(tmgr_trace_iterator_t triggered, double value){
   }
 }
 
   }
 }
 
-void LinkL07::apply_event(tmgr_trace_iterator_t triggered, double value) {
+void LinkL07::apply_event(tmgr_trace_event_t triggered, double value)
+{
   XBT_DEBUG("Updating link %s (%p) with value=%f", cname(), this, value);
   if (triggered == bandwidth_.event) {
     setBandwidth(value);
   XBT_DEBUG("Updating link %s (%p) with value=%f", cname(), this, value);
   if (triggered == bandwidth_.event) {
     setBandwidth(value);
index 4a2d68d..5d25d4e 100644 (file)
@@ -75,7 +75,7 @@ public:
   CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, std::vector<double> * speedPerPstate, int core);
   ~CpuL07() override;
   bool isUsed() override;
   CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, std::vector<double> * speedPerPstate, int core);
   ~CpuL07() override;
   bool isUsed() override;
-  void apply_event(tmgr_trace_iterator_t event, double value) override;
+  void apply_event(tmgr_trace_event_t event, double value) override;
   Action *execution_start(double size) override;
   Action *sleep(double duration) override;
 protected:
   Action *execution_start(double size) override;
   Action *sleep(double duration) override;
 protected:
@@ -88,7 +88,7 @@ public:
           e_surf_link_sharing_policy_t policy);
   ~LinkL07() override;
   bool isUsed() override;
           e_surf_link_sharing_policy_t policy);
   ~LinkL07() override;
   bool isUsed() override;
-  void apply_event(tmgr_trace_iterator_t event, double value) override;
+  void apply_event(tmgr_trace_event_t event, double value) override;
   void setBandwidth(double value) override;
   void setLatency(double value) override;
 };
   void setBandwidth(double value) override;
   void setLatency(double value) override;
 };
index 30b7444..19b8361 100644 (file)
@@ -116,7 +116,7 @@ bool Storage::isUsed()
   return false;
 }
 
   return false;
 }
 
-void Storage::apply_event(tmgr_trace_iterator_t /*event*/, double /*value*/)
+void Storage::apply_event(tmgr_trace_event_t /*event*/, double /*value*/)
 {
   THROW_UNIMPLEMENTED;
 }
 {
   THROW_UNIMPLEMENTED;
 }
index eaeec0c..31c6dc8 100644 (file)
@@ -89,7 +89,7 @@ public:
   /** @brief Check if the Storage is used (if an action currently uses its resources) */
   bool isUsed() override;
 
   /** @brief Check if the Storage is used (if an action currently uses its resources) */
   bool isUsed() override;
 
-  void apply_event(tmgr_trace_iterator_t event, double value) override;
+  void apply_event(tmgr_trace_event_t event, double value) override;
 
   void turnOn() override;
   void turnOff() override;
 
   void turnOn() override;
   void turnOff() override;
index 7840806..8207100 100644 (file)
@@ -18,7 +18,7 @@ extern double NOW;
 void surf_presolve()
 {
   double next_event_date = -1.0;
 void surf_presolve()
 {
   double next_event_date = -1.0;
-  tmgr_trace_iterator_t event = nullptr;
+  tmgr_trace_event_t event          = nullptr;
   double value = -1.0;
   simgrid::surf::Resource *resource = nullptr;
 
   double value = -1.0;
   simgrid::surf::Resource *resource = nullptr;
 
@@ -46,7 +46,7 @@ double surf_solve(double max_date)
   double model_next_action_end = -1.0;
   double value = -1.0;
   simgrid::surf::Resource *resource = nullptr;
   double model_next_action_end = -1.0;
   double value = -1.0;
   simgrid::surf::Resource *resource = nullptr;
-  tmgr_trace_iterator_t event = nullptr;
+  tmgr_trace_event_t event          = nullptr;
 
   if (max_date > 0.0) {
     xbt_assert(max_date > NOW,"You asked to simulate up to %f, but that's in the past already", max_date);
 
   if (max_date > 0.0) {
     xbt_assert(max_date > NOW,"You asked to simulate up to %f, but that's in the past already", max_date);
index 25bc6fc..ac226cd 100644 (file)
@@ -353,7 +353,7 @@ private:
 typedef struct {
   double peak;              /**< The peak of the metric, ie its max value */
   double scale;             /**< Current availability of the metric according to the traces, in [0,1] */
 typedef struct {
   double peak;              /**< The peak of the metric, ie its max value */
   double scale;             /**< Current availability of the metric according to the traces, in [0,1] */
-  tmgr_trace_iterator_t event; /**< The associated trace event associated to the metric */
+  tmgr_trace_event_t event; /**< The associated trace event associated to the metric */
 } s_surf_metric_t;
 
 namespace simgrid {
 } s_surf_metric_t;
 
 namespace simgrid {
@@ -390,7 +390,7 @@ public:
    * @param event What happened
    * @param value [TODO]
    */
    * @param event What happened
    * @param value [TODO]
    */
-  virtual void apply_event(tmgr_trace_iterator_t event, double value)=0;
+  virtual void apply_event(tmgr_trace_event_t event, double value) = 0;
 
   /** @brief Check if the current Resource is used (if it currently serves an action) */
   virtual bool isUsed()=0;
 
   /** @brief Check if the current Resource is used (if it currently serves an action) */
   virtual bool isUsed()=0;
index 1d988b0..7d8c400 100644 (file)
@@ -118,9 +118,9 @@ void tmgr_trace_free(tmgr_trace_t trace)
 }
 
 /** @brief Registers a new trace into the future event set, and get an iterator over the integrated trace  */
 }
 
 /** @brief Registers a new trace into the future event set, and get an iterator over the integrated trace  */
-tmgr_trace_iterator_t simgrid::trace_mgr::future_evt_set::add_trace(tmgr_trace_t trace, surf::Resource* resource)
+tmgr_trace_event_t simgrid::trace_mgr::future_evt_set::add_trace(tmgr_trace_t trace, surf::Resource* resource)
 {
 {
-  tmgr_trace_iterator_t trace_iterator = nullptr;
+  tmgr_trace_event_t trace_iterator = nullptr;
 
   trace_iterator = xbt_new0(s_tmgr_trace_event_t, 1);
   trace_iterator->trace = trace;
 
   trace_iterator = xbt_new0(s_tmgr_trace_event_t, 1);
   trace_iterator->trace = trace;
@@ -144,14 +144,14 @@ double simgrid::trace_mgr::future_evt_set::next_date() const
 }
 
 /** @brief Retrieves the next occurring event, or nullptr if none happens before #date */
 }
 
 /** @brief Retrieves the next occurring event, or nullptr if none happens before #date */
-tmgr_trace_iterator_t simgrid::trace_mgr::future_evt_set::pop_leq(double date, double* value,
-                                                                  simgrid::surf::Resource** resource)
+tmgr_trace_event_t simgrid::trace_mgr::future_evt_set::pop_leq(double date, double* value,
+                                                               simgrid::surf::Resource** resource)
 {
   double event_date = next_date();
   if (event_date > date)
     return nullptr;
 
 {
   double event_date = next_date();
   if (event_date > date)
     return nullptr;
 
-  tmgr_trace_iterator_t trace_iterator = (tmgr_trace_iterator_t)xbt_heap_pop(p_heap);
+  tmgr_trace_event_t trace_iterator = (tmgr_trace_event_t)xbt_heap_pop(p_heap);
   if (trace_iterator == nullptr)
     return nullptr;
 
   if (trace_iterator == nullptr)
     return nullptr;
 
@@ -183,7 +183,7 @@ void tmgr_finalize()
   }
 }
 
   }
 }
 
-void tmgr_trace_event_unref(tmgr_trace_iterator_t *trace_event)
+void tmgr_trace_event_unref(tmgr_trace_event_t* trace_event)
 {
   if ((*trace_event)->free_me) {
     xbt_free(*trace_event);
 {
   if ((*trace_event)->free_me) {
     xbt_free(*trace_event);
index 13e91bb..902ee09 100644 (file)
@@ -19,13 +19,13 @@ typedef struct tmgr_event {
 } s_tmgr_event_t, *tmgr_event_t;
 
 /* Iterator within a trace */
 } s_tmgr_event_t, *tmgr_event_t;
 
 /* Iterator within a trace */
-typedef struct tmgr_trace_iterator {
+typedef struct tmgr_trace_event {
   tmgr_trace_t trace;
   unsigned int idx;
   sg_resource_t resource;
   int free_me;
 } s_tmgr_trace_event_t;
   tmgr_trace_t trace;
   unsigned int idx;
   sg_resource_t resource;
   int free_me;
 } s_tmgr_trace_event_t;
-typedef struct tmgr_trace_iterator *tmgr_trace_iterator_t;
+typedef struct tmgr_trace_event* tmgr_trace_event_t;
 
 /* Creation functions */
 XBT_PUBLIC(tmgr_trace_t) tmgr_empty_trace_new(void);
 
 /* Creation functions */
 XBT_PUBLIC(tmgr_trace_t) tmgr_empty_trace_new(void);
@@ -37,7 +37,7 @@ XBT_PUBLIC(void) tmgr_trace_free(tmgr_trace_t trace);
  * This flag indicates whether the structure is still used somewhere or not.
  * When the structure is freed, the argument is set to nullptr
 */
  * This flag indicates whether the structure is still used somewhere or not.
  * When the structure is freed, the argument is set to nullptr
 */
-XBT_PUBLIC(void) tmgr_trace_event_unref(tmgr_trace_iterator_t *trace_event);
+XBT_PUBLIC(void) tmgr_trace_event_unref(tmgr_trace_event_t* trace_event);
 
 XBT_PUBLIC(void) tmgr_finalize(void);
 
 
 XBT_PUBLIC(void) tmgr_finalize(void);
 
@@ -83,8 +83,8 @@ public:
   future_evt_set();
   virtual ~future_evt_set();
   double next_date() const;
   future_evt_set();
   virtual ~future_evt_set();
   double next_date() const;
-  tmgr_trace_iterator_t pop_leq(double date, double *value, simgrid::surf::Resource** resource);
-  tmgr_trace_iterator_t add_trace(tmgr_trace_t trace, simgrid::surf::Resource * resource);
+  tmgr_trace_event_t pop_leq(double date, double* value, simgrid::surf::Resource** resource);
+  tmgr_trace_event_t add_trace(tmgr_trace_t trace, simgrid::surf::Resource * resource);
 
 private:
   // TODO: use a boost type for the heap (or a ladder queue)
 
 private:
   // TODO: use a boost type for the heap (or a ladder queue)
index 2cf197b..81e3a23 100644 (file)
@@ -24,7 +24,7 @@ double thedate;
 class MockedResource : public simgrid::surf::Resource {
 public:
   explicit MockedResource() : simgrid::surf::Resource(nullptr, "fake", nullptr) {}
 class MockedResource : public simgrid::surf::Resource {
 public:
   explicit MockedResource() : simgrid::surf::Resource(nullptr, "fake", nullptr) {}
-  void apply_event(tmgr_trace_iterator_t event, double value)
+  void apply_event(tmgr_trace_event_t event, double value)
   {
     XBT_VERB("t=%.1f: Change value to %lg (idx: %d)", thedate, value, event->idx);
   }
   {
     XBT_VERB("t=%.1f: Change value to %lg (idx: %d)", thedate, value, event->idx);
   }
@@ -58,13 +58,13 @@ static void trace2vector(const char* str, std::vector<Evt>* whereto)
 
   MockedResource daResource;
   simgrid::trace_mgr::future_evt_set fes;
 
   MockedResource daResource;
   simgrid::trace_mgr::future_evt_set fes;
-  tmgr_trace_iterator_t insertedIt = fes.add_trace(trace, &daResource);
+  tmgr_trace_event_t insertedIt = fes.add_trace(trace, &daResource);
 
   while (fes.next_date() <= 20.0 && fes.next_date() >= 0) {
     thedate = fes.next_date();
     double value;
     simgrid::surf::Resource* res;
 
   while (fes.next_date() <= 20.0 && fes.next_date() >= 0) {
     thedate = fes.next_date();
     double value;
     simgrid::surf::Resource* res;
-    tmgr_trace_iterator_t it = fes.pop_leq(thedate, &value, &res);
+    tmgr_trace_event_t it = fes.pop_leq(thedate, &value, &res);
     if (it == nullptr)
       continue;
 
     if (it == nullptr)
       continue;