Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
further s/trace/profile/ cleanups
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 21 Jan 2019 13:58:12 +0000 (14:58 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 21 Jan 2019 14:23:06 +0000 (15:23 +0100)
include/simgrid/kernel/resource/Resource.hpp
include/simgrid/s4u/Link.hpp
src/surf/trace_mgr.cpp
src/surf/trace_mgr.hpp

index ecfd29d..fa581d1 100644 (file)
@@ -52,7 +52,7 @@ public:
 
   /** @brief returns the current load due to activities (in flops per second, byte per second or similar)
    *
 
   /** @brief returns the current load due to activities (in flops per second, byte per second or similar)
    *
-   * The load due to external usages modeled by trace files is ignored.*/
+   * The load due to external usages modeled by profile files is ignored.*/
   virtual double get_load();
 
   /** @brief Check if the current Resource is active */
   virtual double get_load();
 
   /** @brief Check if the current Resource is active */
@@ -63,15 +63,12 @@ public:
   virtual void turn_on();
   /** @brief Turn off the current Resource */
   virtual void turn_off();
   virtual void turn_on();
   /** @brief Turn off the current Resource */
   virtual void turn_off();
-  /** @brief setup the trace file with states events (ON or OFF). Trace must contain boolean values. */
+  /** @brief setup the profile file with states events (ON or OFF). The profile must contain boolean values. */
   virtual void set_state_profile(profile::Profile* profile);
 
 #ifndef DOXYGEN
   XBT_ATTRIB_DEPRECATED_v325("Please use Resource::set_state_profile()") virtual void set_state_trace(
   virtual void set_state_profile(profile::Profile* profile);
 
 #ifndef DOXYGEN
   XBT_ATTRIB_DEPRECATED_v325("Please use Resource::set_state_profile()") virtual void set_state_trace(
-      profile::Profile* profile)
-  {
-    set_state_profile(profile);
-  }
+      profile::Profile* profile) { set_state_profile(profile); }
 #endif
 
 private:
 #endif
 
 private:
@@ -92,8 +89,8 @@ public:
 protected:
   struct Metric {
     double peak;       /**< The peak of the metric, ie its max value */
 protected:
   struct Metric {
     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] */
-    profile::Event* event; /**< The associated trace event associated to the metric */
+    double scale;      /**< Current availability of the metric according to the profiles, in [0,1] */
+    profile::Event* event; /**< The associated profile event associated to the metric */
   };
 };
 } // namespace resource
   };
 };
 } // namespace resource
index 8029280..735321a 100644 (file)
@@ -151,22 +151,13 @@ public:
 
   /** @deprecated */
   XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_state_profile()") void setStateTrace(
 
   /** @deprecated */
   XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_state_profile()") void setStateTrace(
-      simgrid::kernel::profile::Profile* trace)
-  {
-    set_state_profile(trace);
-  }
+      simgrid::kernel::profile::Profile* profile) {set_state_profile(profile); }
   /** @deprecated */
   XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_bandwidth_profile()") void setBandwidthTrace(
   /** @deprecated */
   XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_bandwidth_profile()") void setBandwidthTrace(
-      simgrid::kernel::profile::Profile* trace)
-  {
-    set_bandwidth_profile(trace);
-  }
+      simgrid::kernel::profile::Profile* profile) { set_bandwidth_profile(profile); }
   /** @deprecated */
   XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_latency_profile()") void setLatencyTrace(
   /** @deprecated */
   XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_latency_profile()") void setLatencyTrace(
-      simgrid::kernel::profile::Profile* trace)
-  {
-    set_latency_profile(trace);
-  }
+      simgrid::kernel::profile::Profile* profile) { set_latency_profile(profile); }
 #endif
 };
 }
 #endif
 };
 }
index cc0873d..d84999c 100644 (file)
@@ -124,20 +124,20 @@ namespace profile {
 /** @brief Registers a new trace into the future event set, and get an iterator over the integrated trace  */
 Event* FutureEvtSet::add_trace(Profile* profile, resource::Resource* resource)
 {
 /** @brief Registers a new trace into the future event set, and get an iterator over the integrated trace  */
 Event* FutureEvtSet::add_trace(Profile* profile, resource::Resource* resource)
 {
-  Event* trace_iterator    = new Event();
-  trace_iterator->profile  = profile;
-  trace_iterator->idx      = 0;
-  trace_iterator->resource = resource;
-  trace_iterator->free_me  = false;
+  Event* event    = new Event();
+  event->profile  = profile;
+  event->idx      = 0;
+  event->resource = resource;
+  event->free_me  = false;
 
 
-  xbt_assert((trace_iterator->idx < profile->event_list.size()), "Your trace should have at least one event!");
+  xbt_assert((event->idx < profile->event_list.size()), "Your profile should have at least one event!");
 
 
-  heap_.emplace(0.0 /* start time */, trace_iterator);
+  heap_.emplace(0.0 /* start time */, event);
 
 
-  return trace_iterator;
+  return event;
 }
 
 }
 
-/** @brief returns the date of the next occurring event (pure function) */
+/** @brief returns the date of the next occurring event */
 double FutureEvtSet::next_date() const
 {
   return heap_.empty() ? -1.0 : heap_.top().first;
 double FutureEvtSet::next_date() const
 {
   return heap_.empty() ? -1.0 : heap_.top().first;
@@ -152,27 +152,27 @@ Event* FutureEvtSet::pop_leq(double date, double* value, resource::Resource** re
 
   if (heap_.empty())
     return nullptr;
 
   if (heap_.empty())
     return nullptr;
-  Event* trace_iterator = heap_.top().second;
+  Event* event = heap_.top().second;
   heap_.pop();
 
   heap_.pop();
 
-  Profile* trace = trace_iterator->profile;
-  *resource = trace_iterator->resource;
+  Profile* profile = event->profile;
+  *resource        = event->resource;
 
 
-  DatedValue dateVal = trace->event_list.at(trace_iterator->idx);
+  DatedValue dateVal = profile->event_list.at(event->idx);
 
   *value = dateVal.value_;
 
 
   *value = dateVal.value_;
 
-  if (trace_iterator->idx < trace->event_list.size() - 1) {
-    heap_.emplace(event_date + dateVal.date_, trace_iterator);
-    trace_iterator->idx++;
+  if (event->idx < profile->event_list.size() - 1) {
+    heap_.emplace(event_date + dateVal.date_, event);
+    event->idx++;
   } else if (dateVal.date_ > 0) { /* Last element. Shall we loop? */
   } else if (dateVal.date_ > 0) { /* Last element. Shall we loop? */
-    heap_.emplace(event_date + dateVal.date_, trace_iterator);
-    trace_iterator->idx = 1; /* idx=0 is a placeholder to store when events really start */
-  } else {                   /* If we don't loop, we don't need this trace_event anymore */
-    trace_iterator->free_me = true;
+    heap_.emplace(event_date + dateVal.date_, event);
+    event->idx = 1; /* idx=0 is a placeholder to store when events really start */
+  } else {          /* If we don't loop, we don't need this event anymore */
+    event->free_me = true;
   }
 
   }
 
-  return trace_iterator;
+  return event;
 }
 } // namespace profile
 } // namespace kernel
 }
 } // namespace profile
 } // namespace kernel
@@ -184,10 +184,10 @@ void tmgr_finalize()
   trace_list.clear();
 }
 
   trace_list.clear();
 }
 
-void tmgr_trace_event_unref(simgrid::kernel::profile::Event** trace_event)
+void tmgr_trace_event_unref(simgrid::kernel::profile::Event** event)
 {
 {
-  if ((*trace_event)->free_me) {
-    delete *trace_event;
-    *trace_event = nullptr;
+  if ((*event)->free_me) {
+    delete *event;
+    *event = nullptr;
   }
 }
   }
 }
index 087f211..1e749de 100644 (file)
@@ -93,7 +93,7 @@ public:
   virtual ~FutureEvtSet();
   double next_date() const;
   Event* pop_leq(double date, double* value, resource::Resource** resource);
   virtual ~FutureEvtSet();
   double next_date() const;
   Event* pop_leq(double date, double* value, resource::Resource** resource);
-  Event* add_trace(Profile* trace, resource::Resource* resource);
+  Event* add_trace(Profile* profile, resource::Resource* resource);
 
 private:
   typedef std::pair<double, Event*> Qelt;
 
 private:
   typedef std::pair<double, Event*> Qelt;