Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix Memleaks
[simgrid.git] / src / surf / surf.hpp
index 358546a..770c293 100644 (file)
@@ -6,11 +6,9 @@
 #include <xbt.h>
 #include <string>
 #include <vector>
+#include <iostream>
 #include <memory>
-#include <boost/smart_ptr.hpp>
 #include <boost/function.hpp>
-#include <boost/functional/factory.hpp>
-#include <boost/bind.hpp>
 #include "surf/trace_mgr.h"
 #include "xbt/lib.h"
 #include "surf/surf_routing.h"
@@ -50,7 +48,6 @@ extern xbt_dynar_t surf_path;
 extern "C" {
 #endif
 XBT_PUBLIC(double) surf_get_clock(void);
-XBT_PUBLIC(void) surf_watched_hosts(void);
 #ifdef __cplusplus
 }
 #endif
@@ -170,7 +167,10 @@ class Resource {
 public:
   Resource();
   Resource(ModelPtr model, const char *name, xbt_dict_t properties);
-  virtual ~Resource() {};
+  virtual ~Resource() {
+       xbt_free((void*)m_name);
+    xbt_dict_free(&m_properties);
+  };
 
   virtual void updateState(tmgr_trace_event_t event_type, double value, double date)=0;
 
@@ -189,6 +189,7 @@ public:
 
   ModelPtr getModel() {return p_model;};
   virtual e_surf_resource_state_t getState();
+  virtual void setState(e_surf_resource_state_t state);
   void printModel() { std::cout << p_model->getName() << "<<plop"<<std::endl;};
   void *p_resource;
   const char *m_name;
@@ -204,7 +205,7 @@ private:
 
 class ResourceLmm: virtual public Resource {
 public:
-  ResourceLmm() {};
+  ResourceLmm() { p_power.event = NULL; };
   ResourceLmm(surf_model_t model, const char *name, xbt_dict_t props,
                            lmm_system_t system,
                            double constraint_value,
@@ -213,6 +214,7 @@ public:
                            tmgr_trace_t state_trace,
                            double metric_peak,
                            tmgr_trace_t metric_trace);
+  ~ResourceLmm() {};
   lmm_constraint_t p_constraint;
   tmgr_trace_event_t p_stateEvent;
   s_surf_metric_t p_power;
@@ -257,6 +259,7 @@ public:
   xbt_swag_t p_stateSet;
 
   double m_priority; /**< priority (1.0 by default) */
+  double m_bound;              /**< the capping of the CPU use  */
   bool m_failed;
   double m_start; /**< start time  */
   double m_finish; /**< finish time : this is modified during the run and fluctuates until the task is completed */
@@ -285,7 +288,6 @@ private:
   void updateResourceState(void *id, tmgr_trace_event_t event_type,
                                  double value, double time);
 
-  lmm_system_t p_maxminSystem;
   xbt_swag_t p_modifiedSet;
   xbt_heap_t p_actionHeap;
   int m_selectiveUpdate;
@@ -299,10 +301,14 @@ public:
   ActionLmm() : m_suspended(false) {
        p_actionListHookup.prev = 0;
        p_actionListHookup.next = 0;
+        m_lastUpdate = 0;
+        m_lastValue = 0;
   };
-  ActionLmm(ModelPtr model, double cost, bool failed) : m_suspended(false) {
+  ActionLmm(ModelPtr /*model*/, double /*cost*/, bool /*failed*/) : m_suspended(false) {
        p_actionListHookup.prev = 0;
        p_actionListHookup.next = 0;
+        m_lastUpdate = 0;
+        m_lastValue = 0;
   };
 
   virtual void updateRemainingLazy(double now);